mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-26 14:58:06 +11:00
Compare commits
4 Commits
2b7abf802f
...
85a0b87da3
Author | SHA1 | Date | |
---|---|---|---|
|
85a0b87da3 | ||
|
38d5a9f303 | ||
|
40f92b9bab | ||
|
31095bc04d |
2
blk/216
2
blk/216
@ -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',
|
0x08 OP1 EXAFAF', 0xe3 OP1 EX(SP)HL,
|
||||||
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),
|
||||||
|
2
blk/243
2
blk/243
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
: JPNEXT, 26 BJP, ; ( 26 == next )
|
: JPNEXT, 26 BJP, ; ( 26 == next )
|
||||||
|
|
||||||
: chkPS, 29 BCALL, ; ( 29 == chkPS )
|
: chkPS, L4 @ BCALL, ; ( chkPS, B305 )
|
||||||
|
|
||||||
: CODE ( same as CREATE, but with native word )
|
: CODE ( same as CREATE, but with native word )
|
||||||
(entry)
|
(entry)
|
||||||
|
6
blk/283
6
blk/283
@ -1,11 +1,12 @@
|
|||||||
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 ) 0 JPnn, ( 0b, cellWord )
|
NOP, ( 0a, unused )
|
||||||
|
( 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, ( 1d, chkPS )
|
0 JPnn, ( 1a, next ) 0 JPnn, ( unused )
|
||||||
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 )
|
||||||
@ -13,4 +14,3 @@ 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 )
|
||||||
|
|
||||||
|
2
blk/297
2
blk/297
@ -1,4 +1,4 @@
|
|||||||
PC ORG @ 0x12 + ! ( pushRS )
|
L4 BSET PC ORG @ 0x12 + ! ( pushRS )
|
||||||
IX INCss,
|
IX INCss,
|
||||||
IX INCss,
|
IX INCss,
|
||||||
0 IX+ L LDIXYr,
|
0 IX+ L LDIXYr,
|
||||||
|
16
blk/299
16
blk/299
@ -1,16 +0,0 @@
|
|||||||
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
10
blk/300
@ -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? )
|
||||||
0x1d BCALL, ( chkPS )
|
( PS ) HL PS_ADDR LDddnn,
|
||||||
( check RS )
|
SP SUBHLss,
|
||||||
IX PUSHqq, HL POPqq,
|
JRC, L2 BWR ( abortUnderflow-B298 )
|
||||||
|
( 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
28
blk/302
@ -1,16 +1,16 @@
|
|||||||
L1 BSET PC ORG @ 0x0f + ! ( compiledWord )
|
PC ORG @ 0x2c + ! ( doesWord )
|
||||||
( 1. Push current IP to RS
|
( The word was spawned from a definition word that has a
|
||||||
2. Set new IP to the second atom of the list
|
DOES>. PFA+2 (right after the actual cell) is a link to the
|
||||||
3. Execute the first atom of the list. )
|
slot right after that DOES>. Therefore, what we need to do
|
||||||
IY PUSHqq, HL POPqq, ( <-- IP )
|
push the cell addr like a regular cell, then follow the
|
||||||
0x11 BCALL, ( 11 == pushRS )
|
linkfrom the PFA, and then continue as a regular
|
||||||
EXDEHL, ( HL points to PFA )
|
compiledWord. )
|
||||||
( While we inc, dereference into DE for execute call later. )
|
DE PUSHqq, ( like a regular cell )
|
||||||
LDDE(HL),
|
EXDEHL,
|
||||||
HL INCss,
|
HL INCss,
|
||||||
HL PUSHqq, IY POPqq, ( --> IP )
|
HL INCss,
|
||||||
JR, L3 BWR ( execute-B301 )
|
E (HL) LDrr,
|
||||||
|
HL INCss,
|
||||||
|
D (HL) LDrr,
|
||||||
|
( continue to compiledWord )
|
||||||
|
|
||||||
|
24
blk/303
24
blk/303
@ -1,15 +1,15 @@
|
|||||||
PC ORG @ 0x0c + ! ( cellWord )
|
PC ORG @ 0x0f + ! ( compiledWord )
|
||||||
( Pushes PFA directly )
|
( 1. Push current IP to RS
|
||||||
DE PUSHqq,
|
2. Set new IP to the second atom of the list
|
||||||
JPNEXT,
|
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 )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
16
blk/304
16
blk/304
@ -1,16 +0,0 @@
|
|||||||
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
24
blk/305
@ -1,15 +1,15 @@
|
|||||||
( Core words )
|
L4 BSET ( chkPS )
|
||||||
( KEY and EMIT are not defined here. There're
|
( Note that you only need to call this in words that push
|
||||||
expected to be defined in platform-specific code. )
|
back to PSP. If they don't, calling chkPS is redundant with
|
||||||
|
check in next )
|
||||||
|
EXX,
|
||||||
CODE EXECUTE
|
( We have the return address for this very call on the stack
|
||||||
DE POPqq,
|
and protected registers. 2 - is to compensate that. )
|
||||||
chkPS,
|
HL PS_ADDR 2 - LDddnn,
|
||||||
JR, L3 BWR ( execute-B301 )
|
SP SUBHLss,
|
||||||
|
EXX,
|
||||||
|
CNC RETcc, ( PS_ADDR >= SP? good )
|
||||||
|
JR, L2 BWR ( abortUnderflow-B298 )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
22
blk/306
22
blk/306
@ -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 )
|
HL POPqq, ( C ) DE POPqq, ( B ) BC POPqq, ( A )
|
||||||
DE POPqq, ( B )
|
|
||||||
BC POPqq, ( A )
|
|
||||||
chkPS,
|
chkPS,
|
||||||
DE PUSHqq, ( B )
|
DE PUSHqq, ( B ) HL PUSHqq, ( C ) BC PUSHqq, ( A )
|
||||||
HL PUSHqq, ( C )
|
|
||||||
BC PUSHqq, ( A )
|
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user