mirror of
https://github.com/Russell-S-Harper/COMMON.git
synced 2024-11-28 05:51:09 +00:00
Adding protection for PSH and POP.
This commit is contained in:
parent
a3069872b1
commit
fe7bfb12e6
@ -118,7 +118,9 @@ _1 RTS ; done
|
|||||||
|
|
||||||
_POP .( ; POP r 2r Rr <- RS - pop from stack
|
_POP .( ; POP r 2r Rr <- RS - pop from stack
|
||||||
LDY _RSI ; get register stack index
|
LDY _RSI ; get register stack index
|
||||||
DEY ; transfer four bytes over
|
BNE _1 ; all good, something can be popped off the stack
|
||||||
|
BRK ; next pop will cause a stack underflow, abort and call exception handler (TODO)
|
||||||
|
_1 DEY ; transfer four bytes over
|
||||||
LDA _RS,Y
|
LDA _RS,Y
|
||||||
STA _R0+3,X
|
STA _R0+3,X
|
||||||
DEY
|
DEY
|
||||||
@ -136,7 +138,10 @@ _POP .( ; POP r 2r Rr <- RS - pop from stack
|
|||||||
|
|
||||||
_PSH .( ; PSH r 3r RS <- Rr - push onto stack
|
_PSH .( ; PSH r 3r RS <- Rr - push onto stack
|
||||||
LDY _RSI ; get register stack index
|
LDY _RSI ; get register stack index
|
||||||
LDA _R0,X ; transfer four bytes over
|
CPY #_RSS ; compare against limit
|
||||||
|
BCC _1 ; still room, all okay
|
||||||
|
BRK ; next push will cause a stack overflow, abort and call exception handler (TODO)
|
||||||
|
_1 LDA _R0,X ; transfer four bytes over
|
||||||
STA _RS,Y
|
STA _RS,Y
|
||||||
INY
|
INY
|
||||||
LDA _R0+1,X
|
LDA _R0+1,X
|
||||||
|
@ -89,11 +89,12 @@ _IDX = _ACC + 1 ; saved index X to restore
|
|||||||
_IDY = _IDX + 1 ; saved index Y to restore
|
_IDY = _IDX + 1 ; saved index Y to restore
|
||||||
_PS = _IDY + 1 ; saved processor status to restore
|
_PS = _IDY + 1 ; saved processor status to restore
|
||||||
|
|
||||||
; 256 bytes of page two
|
; 224 bytes of page two
|
||||||
_RS = $200 ; register stack
|
_RS = $200 ; register stack
|
||||||
|
_RSS = (FN_FX - _RS) ; register stack size
|
||||||
|
|
||||||
; 64 bytes of page three
|
; last 32 bytes of page two
|
||||||
FN_FX = $300 ; list of system and user functions
|
FN_FX = $2E0 ; list of system and user functions
|
||||||
|
|
||||||
; function constants
|
; function constants
|
||||||
_ESC_C = $00
|
_ESC_C = $00
|
||||||
|
Loading…
Reference in New Issue
Block a user