]> git.sur5r.net Git - cc65/blob - libsrc/runtime/lumod.s
Replaced whole bunch for Makefiles with a single generic Makefile.
[cc65] / libsrc / runtime / lumod.s
1 ;
2 ; Ullrich von Bassewitz, 27.09.1998
3 ;
4 ; CC65 runtime: modulo operation for long unsigned ints
5 ;
6
7         .export         tosumod0ax, tosumodeax
8         .import         getlop, udiv32
9         .importzp       sreg, tmp3, tmp4, ptr2
10
11 tosumod0ax:                          
12         ldy     #$00
13         sty     sreg
14         sty     sreg+1
15
16 tosumodeax:
17         jsr     getlop          ; Get the paramameters
18         jsr     udiv32          ; Do the division
19         lda     tmp3            ; Remainder is in ptr2:tmp3:tmp4
20         sta     sreg
21         lda     tmp4
22         sta     sreg+1
23         lda     ptr2
24         ldx     ptr2+1
25         rts
26