From 735971700008df51c2af16eddb99883c214d0bb9 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 23 Aug 2020 08:38:04 -0400 Subject: [PATCH] z80: add missing chkPS, calls chkPS, used to be only for words that pushed back to PS, but I've recently removed underflow checks from next and I forgot to add missing chkPS, calls that go with this change. --- blk/290 | 14 +++++++------- blk/308 | 2 +- blk/312 | 2 +- blk/322 | 6 ++---- blk/323 | 6 ++---- blk/324 | 6 ++---- blk/325 | 13 +++++++------ blk/326 | 5 +---- 8 files changed, 23 insertions(+), 31 deletions(-) diff --git a/blk/290 b/blk/290 index 5380427..2f66532 100644 --- a/blk/290 +++ b/blk/290 @@ -1,10 +1,7 @@ -lbluflw BSET ( abortUnderflow ) - DE BIN( @ 0x06 ( uflw ) + LDd(i), - JR, lblexec BWR lblchkPS 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 ) + ( thread carefully in there: sometimes, we're in the + middle of a EXX to protect BC. BC must never be touched + here. ) EXX, ( We have the return address for this very call on the stack and protected registers. 2- is to compensate that. ) @@ -12,4 +9,7 @@ lblchkPS BSET ( chkPS ) SP SUBHLd, EXX, CNC RETc, ( PS_ADDR >= SP? good ) - JR, lbluflw BWR + ( continue to uflw ) +lbluflw BSET ( abortUnderflow ) + DE BIN( @ 0x06 ( uflw ) + LDd(i), + JR, lblexec BWR diff --git a/blk/308 b/blk/308 index 8c69522..b75639a 100644 --- a/blk/308 +++ b/blk/308 @@ -12,5 +12,5 @@ CODE ?DUP HLZ, IFNZ, HL PUSH, THEN, ;CODE CODE DROP ( a -- ) - HL POP, + HL POP, chkPS, ;CODE diff --git a/blk/312 b/blk/312 index 180c760..9be0e6f 100644 --- a/blk/312 +++ b/blk/312 @@ -1,5 +1,5 @@ CODE 2DROP ( a b -- ) - HL POP, HL POP, + HL POP, HL POP, chkPS, ;CODE CODE 2DUP ( a b -- a b a b ) diff --git a/blk/322 b/blk/322 index b1b28fc..d67257c 100644 --- a/blk/322 +++ b/blk/322 @@ -1,13 +1,11 @@ CODE ! - HL POP, - DE POP, + HL POP, DE POP, chkPS, (HL) E LDrr, HL INCd, (HL) D LDrr, ;CODE CODE @ - HL POP, - chkPS, + HL POP, chkPS, E (HL) LDrr, HL INCd, D (HL) LDrr, diff --git a/blk/323 b/blk/323 index 55c4dbb..7090be3 100644 --- a/blk/323 +++ b/blk/323 @@ -1,12 +1,10 @@ CODE C! - HL POP, - DE POP, + HL POP, DE POP, chkPS, (HL) E LDrr, ;CODE CODE C@ - HL POP, - chkPS, + HL POP, chkPS, L (HL) LDrr, H 0 LDri, HL PUSH, diff --git a/blk/324 b/blk/324 index 5c0eb54..c76b669 100644 --- a/blk/324 +++ b/blk/324 @@ -1,12 +1,10 @@ CODE PC! EXX, ( protect BC ) - BC POP, - HL POP, + BC POP, HL POP, chkPS, L OUT(C)r, EXX, ( unprotect BC ) ;CODE CODE PC@ EXX, ( protect BC ) - BC POP, - chkPS, + BC POP, chkPS, H 0 LDri, L INr(C), HL PUSH, diff --git a/blk/325 b/blk/325 index bd35998..5d661be 100644 --- a/blk/325 +++ b/blk/325 @@ -1,15 +1,16 @@ CODE I - L 0 IX+ LDrIXY, - H 1 IX+ LDrIXY, + L 0 IX+ LDrIXY, H 1 IX+ LDrIXY, HL PUSH, ;CODE CODE I' - L 2 IX- LDrIXY, - H 1 IX- LDrIXY, + L 2 IX- LDrIXY, H 1 IX- LDrIXY, HL PUSH, ;CODE CODE J - L 4 IX- LDrIXY, - H 3 IX- LDrIXY, + L 4 IX- LDrIXY, H 3 IX- LDrIXY, HL PUSH, ;CODE +CODE >R + HL POP, chkPS, + IX INCd, IX INCd, 0 IX+ L LDIXYr, 1 IX+ H LDIXYr, +;CODE diff --git a/blk/326 b/blk/326 index 7c380b5..dc5676f 100644 --- a/blk/326 +++ b/blk/326 @@ -1,11 +1,8 @@ -CODE >R - HL POP, IX INCd, IX INCd, 0 IX+ L LDIXYr, 1 IX+ H LDIXYr, -;CODE CODE R> L 0 IX+ LDrIXY, H 1 IX+ LDrIXY, IX DECd, IX DECd, HL PUSH, ;CODE CODE 2>R PC ORG @ 0x35 + ! ( stable ABI JP ) - DE POP, HL POP, + DE POP, HL POP, chkPS, IX INCd, IX INCd, 0 IX+ L LDIXYr, 1 IX+ H LDIXYr, IX INCd, IX INCd, 0 IX+ E LDIXYr, 1 IX+ D LDIXYr, ;CODE