]> git.sur5r.net Git - cc65/blobdiff - libsrc/runtime/tosint.s
no TGI_ERR_NO_MEM or TGI_ERR_NO_IOCB anymore: replaced by TGI_ERR_NO_RES
[cc65] / libsrc / runtime / tosint.s
index aab0dded3ddf856363ff9884bd93b94c7ab84daa..d29fa2e8b71752222a4dc3487db545f3dd77ed92 100644 (file)
@@ -8,17 +8,26 @@
        .import         incsp2
        .importzp       sp
 
+        .macpack        cpu
+
 ; Convert TOS from long to int by cutting of the high 16bit
 
-tosint:        pha
-       ldy     #0
-       lda     (sp),y          ; sp+1
-       ldy     #2
-       sta     (sp),y
-       ldy     #1
-       lda     (sp),y
-       ldy     #3
-       sta     (sp),y
+.proc  tosint
+
+       pha
+.if (.cpu .bitand ::CPU_ISET_65SC02)
+       lda     (sp)
+.else
+       ldy     #0
+       lda     (sp),y          ; sp+1
+.endif
+       ldy     #2
+       sta     (sp),y
+       dey
+       lda     (sp),y
+       ldy     #3
+       sta     (sp),y
        pla
                jmp     incsp2          ; Drop 16 bit
 
+.endproc