mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-24 14:28:06 +11:00
z80: optimize chkPS
Inline it in next and make chkPS, call a newly reserved label for it directly, removing a layer of indirection. This frees a spot in the stable ABI.
This commit is contained in:
parent
31095bc04d
commit
40f92b9bab
2
blk/243
2
blk/243
@ -5,7 +5,7 @@
|
||||
|
||||
: JPNEXT, 26 BJP, ; ( 26 == next )
|
||||
|
||||
: chkPS, 29 BCALL, ; ( 29 == chkPS )
|
||||
: chkPS, L4 @ BCALL, ; ( chkPS, B305 )
|
||||
|
||||
: CODE ( same as CREATE, but with native word )
|
||||
(entry)
|
||||
|
2
blk/283
2
blk/283
@ -5,7 +5,7 @@ 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, ( 1d, chkPS )
|
||||
0 JPnn, ( 1a, next ) 0 JPnn, ( unused )
|
||||
NOP, NOP, ( 20, numberWord ) NOP, NOP, ( 22, litWord )
|
||||
NOP, NOP, ( 24, addrWord ) NOP, NOP, ( 26, unused )
|
||||
0 JPnn, ( RST 28 )
|
||||
|
16
blk/299
16
blk/299
@ -1,16 +0,0 @@
|
||||
L1 BSET 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
|
||||
it by 2 before jumping. )
|
||||
( Before we continue: are stacks within bounds? )
|
||||
L1 @ ( chkPS ) BCALL,
|
||||
( check RS )
|
||||
IX PUSHqq, HL POPqq,
|
||||
( PS ) HL PS_ADDR LDddnn,
|
||||
SP SUBHLss,
|
||||
JRC, L2 BWR ( abortUnderflow-B298 )
|
||||
( 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 )
|
||||
|
24
blk/305
24
blk/305
@ -1,15 +1,15 @@
|
||||
( 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 )
|
||||
|
||||
|
||||
|
||||
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 )
|
||||
|
||||
|
||||
|
||||
|
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 )
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user