So I've disassembled a project (PIC16F887), which has this snippet:
(Non-bold for context)Code:0x009C 0x081E MOVF ADRESH, 0 0x009D 0x00F1 MOVWF R0+1 0x009E 0x01F0 CLRF R0 0x009F 0x1683 BSF STATUS, 5 0x00A0 0x081E MOVF ADRESL, 0 0x00A1 0x04F0 IORWF R0, 1 0x00A2 0x3000 MOVLW 0 0x00A3 0x04F1 IORWF R0+1, 1 0x00A4 0x0008 RETURN
The manual states this about MOVLW:
And this about IORWF:The eight-bit literal ‘k’ is loaded into
W register. The “don’t cares” will
assemble as ‘0’s.
(My source)Inclusive OR the W register with
register ‘f’. If ‘d’ is ‘0’, the result is
placed in the W register. If ‘d’ is
‘1’, the result is placed back in
So, to my understanding, these 2 instructions would result in C code that looks round-about something like
And I have to say, that it doesn't make any sense at all why someone would do this. (Note that this is from an optimized library.)Code:R0+1 |= 0;
Am I perhaps reading this wrong?