1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-10 19:29:45 +00:00

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 03:55:40 +02:00
.import popptr1, udiv16
.importzp sreg, ptr4
tosumoda0:
ldx #0
tosumodax:
sta ptr4
stx ptr4+1 ; Save right operand
2018-05-24 03:55:40 +02:00
jsr popptr1 ; Get right operand
; Do the division
jsr udiv16
2018-05-24 03:55:40 +02:00
; Result is in ptr1, remainder in sreg
2018-05-24 03:55:40 +02:00
lda sreg
ldx sreg+1
rts
2022-04-17 16:06:22 +02:00