]> git.sur5r.net Git - cc65/blob - libsrc/runtime/absvaludiv.s
59c2914b10791b9cd4364dbeae1b691832f99219
[cc65] / libsrc / runtime / absvaludiv.s
1 ;
2 ; Christian Krueger, 23-May-2018
3 ;
4 ; CC65 runtime: helper call for mod/div with signed ints
5 ;
6 ; When negating values, we will ignore the possibility here, that one of the
7 ; values is $8000, in which case the negate will fail.
8
9         .export         absvaludiv16
10         .import         _abs, popax, udiv16
11         .importzp       ptr1, ptr4
12
13
14 absvaludiv16:
15         jsr     _abs
16         sta     ptr4
17         stx     ptr4+1          ; Save right absolute operand      
18         jsr     popax
19         jsr     _abs
20         sta     ptr1
21         stx     ptr1+1          ; Save left absolute operand  
22         jmp     udiv16