1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-26 16:38: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, ;
0xf3 OP1 DI, 0xfb OP1 EI,
0xeb OP1 EXDEHL, 0xd9 OP1 EXX,
0x08 OP1 EXAFAF', 0xe3 OP1 EX(SP)HL,
0x08 OP1 EXAFAF',
0x76 OP1 HALT, 0xe9 OP1 JP(HL),
0x12 OP1 LD(DE)A, 0x1a OP1 LDA(DE),
0x02 OP1 LD(BC)A, 0x0a OP1 LDA(BC),

View File

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

View File

@ -1,12 +1,11 @@
H@ ORG !
0 JPnn, ( 00, main ) 0 JPnn, ( 03, find )
NOP, NOP, ( 06, unused ) NOP, NOP, ( 08, LATEST )
NOP, ( 0a, unused )
( 0b cellWord, push PFA ) DE PUSHqq, JR, 0x0c A, ( next )
NOP, ( 0a, unused ) 0 JPnn, ( 0b, cellWord )
0 JPnn, ( 0e, compiledWord ) 0 JPnn, ( 11, pushRS )
0 JPnn, ( 14, popRS )
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, ( 24, addrWord ) NOP, NOP, ( 26, unused )
0 JPnn, ( RST 28 )
@ -14,3 +13,4 @@ NOP, NOP, ( 24, addrWord ) NOP, NOP, ( 26, unused )
0 JPnn, ( RST 30 )
0 JPnn, ( 33, execute ) NOP, NOP, ( unused )
0 JPnn, ( RST 38 )

View File

@ -1,4 +1,4 @@
L4 BSET PC ORG @ 0x12 + ! ( pushRS )
PC ORG @ 0x12 + ! ( pushRS )
IX INCss,
IX INCss,
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
it by 2 before jumping. )
( Before we continue: are stacks within bounds? )
( PS ) HL PS_ADDR LDddnn,
SP SUBHLss,
JRC, L2 BWR ( abortUnderflow-B298 )
( RS ) IX PUSHqq, HL POPqq,
0x1d BCALL, ( chkPS )
( check RS )
IX PUSHqq, HL POPqq,
DE RS_ADDR LDddnn,
DE SUBHLss,
JRC, L2 BWR ( IX < RS_ADDR? abortUnderflow-B298 )
E 0 IY+ LDrIXY,
D 1 IY+ LDrIXY,
IY INCss, IY INCss,
IY INCss,
IY INCss,
( continue to execute )

28
blk/302
View File

@ -1,16 +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,
L1 BSET PC ORG @ 0x0f + ! ( compiledWord )
( 1. Push current IP to RS
2. Set new IP to the second atom of the list
3. Execute the first atom of the list. )
IY PUSHqq, HL POPqq, ( <-- IP )
0x11 BCALL, ( 11 == pushRS )
EXDEHL, ( HL points to PFA )
( While we inc, dereference into DE for execute call later. )
LDDE(HL),
HL INCss,
HL INCss,
E (HL) LDrr,
HL INCss,
D (HL) LDrr,
( continue to compiledWord )
HL PUSHqq, IY POPqq, ( --> IP )
JR, L3 BWR ( execute-B301 )

24
blk/303
View File

@ -1,15 +1,15 @@
PC ORG @ 0x0f + ! ( compiledWord )
( 1. Push current IP to RS
2. Set new IP to the second atom of the list
3. Execute the first atom of the list. )
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 )
PC ORG @ 0x0c + ! ( cellWord )
( Pushes PFA directly )
DE PUSHqq,
JPNEXT,

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 )
( 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 )
( 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 )

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 )
CODE ROT
HL POPqq, ( C ) DE POPqq, ( B ) BC POPqq, ( A )
HL POPqq, ( C )
DE POPqq, ( B )
BC POPqq, ( A )
chkPS,
DE PUSHqq, ( B ) HL PUSHqq, ( C ) BC PUSHqq, ( A )
DE PUSHqq, ( B )
HL PUSHqq, ( C )
BC PUSHqq, ( A )
;CODE

Binary file not shown.