29 lines
426 B
ArmAsm
29 lines
426 B
ArmAsm
.define Rmi4
|
|
|
|
! This subroutine returns the remainder of a fourbyte division.
|
|
|
|
|
|
Rmi4:
|
|
ldy #0
|
|
sty NBYTES ! for the sign of the result
|
|
ldy #0
|
|
sty UNSIGN ! it is signed arithmetic
|
|
jsr Div4
|
|
lsr ARTH+11
|
|
ror ARTH+10
|
|
ror ARTH+9
|
|
ror ARTH+8 ! result must be shifted one time
|
|
ldy NBYTES
|
|
beq 1f ! result is positive
|
|
lda #0
|
|
ldx #ARTH+8
|
|
jsr Ngi4
|
|
1: lda ARTH+11
|
|
ldx ARTH+10
|
|
jsr Push
|
|
lda ARTH+9
|
|
ldx ARTH+8
|
|
jmp Push
|
|
|
|
|