mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-17 07:08:05 +11:00
Optimize chkPS
Use EXX instead of the stack for HL protection and remove all spurious uses of chkPS, I wanted to inline chkPS in next because of its "tight loop" status, but for reasons I don't understand, doing so breaks Collapse OS. Later...
This commit is contained in:
parent
4f2c2ab80a
commit
d041b91846
4
blk/285
4
blk/285
@ -1,11 +1,11 @@
|
|||||||
CODE (?br) ( 0x67 )
|
CODE (?br) ( 0x67 )
|
||||||
HL POPqq, chkPS,
|
HL POPqq,
|
||||||
HLZ,
|
HLZ,
|
||||||
JRZ, L2 BWR ( BR + 2. False, branch )
|
JRZ, L2 BWR ( BR + 2. False, branch )
|
||||||
L1 BSET ( loop will jump here )
|
L1 BSET ( loop will jump here )
|
||||||
( True, skip next 2 bytes and don't branch )
|
( True, skip next 2 bytes and don't branch )
|
||||||
IY INCss, IY INCss,
|
IY INCss, IY INCss,
|
||||||
JPNEXT,
|
JPNEXT, NOP, NOP, NOP,
|
||||||
CODE (loop) ( 0x77 )
|
CODE (loop) ( 0x77 )
|
||||||
0 IX+ INC(IXY+), IFZ, 1 IX+ INC(IXY+), THEN, ( I++ )
|
0 IX+ INC(IXY+), IFZ, 1 IX+ INC(IXY+), THEN, ( I++ )
|
||||||
( Jump if I <> I' )
|
( Jump if I <> I' )
|
||||||
|
8
blk/286
8
blk/286
@ -1,11 +1,11 @@
|
|||||||
CODE >R ( 0xa8 )
|
CODE >R ( 0xa8 )
|
||||||
HL POPqq, chkPS,
|
HL POPqq,
|
||||||
17 BCALL, ( 17 == pushRS )
|
17 BCALL, ( 17 == pushRS )
|
||||||
;CODE
|
;CODE NOP, NOP, NOP,
|
||||||
CODE 2>R ( 0xb9 )
|
CODE 2>R ( 0xb9 )
|
||||||
DE POPqq, HL POPqq, chkPS,
|
DE POPqq, HL POPqq,
|
||||||
17 BCALL, ( 17 == pushRS ) EXDEHL, 17 BCALL,
|
17 BCALL, ( 17 == pushRS ) EXDEHL, 17 BCALL,
|
||||||
;CODE
|
;CODE NOP, NOP, NOP,
|
||||||
CODE R> ( 0xce )
|
CODE R> ( 0xce )
|
||||||
20 BCALL, ( 20 == popRS )
|
20 BCALL, ( 20 == popRS )
|
||||||
HL PUSHqq,
|
HL PUSHqq,
|
||||||
|
11
blk/299
11
blk/299
@ -1,10 +1,13 @@
|
|||||||
PC ORG @ 0x1e + ! ( chkPS )
|
PC ORG @ 0x1e + ! ( chkPS )
|
||||||
HL PUSHqq,
|
( 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
|
( We have the return address for this very call on the stack
|
||||||
and protected registers. 4 - is to compensate that. )
|
and protected registers. 2 - is to compensate that. )
|
||||||
HL PS_ADDR 4 - LDddnn,
|
HL PS_ADDR 2 - LDddnn,
|
||||||
SP SUBHLss,
|
SP SUBHLss,
|
||||||
HL POPqq,
|
EXX,
|
||||||
CNC RETcc, ( PS_ADDR >= SP? good )
|
CNC RETcc, ( PS_ADDR >= SP? good )
|
||||||
JR, L2 BWR ( abortUnderflow-B298 )
|
JR, L2 BWR ( abortUnderflow-B298 )
|
||||||
|
|
||||||
|
1
blk/310
1
blk/310
@ -1,6 +1,5 @@
|
|||||||
CODE PICK
|
CODE PICK
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
chkPS,
|
|
||||||
( x2 )
|
( x2 )
|
||||||
L SLAr, H RLr,
|
L SLAr, H RLr,
|
||||||
SP ADDHLss,
|
SP ADDHLss,
|
||||||
|
1
blk/312
1
blk/312
@ -2,7 +2,6 @@
|
|||||||
CODE 2DROP
|
CODE 2DROP
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
chkPS,
|
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
( a b -- a b a b )
|
( a b -- a b a b )
|
||||||
|
1
blk/322
1
blk/322
@ -1,7 +1,6 @@
|
|||||||
CODE !
|
CODE !
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
DE POPqq,
|
DE POPqq,
|
||||||
chkPS,
|
|
||||||
(HL) E LDrr,
|
(HL) E LDrr,
|
||||||
HL INCss,
|
HL INCss,
|
||||||
(HL) D LDrr,
|
(HL) D LDrr,
|
||||||
|
1
blk/323
1
blk/323
@ -1,7 +1,6 @@
|
|||||||
CODE C!
|
CODE C!
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
DE POPqq,
|
DE POPqq,
|
||||||
chkPS,
|
|
||||||
(HL) E LDrr,
|
(HL) E LDrr,
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
|
1
blk/324
1
blk/324
@ -1,7 +1,6 @@
|
|||||||
CODE PC!
|
CODE PC!
|
||||||
BC POPqq,
|
BC POPqq,
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
chkPS,
|
|
||||||
L OUT(C)r,
|
L OUT(C)r,
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user