]> git.sur5r.net Git - cc65/blob - libsrc/runtime/lcmp.s
This commit was generated by cvs2svn to compensate for changes in r2,
[cc65] / libsrc / runtime / lcmp.s
1 ;
2 ; Ullrich von Bassewitz, 10.12.1998
3 ;
4 ; Long int compare function - used by the compare operators
5 ;
6
7         .export         lcmp
8         .import         incsp4
9         .importzp       sp, sreg, ptr1
10
11
12 lcmp:   sta     ptr1
13         stx     ptr1+1          ; EAX now in sreg:ptr1
14
15         ldy     #$03
16         lda     (sp),y
17         cmp     sreg+1
18         bne     L4
19
20         dey
21         lda     (sp),y
22         cmp     sreg
23         bne     L1
24
25         dey
26         lda     (sp),y
27         cmp     ptr1+1
28         bne     L1
29
30         dey
31         lda     (sp),y
32         cmp     ptr1
33
34 L1:     php                     ; Save flags
35         jsr     incsp4          ; Drop TOS
36         plp                     ; Restore the flags
37         beq     L2
38         bcs     L3
39         lda     #$FF            ; Set the N flag
40 L2:     rts
41
42 L3:     lda     #$01            ; Clear the N flag
43         rts
44
45 L4:     php                     ; Save flags
46         jsr     incsp4          ; Drop TOS
47         plp                     ; Restore flags
48         rts
49
50