]> git.sur5r.net Git - cc65/blob - libsrc/runtime/axlong.s
The upper 16 bit differ between signed and unsigned multiplication, so while
[cc65] / libsrc / runtime / axlong.s
1 ;
2 ; Ullrich von Bassewitz, 25.10.2000
3 ;
4 ; CC65 runtime: Convert int in ax into a long
5 ;
6
7         .export         axulong, axlong
8         .importzp       sreg
9
10 ; Convert AX from int to long in EAX
11
12 axulong:
13         ldy     #0
14         sty     sreg
15         sty     sreg+1
16         rts
17
18 axlong: cpx     #$80            ; Positive?
19         bcc     axulong         ; Yes, handle like unsigned type
20         ldy     #$ff
21         sty     sreg
22         sty     sreg+1
23         rts
24
25
26