]> git.sur5r.net Git - cc65/blob - libsrc/runtime/add.s
Added dump of the file list
[cc65] / libsrc / runtime / add.s
1 ;
2 ; Ullrich von Bassewitz, 05.08.1998
3 ;
4 ; CC65 runtime: add ints
5 ;
6
7 ; Make this as fast as possible, even if it needs more space since it's
8 ; called a lot!
9
10         .export         tosadda0, tosaddax
11         .importzp       sp
12
13 tosadda0:
14         ldx     #0
15 tosaddax:
16         ldy     #0
17         clc
18         adc     (sp),y          ; lo byte
19         pha                     ; save it
20         txa
21         iny
22         adc     (sp),y          ; hi byte
23         tax
24         clc
25         lda     sp
26         adc     #2
27         sta     sp
28         bcc     L1
29         inc     sp+1
30 L1:     pla                     ; Restore low byte
31         rts
32