1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
movlw h'C8'
movwf val1+1
clrf val1
movlw h'64'
movwf val2+1
clrf val2
rcall div16
div16
clrf reste ; division 16 bits
clrf reste+1 ; val1 = val1 / val2 ( reste )
movlw 16
movwf count
div161
rlcf val1+1,f
rlcf val1,f
rlcf reste+1,f
rlcf reste,f
movf val2,w
subwf reste,W
btfss STATUS,Z
goto div162
movf val2+1,W
subwf reste+1,W
div162
btfss STATUS,C
goto div163
movf val2+1,W
subwf reste+1,f
movf val2,W
btfss STATUS,C
incfsz val2,f
subwf reste,f
div163
rlcf result+1,f
rlcf result,f
DECFSZ count,f
goto div161
fin16
movf result,w
movwf val1
movf result+1,w
movwf val1+1
return |
Partager