rmu.s 377 B

123456789101112131415161718192021222324252627
  1. .define Rmu2
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! This subroutine returns the remainder of an twobyte unsigned
  8. ! integer division.
  9. Rmu2:
  10. stx ARTH
  11. sta ARTH+1 ! first operand
  12. jsr Pop
  13. stx ARTH+2
  14. sta ARTH+3 ! second operand
  15. ldy #1
  16. sty UNSIGN ! it unsigned
  17. jsr Duv
  18. lsr ARTH+5
  19. ror ARTH+4 ! shift result one time
  20. ldx ARTH+4
  21. lda ARTH+5
  22. rts