]> git.sur5r.net Git - cc65/blob - libsrc/runtime/lsub.s
This commit was generated by cvs2svn to compensate for changes in r2,
[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, tmp1, tmp2
13
14 tossubeax:
15         ldy     #0
16         sec
17         sta     tmp1
18         lda     (sp),y
19         sbc     tmp1            ; byte 0
20         sta     tmp2            ; use as temp storage
21         iny
22         stx     tmp1
23         lda     (sp),y
24         sbc     tmp1            ; byte 1
25         tax
26         iny
27         lda     (sp),y
28         sbc     sreg            ; byte 2
29         sta     sreg
30         iny
31         lda     (sp),y
32         sbc     sreg+1          ; byte 3
33         sta     sreg+1
34         lda     tmp2            ; load byte 0
35         jmp     addysp1         ; drop TOS
36