]> git.sur5r.net Git - cc65/blob - libsrc/runtime/mulax9.s
Merge pull request #656 from Compyx/master
[cc65] / libsrc / runtime / mulax9.s
1 ;
2 ; Piotr Fusik, 24.10.2003
3 ; originally by Ullrich von Bassewitz
4 ;
5 ; CC65 runtime: Multiply the primary register by 9
6 ;
7 ; Don't touch the Y-register here, the optimizer relies on it!
8
9         .export         mulax9
10         .importzp       ptr1
11
12 .proc   mulax9
13
14         sta     ptr1
15         stx     ptr1+1
16         asl     a
17         rol     ptr1+1                  ; * 2
18         asl     a
19         rol     ptr1+1                  ; * 4
20         asl     a
21         rol     ptr1+1                  ; * 8
22         clc
23         adc     ptr1                    ; * (8+1)
24         pha
25         txa
26         adc     ptr1+1
27         tax
28         pla
29         rts
30
31 .endproc
32
33