1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 19:38:05 +11:00
collapseos/blk/076
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

12 lines
506 B
Plaintext

Stack underflow and overflow: In each native word involving
PSP popping, we check whether the stack is big enough. If it's
not we go in "uflw" (underflow) error condition, then abort.
We don't check RSP for underflow because the cost of the check
is significant and its usefulness is dubious: if RSP isn't
tightly in control, we're screwed anyways, and that, well
before we reach underflow.
Overflow condition happen when RSP and PSP meet somewhere in
the middle. That check is made at each "next" call.