Untitled
unknown
plain_text
a year ago
1.1 kB
5
Indexable
#include"xc.inc"
GLOBAL _multi_signed
PSECT mytext,local,class=CODE,reloc=2
_multi_signed:
MOVWF 0x00
BTFSS 0x00, 7
GOTO Positive
GOTO Negative
Positive:
BTFSS 0x01, 3
GOTO PMulP
GOTO PMulN
Negative:
BTFSS 0x01, 3
GOTO NMulP
GOTO NMulN
PMulN:
COMF 0x01
MOVF 0x00, W
MOVWF 0x11
RCALL Multiplication
GOTO NegativeFinish
PMulP:
DECF 0x01
MOVF 0x00, W
MOVWF 0x11
RCALL Multiplication
GOTO PositiveFinish
NMulN:
COMF 0x00
INCF 0x00
COMF 0x01
MOVF 0x00, W
MOVWF 0x11
RCALL Multiplication
GOTO PositiveFinish
NMulP:
COMF 0x00
INCF 0x00
DECF 0x01
MOVF 0x00, W
MOVWF 0x11
RCALL Multiplication
GOTO NegativeFinish
Multiplication:
ADDWF 0x11
BTFSC STATUS, 0
INCF 0x10
DECFSZ 0x01
GOTO Multiplication
RETURN
PositiveFinish:
MOVFF 0x11, 0x01
MOVFF 0x10, 0x02
RETURN
NegativeFinish:
MOVFF 0x11, 0x01
COMF 0x01
INCF 0x01
MOVFF 0x10, 0x02
COMF 0x02
RETURNEditor is loading...
Leave a Comment