1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 19:38:05 +11:00
collapseos/blk/286
Virgil Dupras d1de99d8c9 z80: implement stack overflow error condition
Also, remove underflow checks from next: it's taxing and useless
because underflow check already takes place in each relevant native
word.
2020-08-08 08:08:05 -04:00

16 lines
575 B
Plaintext

lblnext BSET PC ORG @ 0x1b + ! ( next )
( This routine is jumped to at the end of every word. In it,
we jump to current IP, but we also take care of increasing
it by 2 before jumping. )
( Before we continue: are we overflowing? )
IX PUSH, EX(SP)HL, ( do EX to count the IX push in SP )
SP SUBHLd, HL POP,
IFNC, ( SP <= IX? overflow )
SP PS_ADDR LDdn, IX RS_ADDR LDdn,
DE BIN( @ 0x13 ( oflw ) + LDdd(n),
JR, L3 FWR ( execute, B287 )
THEN,
LDA(BC), E A LDrr, BC INCd,
LDA(BC), D A LDrr, BC INCd,
( continue to execute )