]> git.sur5r.net Git - cc65/blobdiff - libsrc/runtime/icmp.s
Adjusted include directive for local header.
[cc65] / libsrc / runtime / icmp.s
index acd5003ab19455c5f45597c7e13a9b0f81dfd540..70bcb76bda607c023aba4e22ce46f74106a3d40e 100644 (file)
@@ -1,44 +1,47 @@
-;\r
-; Piotr Fusik, 15.04.2002\r
-; originally by Ullrich von Bassewitz\r
-;\r
-; Integer compare function - used by the compare operators\r
-;\r
-\r
-       .export         tosicmp\r
-       .importzp       sp, sreg\r
-\r
-\r
-tosicmp:\r
-       sta     sreg\r
-       stx     sreg+1          ; Save ax\r
-\r
-       ldy     #$00\r
-       lda     (sp),y          ; Get low byte\r
-       tax\r
-       inc     sp              ; 5\r
-       bne     @L1             ; 3\r
-       inc     sp+1            ; (5)\r
-@L1:\r
-       lda     (sp),y          ; Get high byte\r
-       inc     sp              ; 5\r
-       bne     @L2             ; 3\r
-       inc     sp+1            ; (5)\r
-\r
-; Do the compare.\r
-\r
-@L2:   sec\r
-       sbc     sreg+1          ; Compare high byte\r
-       bne     @L4\r
-       cpx     sreg            ; Compare low byte\r
-       beq     @L3\r
-       adc     #$FF            ; If the C flag is set then clear the N flag\r
-       ora     #$01            ; else set the N flag\r
-@L3:   rts\r
-\r
-@L4:   bvc     @L3\r
-       eor     #$FF            ; Fix the N flag if overflow\r
-       ora     #$01            ; Clear the Z flag\r
-       rts\r
-\r
-\r
+;
+; Piotr Fusik, 15.04.2002
+; originally by Ullrich von Bassewitz
+;
+; Integer compare function - used by the compare operators
+;
+
+       .export         tosicmp, tosicmp0
+       .importzp       sp, sreg
+
+
+tosicmp0:
+        ldx     #$00
+
+tosicmp:
+       sta     sreg
+       stx     sreg+1          ; Save ax
+
+       ldy     #$00
+       lda     (sp),y          ; Get low byte
+       tax
+       inc     sp              ; 5
+       bne     @L1             ; 3
+       inc     sp+1            ; (5)
+@L1:
+       lda     (sp),y          ; Get high byte
+       inc     sp              ; 5
+       bne     @L2             ; 3
+       inc     sp+1            ; (5)
+
+; Do the compare.
+
+@L2:   sec
+       sbc     sreg+1          ; Compare high byte
+       bne     @L4
+       cpx     sreg            ; Compare low byte
+       beq     @L3
+       adc     #$FF            ; If the C flag is set then clear the N flag
+       ora     #$01            ; else set the N flag
+@L3:   rts
+
+@L4:   bvc     @L3
+       eor     #$FF            ; Fix the N flag if overflow
+       ora     #$01            ; Clear the Z flag
+       rts
+
+