Plus one
Posted: Tue Jan 15, 2013 7:01 pm
I try to get a less as possible program steps.
In Flowcode I have 2 variables A (byte) and B(2 bytes=UInt). Both have to be increased with 1. Thus A=A+1 and B=B+1.
However the assembler codes differ significantly:
1) A=A+1 shows:
INCF gbl_FCV_A, W
MOVWF gbl_FCV_A
is ok, but could be shorter with
INCF gbl_FCV_A, F
2) B=B+1 shows:
MOVF gbl_FCV_B, F
MOVF gbl_FCV_B+D'1', F
INCF gbl_FCV_B, F
BTFSC STATUS,Z
INCF gbl_FCV_B+D'1', F
As far as I see, the first 2 lines only fill the ZERO status flag. These 2 lines does not have sense here. The last 3 lines are essential and can not be shorter.
Do I miss something? What is the reason the bootc put
MOVF gbl_FCV_B, F
MOVF gbl_FCV_B+D'1', F
these lines in case of an UInt variable?
Kind Regrads
Jan Lichtenbelt
In Flowcode I have 2 variables A (byte) and B(2 bytes=UInt). Both have to be increased with 1. Thus A=A+1 and B=B+1.
However the assembler codes differ significantly:
1) A=A+1 shows:
INCF gbl_FCV_A, W
MOVWF gbl_FCV_A
is ok, but could be shorter with
INCF gbl_FCV_A, F
2) B=B+1 shows:
MOVF gbl_FCV_B, F
MOVF gbl_FCV_B+D'1', F
INCF gbl_FCV_B, F
BTFSC STATUS,Z
INCF gbl_FCV_B+D'1', F
As far as I see, the first 2 lines only fill the ZERO status flag. These 2 lines does not have sense here. The last 3 lines are essential and can not be shorter.
Do I miss something? What is the reason the bootc put
MOVF gbl_FCV_B, F
MOVF gbl_FCV_B+D'1', F
these lines in case of an UInt variable?
Kind Regrads
Jan Lichtenbelt