Add stack underflow detection to popByte in calculator.asm
This commit is contained in:
parent
8526919479
commit
e8102339d7
|
@ -481,6 +481,13 @@ pushByte:
|
|||
popByte:
|
||||
load r0, SP+0
|
||||
load r1, SP+1
|
||||
|
||||
load r2, SPStart+0
|
||||
load r3, SPStart+1
|
||||
brneq r0, r2, popByteNoUnderflow
|
||||
breq r1, r3, error
|
||||
|
||||
popByteNoUnderflow:
|
||||
cleq r0, r0, decWord
|
||||
store SP+0, r0
|
||||
store SP+1, r1
|
||||
|
|
Loading…
Reference in New Issue