1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-30 19:48:06 +11:00

Use IY for IP instead of RAM+06

This commit is contained in:
Virgil Dupras 2020-04-15 17:01:15 -04:00
parent 2a84a426b4
commit 0750e8d0c0
3 changed files with 27 additions and 31 deletions

View File

@ -2,7 +2,7 @@
RAMSTART INITIAL_SP +53 readln's variables RAMSTART INITIAL_SP +53 readln's variables
+02 CURRENT +55 adev's variables +02 CURRENT +55 adev's variables
+04 HERE +57 blk's variables +04 HERE +57 blk's variables
+06 IP +59 z80a's variables +06 FUTURE USES +59 z80a's variables
+08 FLAGS +5b FUTURE USES +08 FLAGS +5b FUTURE USES
+0a PARSEPTR +70 DRIVERS +0a PARSEPTR +70 DRIVERS
+0c CINPTR +80 RAMEND +0c CINPTR +80 RAMEND

Binary file not shown.

View File

@ -1,6 +1,13 @@
( Configuration words: RAMSTART, RS_ADDR ) ( Configuration words: RAMSTART, RS_ADDR )
H@ 256 /MOD 2 PC! 2 PC! H@ 256 /MOD 2 PC! 2 PC!
( RESERVED REGISTERS
At all times, IX points to RSP TOS and IY is IP. SP points
to PSP TOS, but you can still use the stack in native code.
you just have to make sure you've restored it before "next".
)
( STABLE ABI ( STABLE ABI
Those jumps below are supposed to stay at these offsets, Those jumps below are supposed to stay at these offsets,
always. If they change bootstrap binaries have to be always. If they change bootstrap binaries have to be
@ -44,10 +51,10 @@ NOP, ( unused )
'E' A, 'X' A, 'I' A, 'T' A, 'E' A, 'X' A, 'I' A, 'T' A,
0 A,, ( prev ) 0 A,, ( prev )
4 A, 4 A,
L1 BSET ( EXIT ) L1 BSET ( EXIT, 0x43 )
0x17 A, ( nativeWord ) 0x17 A, ( nativeWord )
0x14 CALLnn, ( popRS ) 0x14 CALLnn, ( popRS )
RAMSTART 0x06 + LD(nn)HL, ( RAMSTART+0x06 == IP ) HL PUSHqq, IY POPqq, ( --> IP )
JPNEXT, JPNEXT,
NOP, NOP, NOP, NOP, ( unused ) NOP, NOP, NOP, NOP, ( unused )
@ -58,13 +65,13 @@ PC L1 @ - A,, ( prev )
L1 BSET ( BR ) L1 BSET ( BR )
0x17 A, ( nativeWord ) 0x17 A, ( nativeWord )
L2 BSET ( used in CBR ) L2 BSET ( used in CBR )
RAMSTART 0x06 + LDHL(nn), ( RAMSTART+0x06 == IP ) IY PUSHqq, HL POPqq, ( <-- IP )
E (HL) LDrr, E (HL) LDrr,
HL INCss, HL INCss,
D (HL) LDrr, D (HL) LDrr,
HL DECss, HL DECss,
DE ADDHLss, DE ADDHLss,
RAMSTART 0x06 + LD(nn)HL, ( RAMSTART+0x06 == IP ) HL PUSHqq, IY POPqq, ( --> IP )
JPNEXT, JPNEXT,
NOP, ( unused ) NOP, ( unused )
@ -80,10 +87,8 @@ H@ XCURRENT ! ( set current tip of dict )
L ORr, L ORr,
JRZ, L2 BWR ( BR + 2. False, branch ) JRZ, L2 BWR ( BR + 2. False, branch )
( True, skip next 2 bytes and don't branch ) ( True, skip next 2 bytes and don't branch )
RAMSTART 0x06 + LDHL(nn), ( RAMSTART+0x06 == IP ) IY INCss,
HL INCss, IY INCss,
HL INCss,
RAMSTART 0x06 + LD(nn)HL, ( RAMSTART+0x06 == IP )
JPNEXT, JPNEXT,
( END OF STABLE ABI ) ( END OF STABLE ABI )
@ -101,12 +106,10 @@ PC ORG @ 0x24 + ! ( addrWord )
compiled word list. What we need to do to fetch that number compiled word list. What we need to do to fetch that number
is to play with the IP. is to play with the IP.
) )
RAMSTART 0x06 + LDHL(nn), ( RAMSTART+0x06 == IP ) E 0 IY+ LDrIXY,
E (HL) LDrr, D 1 IY+ LDrIXY,
HL INCss, IY INCss,
D (HL) LDrr, IY INCss,
HL INCss,
RAMSTART 0x06 + LD(nn)HL, ( RAMSTART+0x06 == IP )
DE PUSHqq, DE PUSHqq,
JPNEXT, JPNEXT,
@ -115,7 +118,7 @@ PC ORG @ 0x22 + ! ( litWord )
string literal. Instead of being followed by a 2 bytes string literal. Instead of being followed by a 2 bytes
number, it's followed by a null-terminated string. When number, it's followed by a null-terminated string. When
called, puts the string's address on PS ) called, puts the string's address on PS )
RAMSTART 0x06 + LDHL(nn), ( RAMSTART+0x06 == IP ) IY PUSHqq, HL POPqq, ( <-- IP )
HL PUSHqq, HL PUSHqq,
( skip to null char ) ( skip to null char )
A XORr, ( look for null ) A XORr, ( look for null )
@ -125,7 +128,7 @@ PC ORG @ 0x22 + ! ( litWord )
( CPIR advances HL regardless of comparison, so goes one ( CPIR advances HL regardless of comparison, so goes one
char after NULL. This is good, because that's what we char after NULL. This is good, because that's what we
want... ) want... )
RAMSTART 0x06 + LD(nn)HL, ( RAMSTART+0x06 == IP ) HL PUSHqq, IY POPqq, ( --> IP )
JPNEXT, JPNEXT,
( Name of BOOT word ) ( Name of BOOT word )
@ -294,17 +297,10 @@ PC ORG @ 0x1b + ! ( next )
( Before we continue: are stacks within bounds? ) ( Before we continue: are stacks within bounds? )
0x1d CALLnn, ( chkPS ) 0x1d CALLnn, ( chkPS )
L2 @ CALLnn, ( chkRS ) L2 @ CALLnn, ( chkRS )
DE RAMSTART 0x06 + LDdd(nn), ( RAMSTART+0x06 == IP ) E 0 IY+ LDrIXY,
H D LDrr, D 1 IY+ LDrIXY,
L E LDrr, IY INCss,
DE INCss, IY INCss,
DE INCss,
RAMSTART 0x06 + DE LD(nn)dd, ( RAMSTART+0x06 == IP )
( HL is an atom list pointer. We need to go into it to
have a wordref )
E (HL) LDrr,
HL INCss,
D (HL) LDrr,
( continue to execute ) ( continue to execute )
PC ORG @ 0x34 + ! ( execute ) PC ORG @ 0x34 + ! ( execute )
@ -324,7 +320,7 @@ PC ORG @ 0x0f + ! ( compiledWord )
1. Push current IP to RS 1. Push current IP to RS
2. Set new IP to the second atom of the list 2. Set new IP to the second atom of the list
3. Execute the first atom of the list. ) 3. Execute the first atom of the list. )
RAMSTART 0x06 + LDHL(nn), ( RAMSTART+0x06 == IP ) IY PUSHqq, HL POPqq, ( <-- IP )
0x11 CALLnn, ( 11 == pushRS ) 0x11 CALLnn, ( 11 == pushRS )
EXDEHL, ( HL points to PFA ) EXDEHL, ( HL points to PFA )
( While we increase, dereference into DE for execute call ( While we increase, dereference into DE for execute call
@ -333,7 +329,7 @@ PC ORG @ 0x0f + ! ( compiledWord )
HL INCss, HL INCss,
D (HL) LDrr, D (HL) LDrr,
HL INCss, HL INCss,
RAMSTART 0x06 + LD(nn)HL, ( RAMSTART+0x06 == IP ) HL PUSHqq, IY POPqq, ( --> IP )
0x33 JPnn, ( 33 == execute ) 0x33 JPnn, ( 33 == execute )
PC ORG @ 0x0c + ! ( cellWord ) PC ORG @ 0x0c + ! ( cellWord )