2000-10-26 20:43:54 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 26.10.2000
|
|
|
|
;
|
|
|
|
; CC65 runtime: Push value in a onto the stack
|
|
|
|
;
|
|
|
|
|
2001-10-01 22:21:16 +00:00
|
|
|
.export pusha0sp, pushaysp, pusha
|
2000-10-26 20:43:54 +00:00
|
|
|
.importzp sp
|
|
|
|
|
2003-10-10 17:52:12 +00:00
|
|
|
.macpack cpu
|
|
|
|
|
2000-10-26 20:43:54 +00:00
|
|
|
; Beware: The optimizer knows about this function!
|
|
|
|
|
2001-10-01 22:21:16 +00:00
|
|
|
pusha0sp:
|
|
|
|
ldy #$00
|
2000-10-26 20:43:54 +00:00
|
|
|
pushaysp:
|
|
|
|
lda (sp),y
|
2003-04-12 20:50:58 +00:00
|
|
|
pusha: ldy sp ; (3)
|
|
|
|
beq @L1 ; (6)
|
|
|
|
dec sp ; (11)
|
2003-10-10 17:52:12 +00:00
|
|
|
.if (.cpu .bitand CPU_ISET_65SC02)
|
2000-11-28 13:33:08 +00:00
|
|
|
sta (sp)
|
|
|
|
.else
|
2003-04-12 20:50:58 +00:00
|
|
|
ldy #0 ; (13)
|
|
|
|
sta (sp),y ; (19)
|
2000-11-28 13:33:08 +00:00
|
|
|
.endif
|
2003-04-12 20:50:58 +00:00
|
|
|
rts ; (25)
|
2000-10-26 20:43:54 +00:00
|
|
|
|
2003-04-12 20:50:58 +00:00
|
|
|
@L1: dec sp+1 ; (11)
|
|
|
|
dec sp ; (16)
|
|
|
|
sta (sp),y ; (22)
|
|
|
|
rts ; (28)
|
2000-10-26 20:43:54 +00:00
|
|
|
|