2000-10-25 19:53:22 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 25.10.2000
|
|
|
|
;
|
|
|
|
; CC65 runtime: Increment the stackpointer by 2. For performance reasons,
|
2013-05-09 11:56:54 +00:00
|
|
|
; this modules does also contain the popax function.
|
2000-10-25 19:53:22 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export popax, incsp2
|
|
|
|
.importzp sp
|
2000-10-25 19:53:22 +00:00
|
|
|
|
2003-10-10 17:52:12 +00:00
|
|
|
.macpack cpu
|
|
|
|
|
2000-10-25 19:53:22 +00:00
|
|
|
; Pop a/x from stack. This function will run directly into incsp2
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc popax
|
2000-10-25 19:53:22 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #1
|
|
|
|
lda (sp),y ; get hi byte
|
|
|
|
tax ; into x
|
2003-10-10 17:52:12 +00:00
|
|
|
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
2013-05-09 11:56:54 +00:00
|
|
|
lda (sp) ; get lo byte
|
2000-11-27 23:37:53 +00:00
|
|
|
.else
|
2013-05-09 11:56:54 +00:00
|
|
|
dey
|
|
|
|
lda (sp),y ; get lo byte
|
2000-11-27 23:37:53 +00:00
|
|
|
.endif
|
2000-10-25 19:53:22 +00:00
|
|
|
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc incsp2
|
2000-10-25 19:53:22 +00:00
|
|
|
|
2003-10-08 21:09:24 +00:00
|
|
|
inc sp ; 5
|
|
|
|
beq @L1 ; 2
|
|
|
|
inc sp ; 5
|
|
|
|
beq @L2 ; 2
|
|
|
|
rts
|
|
|
|
|
|
|
|
@L1: inc sp ; 5
|
|
|
|
@L2: inc sp+1 ; 5
|
|
|
|
rts
|
2000-10-25 19:53:22 +00:00
|
|
|
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|