]> git.sur5r.net Git - cc65/blob - libsrc/runtime/lsub.s
Fixed a bug
[cc65] / libsrc / runtime / lsub.s
1 ;
2 ; Ullrich von Bassewitz, 05.08.1998
3 ;
4 ; CC65 runtime: long sub
5 ;
6
7 ;
8 ; EAX = TOS - EAX
9 ;
10         .export         tossubeax
11         .import         addysp1
12         .importzp       sp, sreg
13
14 tossubeax:
15         ldy     #0
16         sec
17         eor     #$FF
18         adc     (sp),y          ; byte 0
19         pha                     ; Save low byte
20         iny
21         txa
22         eor     #$FF
23         adc     (sp),y          ; byte 1
24         tax
25         iny
26         lda     (sp),y
27         sbc     sreg            ; byte 2
28         sta     sreg
29         iny
30         lda     (sp),y
31         sbc     sreg+1          ; byte 3
32         sta     sreg+1
33         pla                     ; Restore byte 0
34         jmp     addysp1         ; Drop TOS
35