1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 02:29:52 +00:00
cc65/libsrc/runtime/umod.s

29 lines
524 B
ArmAsm
Raw Normal View History

;
; Ullrich von Bassewitz, 07.08.1998
;
; CC65 runtime: modulo operation for unsigned ints
;
.export tosumoda0, tosumodax
2018-05-24 01:55:40 +00:00
.import popptr1, udiv16
.importzp sreg, ptr4
tosumoda0:
ldx #0
tosumodax:
sta ptr4
stx ptr4+1 ; Save right operand
2018-05-24 01:55:40 +00:00
jsr popptr1 ; Get right operand
; Do the division
jsr udiv16
2018-05-24 01:55:40 +00:00
; Result is in ptr1, remainder in sreg
2018-05-24 01:55:40 +00:00
lda sreg
ldx sreg+1
rts
2022-04-17 14:06:22 +00:00