Add stack underflow detection to popByte in calculator.asm

This commit is contained in:
Juhani Krekelä 2022-08-18 14:51:47 +03:00
parent 8526919479
commit e8102339d7
1 changed files with 7 additions and 0 deletions

View File

@ -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