2000-10-25 07:06:55 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 25.10.2000
|
|
|
|
;
|
|
|
|
; CC65 runtime: Convert tos from long to int
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export tosint
|
|
|
|
.import incsp2
|
|
|
|
.importzp sp
|
2000-10-25 07:06:55 +00:00
|
|
|
|
2003-10-10 17:52:12 +00:00
|
|
|
.macpack cpu
|
|
|
|
|
2000-10-25 07:06:55 +00:00
|
|
|
; Convert TOS from long to int by cutting of the high 16bit
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc tosint
|
2000-11-27 22:59:03 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
pha
|
2003-10-10 17:52:12 +00:00
|
|
|
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
2013-05-09 11:56:54 +00:00
|
|
|
lda (sp)
|
2000-11-27 22:59:03 +00:00
|
|
|
.else
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #0
|
|
|
|
lda (sp),y ; sp+1
|
2000-11-27 22:59:03 +00:00
|
|
|
.endif
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #2
|
|
|
|
sta (sp),y
|
|
|
|
dey
|
|
|
|
lda (sp),y
|
|
|
|
ldy #3
|
|
|
|
sta (sp),y
|
|
|
|
pla
|
|
|
|
jmp incsp2 ; Drop 16 bit
|
2000-10-25 07:06:55 +00:00
|
|
|
|
2000-11-27 22:59:03 +00:00
|
|
|
.endproc
|