Compare commits

...

2 Commits

Author SHA1 Message Date
Virgil Dupras
d041b91846 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...
2020-05-22 23:12:03 -04:00
Virgil Dupras
4f2c2ab80a z80a: add a few ops 2020-05-22 22:23:24 -04:00
10 changed files with 15 additions and 15 deletions

View File

@ -1,8 +1,10 @@
: OP1 CREATE C, DOES> C@ A, ;
0xf3 OP1 DI, 0xfb OP1 EI,
0xeb OP1 EXDEHL, 0xd9 OP1 EXX,
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),
0x00 OP1 NOP, 0xc9 OP1 RET,
0x17 OP1 RLA, 0x07 OP1 RLCA,
0x1f OP1 RRA, 0x0f OP1 RRCA,

View File

@ -1,11 +1,11 @@
CODE (?br) ( 0x67 )
HL POPqq, chkPS,
HL POPqq,
HLZ,
JRZ, L2 BWR ( BR + 2. False, branch )
L1 BSET ( loop will jump here )
( True, skip next 2 bytes and don't branch )
IY INCss, IY INCss,
JPNEXT,
JPNEXT, NOP, NOP, NOP,
CODE (loop) ( 0x77 )
0 IX+ INC(IXY+), IFZ, 1 IX+ INC(IXY+), THEN, ( I++ )
( Jump if I <> I' )

View File

@ -1,11 +1,11 @@
CODE >R ( 0xa8 )
HL POPqq, chkPS,
HL POPqq,
17 BCALL, ( 17 == pushRS )
;CODE
;CODE NOP, NOP, NOP,
CODE 2>R ( 0xb9 )
DE POPqq, HL POPqq, chkPS,
DE POPqq, HL POPqq,
17 BCALL, ( 17 == pushRS ) EXDEHL, 17 BCALL,
;CODE
;CODE NOP, NOP, NOP,
CODE R> ( 0xce )
20 BCALL, ( 20 == popRS )
HL PUSHqq,

11
blk/299
View File

@ -1,10 +1,13 @@
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
and protected registers. 4 - is to compensate that. )
HL PS_ADDR 4 - LDddnn,
and protected registers. 2 - is to compensate that. )
HL PS_ADDR 2 - LDddnn,
SP SUBHLss,
HL POPqq,
EXX,
CNC RETcc, ( PS_ADDR >= SP? good )
JR, L2 BWR ( abortUnderflow-B298 )

View File

@ -1,6 +1,5 @@
CODE PICK
HL POPqq,
chkPS,
( x2 )
L SLAr, H RLr,
SP ADDHLss,

View File

@ -2,7 +2,6 @@
CODE 2DROP
HL POPqq,
HL POPqq,
chkPS,
;CODE
( a b -- a b a b )

View File

@ -1,7 +1,6 @@
CODE !
HL POPqq,
DE POPqq,
chkPS,
(HL) E LDrr,
HL INCss,
(HL) D LDrr,

View File

@ -1,7 +1,6 @@
CODE C!
HL POPqq,
DE POPqq,
chkPS,
(HL) E LDrr,
;CODE

View File

@ -1,7 +1,6 @@
CODE PC!
BC POPqq,
HL POPqq,
chkPS,
L OUT(C)r,
;CODE

Binary file not shown.