I try to convert this ASM macro "GETBYTE_RF" to FC:
Code: Select all
2. CLRF RXDATA ;Clear RXDATA
3. MOVLW .8 ;W = 8d
4. MOVWF TEMP ;Load TEMP 8d
6. BSF RFSCK ;SCK = 1
8. RLF RXDATA,F ;Rotate Left RXDATA
9. BSF RXDATA,0 ;Set bit 0 of RXDATA
10. BTFSS RFSDI ;Test bit SDI, skip if is set
11. BCF RXDATA,0 ;Clear bit 0 of RXDATA
12. BCF RFSCK ;SCK = 0
14. DECFSZ TEMP ;Decrement TEMP, skip if is = 0
15. GOTO RECLOOPDAT
Apparently, it is an SPI Read transaction.
I'm wondering if this code contains bugs. I.e:
In line 2. CLRF RXDATA
In line 8. RLF RXDATA, F
Given that the register RXDATA has been cleared, why it should be Rotated Left later? The result will be always zero.
Am I missing something with the destination of instruction "RLF RXDATA, F "?
It is the same register RXDATA, isn't?