1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-15 02:29:32 +00:00
cc65/libsrc/runtime/absvaludiv.s
2018-05-24 03:55:40 +02:00

23 lines
617 B
ArmAsm

;
; Christian Krueger, 23-May-2018
;
; CC65 runtime: helper call for mod/div with signed ints
;
; When negating values, we will ignore the possibility here, that one of the
; values is $8000, in which case the negate will fail.
.export absvaludiv
.import _abs, popax, udiv16
.importzp ptr1, ptr4
absvaludiv:
jsr _abs
sta ptr4
stx ptr4+1 ; Save right absolute operand
jsr popax
jsr _abs
sta ptr1
stx ptr1+1 ; Save left absolute operand
jmp udiv16