Detailed reference for the COMF instruction in PIC18 ISA.
Complement the contents of file register f.
f.d = 0 or back into register f if d = 1.a = 0 option selects the Access Bank; a = 1 selects the Banked addressing mode.Z flag is set if the result is zero; the C flag remains unchanged.; d=0, a=0 → result in WREG, Access bank
COMF 0x20, 0, 0 ; W = ~0x20; d=0, a=0 → result in WREG, Access bank
COMF 0x20, 0, 0 ; W = ~0x20; d=0, a=1 → result in WREG, Banked address
COMF 0x20, 0, 1 ; W = ~0x20; d=0, a=1 → result in WREG, Banked address
COMF 0x20, 0, 1 ; W = ~0x20; d=1, a=0 → result back to file register, Access bank
COMF 0x20, 1, 0 ; 0x20 = ~0x20; d=1, a=0 → result back to file register, Access bank
COMF 0x20, 1, 0 ; 0x20 = ~0x20; d=1, a=1 → result back to file register, Banked address
COMF 0x20, 1, 1 ; 0x20 = ~0x20; d=1, a=1 → result back to file register, Banked address
COMF 0x20, 1, 1 ; 0x20 = ~0x20; Load literal into WREG then complement, result in WREG (Access bank)
MOVLW 0x10
COMF 0x20, 0, 0 ; W = ~0x20; Load literal into WREG then complement, result in WREG (Access bank)
MOVLW 0x10
COMF 0x20, 0, 0 ; W = ~0x20