]> git.sur5r.net Git - cc65/blobdiff - libsrc/runtime/tosint.s
Fixed a bug
[cc65] / libsrc / runtime / tosint.s
index aab0dded3ddf856363ff9884bd93b94c7ab84daa..7bbab986e57334861229fce05eb0421900724197 100644 (file)
 
 ; 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
+.ifpc02
+       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