DUDIV MOVLW .16 ;循环16次
MOVWF CNT
CLRF TEMP2
CLRF TEMP1 ;TEMP2:TEMP1得到余数
BCF STATUS,C
RLF SOU,F
RLF SOUH,F
RLF TEMP1,F
RLF TEMP2,F
LOOP79 MOVF RLTH,W
SUBWF TEMP2,W ;检测是否余数大于除数
BTFSS STATUS,Z
GOTO NOCHK
MOVF RLT,W
SUBWF TEMP1,W ;如果高位相等则检测低位
NOCHK BTFSS STATUS,C
GOTO NOGO
MOVF RLT,W ;余数减除数
SUBWF TEMP1,F
BTFSS STATUS,C
DECF TEMP2,F
MOVF RLTH,W
SUBWF TEMP2,F
BSF STATUS,C ;结果中移入1
NOGO RLF SOU,F
RLF SOUH,F
RLF TEMP1,F
RLF TEMP2,F
DECFSZ CNT,F
GOTO LOOP79