10000 is 0x2710
So I defined AARGB1 as 0x27
AARGB0 as 0x10
I modified the 24 bit by 16 bit division math subroutine to behave as 16bit by 8bit division subroutine as follows
but it didn't work
LOOP501:
RLF AARGB1, F ;and shift in next bit of result
RLF AARGB0, F
RLF REMB0, F
RLF count301, F ;save carry in counter
MOVF count209, W
BTFSS CARRY
INCFSZ count209, W
SUBWF REMB0, W SKPNC ;if no borrow
BSF count301, 0 ;set bit 0 of counter (saved carry)
BTFSC count301, 0 ;if no borrow
GOTO UOK46LL ;jump
MOVF REMB0, W ;read high byte of remainder to W
;to not change it by next instruction
UOK46LL
MOVWF REMB0 ;store high byte of remainder
bcf CARRY ;copy bit 0 to carry
RRF count301, F ;and restore counter
DECFSZ count301, f ;decrement counter
GOTO LOOP501 ;and repeat loop if not zero
RLF AARGB1, F
RLF AARGB0, F
RETURN
So I defined AARGB1 as 0x27
AARGB0 as 0x10
I modified the 24 bit by 16 bit division math subroutine to behave as 16bit by 8bit division subroutine as follows
but it didn't work
LOOP501:
RLF AARGB1, F ;and shift in next bit of result
RLF AARGB0, F
RLF REMB0, F
RLF count301, F ;save carry in counter
MOVF count209, W
BTFSS CARRY
INCFSZ count209, W
SUBWF REMB0, W SKPNC ;if no borrow
BSF count301, 0 ;set bit 0 of counter (saved carry)
BTFSC count301, 0 ;if no borrow
GOTO UOK46LL ;jump
MOVF REMB0, W ;read high byte of remainder to W
;to not change it by next instruction
UOK46LL
MOVWF REMB0 ;store high byte of remainder
bcf CARRY ;copy bit 0 to carry
RRF count301, F ;and restore counter
DECFSZ count301, f ;decrement counter
GOTO LOOP501 ;and repeat loop if not zero
RLF AARGB1, F
RLF AARGB0, F
RETURN