aless2056
Member level 1
Guys, I made this code in asm for a PIC 16F877 that decreases Value (high and low) to 0x00 and increases to 0x64. Does anyone see something wrong with this code, or do you think it could be improved?
Code:
DEC
MOVF VALUE_HIGH,W
SUBLW B'00000000'
BTFSS STATUS,C
GOTO DC_DEC
MOVF VALUE_LOW,W
SUBLW B'00000000'
BTFSC STATUS,C
GOTO EXIT
DC_DEC
DECF VALUE_LOW,F
MOVLW .255
XORWF VALUE_LOW,W
BTFSC STATUS,Z
DECF VALUE_HIGH,F
GOTO EXIT
INC
MOVLW B'00000011'
SUBWF VALUE_HIGH,W
BTFSS STATUS,C
GOTO DC_INC
MOVLW B'11101000'
SUBWF VALUE_LOW,W
BTFSC STATUS,C
GOTO EXIT
DC_INC
INCF VALUE_LOW,F
BTFSC STATUS,Z
INCF VALUE_HIGH,F
GOTO EXIT
Last edited by a moderator: