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

Compare commits

..

No commits in common. "85a0b87da36a7aa0fe17a40f8261339e75a45d7d" and "2b7abf802f3765cbee03594e2995231055cfcabd" have entirely different histories.

12 changed files with 92 additions and 60 deletions

View File

@ -1,7 +1,7 @@
: OP1 CREATE C, DOES> C@ A, ; : OP1 CREATE C, DOES> C@ A, ;
0xf3 OP1 DI, 0xfb OP1 EI, 0xf3 OP1 DI, 0xfb OP1 EI,
0xeb OP1 EXDEHL, 0xd9 OP1 EXX, 0xeb OP1 EXDEHL, 0xd9 OP1 EXX,
0x08 OP1 EXAFAF', 0xe3 OP1 EX(SP)HL, 0x08 OP1 EXAFAF',
0x76 OP1 HALT, 0xe9 OP1 JP(HL), 0x76 OP1 HALT, 0xe9 OP1 JP(HL),
0x12 OP1 LD(DE)A, 0x1a OP1 LDA(DE), 0x12 OP1 LD(DE)A, 0x1a OP1 LDA(DE),
0x02 OP1 LD(BC)A, 0x0a OP1 LDA(BC), 0x02 OP1 LD(BC)A, 0x0a OP1 LDA(BC),

View File

@ -5,7 +5,7 @@
: JPNEXT, 26 BJP, ; ( 26 == next ) : JPNEXT, 26 BJP, ; ( 26 == next )
: chkPS, L4 @ BCALL, ; ( chkPS, B305 ) : chkPS, 29 BCALL, ; ( 29 == chkPS )
: CODE ( same as CREATE, but with native word ) : CODE ( same as CREATE, but with native word )
(entry) (entry)

View File

@ -1,12 +1,11 @@
H@ ORG ! H@ ORG !
0 JPnn, ( 00, main ) 0 JPnn, ( 03, find ) 0 JPnn, ( 00, main ) 0 JPnn, ( 03, find )
NOP, NOP, ( 06, unused ) NOP, NOP, ( 08, LATEST ) NOP, NOP, ( 06, unused ) NOP, NOP, ( 08, LATEST )
NOP, ( 0a, unused ) NOP, ( 0a, unused ) 0 JPnn, ( 0b, cellWord )
( 0b cellWord, push PFA ) DE PUSHqq, JR, 0x0c A, ( next )
0 JPnn, ( 0e, compiledWord ) 0 JPnn, ( 11, pushRS ) 0 JPnn, ( 0e, compiledWord ) 0 JPnn, ( 11, pushRS )
0 JPnn, ( 14, popRS ) 0 JPnn, ( 14, popRS )
EXDEHL, JP(HL), NOP, ( 17, nativeWord ) EXDEHL, JP(HL), NOP, ( 17, nativeWord )
0 JPnn, ( 1a, next ) 0 JPnn, ( unused ) 0 JPnn, ( 1a, next ) 0 JPnn, ( 1d, chkPS )
NOP, NOP, ( 20, numberWord ) NOP, NOP, ( 22, litWord ) NOP, NOP, ( 20, numberWord ) NOP, NOP, ( 22, litWord )
NOP, NOP, ( 24, addrWord ) NOP, NOP, ( 26, unused ) NOP, NOP, ( 24, addrWord ) NOP, NOP, ( 26, unused )
0 JPnn, ( RST 28 ) 0 JPnn, ( RST 28 )
@ -14,3 +13,4 @@ NOP, NOP, ( 24, addrWord ) NOP, NOP, ( 26, unused )
0 JPnn, ( RST 30 ) 0 JPnn, ( RST 30 )
0 JPnn, ( 33, execute ) NOP, NOP, ( unused ) 0 JPnn, ( 33, execute ) NOP, NOP, ( unused )
0 JPnn, ( RST 38 ) 0 JPnn, ( RST 38 )

View File

@ -1,4 +1,4 @@
L4 BSET PC ORG @ 0x12 + ! ( pushRS ) PC ORG @ 0x12 + ! ( pushRS )
IX INCss, IX INCss,
IX INCss, IX INCss,
0 IX+ L LDIXYr, 0 IX+ L LDIXYr,

16
blk/299
View File

@ -0,0 +1,16 @@
PC ORG @ 0x1e + ! ( chkPS )
( Note that you only need to call this in words that push
back to PSP. If they don't, calling chkPS is redundant with
check in next )
EXX,
( We have the return address for this very call on the stack
and protected registers. 2 - is to compensate that. )
HL PS_ADDR 2 - LDddnn,
SP SUBHLss,
EXX,
CNC RETcc, ( PS_ADDR >= SP? good )
JR, L2 BWR ( abortUnderflow-B298 )

10
blk/300
View File

@ -3,14 +3,14 @@ PC ORG @ 0x1b + ! ( next )
we jump to current IP, but we also take care of increasing we jump to current IP, but we also take care of increasing
it by 2 before jumping. ) it by 2 before jumping. )
( Before we continue: are stacks within bounds? ) ( Before we continue: are stacks within bounds? )
( PS ) HL PS_ADDR LDddnn, 0x1d BCALL, ( chkPS )
SP SUBHLss, ( check RS )
JRC, L2 BWR ( abortUnderflow-B298 ) IX PUSHqq, HL POPqq,
( RS ) IX PUSHqq, HL POPqq,
DE RS_ADDR LDddnn, DE RS_ADDR LDddnn,
DE SUBHLss, DE SUBHLss,
JRC, L2 BWR ( IX < RS_ADDR? abortUnderflow-B298 ) JRC, L2 BWR ( IX < RS_ADDR? abortUnderflow-B298 )
E 0 IY+ LDrIXY, E 0 IY+ LDrIXY,
D 1 IY+ LDrIXY, D 1 IY+ LDrIXY,
IY INCss, IY INCss, IY INCss,
IY INCss,
( continue to execute ) ( continue to execute )

28
blk/302
View File

@ -1,16 +1,16 @@
PC ORG @ 0x2c + ! ( doesWord ) L1 BSET PC ORG @ 0x0f + ! ( compiledWord )
( The word was spawned from a definition word that has a ( 1. Push current IP to RS
DOES>. PFA+2 (right after the actual cell) is a link to the 2. Set new IP to the second atom of the list
slot right after that DOES>. Therefore, what we need to do 3. Execute the first atom of the list. )
push the cell addr like a regular cell, then follow the IY PUSHqq, HL POPqq, ( <-- IP )
linkfrom the PFA, and then continue as a regular 0x11 BCALL, ( 11 == pushRS )
compiledWord. ) EXDEHL, ( HL points to PFA )
DE PUSHqq, ( like a regular cell ) ( While we inc, dereference into DE for execute call later. )
EXDEHL, LDDE(HL),
HL INCss, HL INCss,
HL INCss, HL PUSHqq, IY POPqq, ( --> IP )
E (HL) LDrr, JR, L3 BWR ( execute-B301 )
HL INCss,
D (HL) LDrr,
( continue to compiledWord )

24
blk/303
View File

@ -1,15 +1,15 @@
PC ORG @ 0x0f + ! ( compiledWord ) PC ORG @ 0x0c + ! ( cellWord )
( 1. Push current IP to RS ( Pushes PFA directly )
2. Set new IP to the second atom of the list DE PUSHqq,
3. Execute the first atom of the list. ) JPNEXT,
IY PUSHqq, HL POPqq, ( <-- IP )
L4 @ ( pushRS ) BCALL,
EXDEHL, ( HL points to PFA )
( While we inc, dereference into DE for execute call later. )
LDDE(HL),
HL INCss,
HL PUSHqq, IY POPqq, ( --> IP )
JR, L3 BWR ( execute-B301 )

16
blk/304 Normal file
View File

@ -0,0 +1,16 @@
PC ORG @ 0x2c + ! ( doesWord )
( The word was spawned from a definition word that has a
DOES>. PFA+2 (right after the actual cell) is a link to the
slot right after that DOES>. Therefore, what we need to do
push the cell addr like a regular cell, then follow the
linkfrom the PFA, and then continue as a regular
compiledWord. )
DE PUSHqq, ( like a regular cell )
EXDEHL,
HL INCss,
HL INCss,
E (HL) LDrr,
HL INCss,
D (HL) LDrr,
JR, L1 BWR ( compiledWord-B302 )

24
blk/305
View File

@ -1,15 +1,15 @@
L4 BSET ( chkPS ) ( Core words )
( Note that you only need to call this in words that push ( KEY and EMIT are not defined here. There're
back to PSP. If they don't, calling chkPS is redundant with expected to be defined in platform-specific code. )
check in next )
EXX,
( We have the return address for this very call on the stack CODE EXECUTE
and protected registers. 2 - is to compensate that. ) DE POPqq,
HL PS_ADDR 2 - LDddnn, chkPS,
SP SUBHLss, JR, L3 BWR ( execute-B301 )
EXX,
CNC RETcc, ( PS_ADDR >= SP? good )
JR, L2 BWR ( abortUnderflow-B298 )

22
blk/306
View File

@ -1,16 +1,16 @@
( Core words )
( KEY and EMIT are not defined here. There're
expected to be defined in platform-specific code. )
CODE EXECUTE
DE POPqq,
chkPS,
JR, L3 BWR ( execute-B301 )
( a b c -- b c a ) ( a b c -- b c a )
CODE ROT CODE ROT
HL POPqq, ( C ) DE POPqq, ( B ) BC POPqq, ( A ) HL POPqq, ( C )
DE POPqq, ( B )
BC POPqq, ( A )
chkPS, chkPS,
DE PUSHqq, ( B ) HL PUSHqq, ( C ) BC PUSHqq, ( A ) DE PUSHqq, ( B )
HL PUSHqq, ( C )
BC PUSHqq, ( A )
;CODE ;CODE

Binary file not shown.