Divide 24 bit int by 15 bit int to 24 bit int
by Nikolai
Golovchenko
FXD2415U:
clr REMB0
clr REMB1
mov W, #24
mov LOOPCOUNT, W
LOOPU2415
mov W, <<ACCB0 ;left shift of accb0's msb to reminder
rl REMB1
rl REMB0
mov W, BARGB1 ;REMB -= BARGB
sub REMB1, W
mov W, BARGB0
sb C
movsz W, ++BARGB0
sub REMB0, W
snb C
jmp UOK45LL ;if no borrow
mov W, BARGB1 ;REMB += BARGB
add REMB1, W
mov W, BARGB0
snb C
movsz W, ++BARGB0
add REMB0, W
clrb C
UOK45LL
rl AARGB2
rl AARGB1
rl AARGB0
decsz LOOPCOUNT
jmp LOOPU2415
ret