1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-09 04:08:11 +00:00
cc65/libsrc/runtime/umod.s
2018-05-24 03:55:40 +02:00

29 lines
535 B
ArmAsm

;
; Ullrich von Bassewitz, 07.08.1998
;
; CC65 runtime: modulo operation for unsigned ints
;
.export tosumoda0, tosumodax
.import popptr1, udiv16
.importzp sreg, ptr4
tosumoda0:
ldx #0
tosumodax:
sta ptr4
stx ptr4+1 ; Save right operand
jsr popptr1 ; Get right operand
; Do the division
jsr udiv16
; Result is in ptr1, remainder in sreg
lda sreg
ldx sreg+1
rts