This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://svn.cc65.org/cc65/trunk@3 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
48
libsrc/common/stkcheck.s
Normal file
48
libsrc/common/stkcheck.s
Normal file
@@ -0,0 +1,48 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 18.08.1998
|
||||
;
|
||||
; Stack checker
|
||||
;
|
||||
|
||||
|
||||
.export _stkcheck, __stksafety
|
||||
.import pushax, exit
|
||||
.import __hend
|
||||
.importzp sp
|
||||
|
||||
.data
|
||||
__stksafety:
|
||||
.word 64 ;
|
||||
|
||||
.code
|
||||
_stkcheck:
|
||||
clc
|
||||
lda __hend
|
||||
adc __stksafety
|
||||
tax ; Remember low byte
|
||||
lda __hend+1
|
||||
adc __stksafety+1
|
||||
|
||||
cmp sp+1
|
||||
bcc Ok
|
||||
bne L1
|
||||
cpx sp
|
||||
bcc Ok
|
||||
|
||||
; Stack overflow
|
||||
|
||||
L1: inc sp+1 ; Create 256 bytes of space
|
||||
ldx #0
|
||||
lda #4
|
||||
jsr pushax
|
||||
jmp exit
|
||||
|
||||
; All is well
|
||||
|
||||
Ok: rts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user