ack/mach/6500/libem/rmi.s

33 lines
548 B
ArmAsm
Raw Permalink Normal View History

1984-12-17 11:03:13 +00:00
.define Rmi2
1987-01-30 18:41:42 +00:00
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
1984-12-17 11:03:13 +00:00
! This subroutine returns the remainder of a twobyte signed division.
! The sign of the result is as specified in the emtest.
Rmi2:
ldy #0
sty NBYTES ! for the sign of the result
stx ARTH
sta ARTH+1 ! first operand
jsr Pop
stx ARTH+2
sta ARTH+3 ! second operand
ldy #0
sty UNSIGN ! its signed arithmetic
jsr Div
lsr ARTH+5
ror ARTH+4 ! result must be shifted one time
ldx ARTH+4
lda ARTH+5
ldy NBYTES
beq 1f ! result must be positive
jmp Ngi2
1: rts