The real issue is that the assembler (as with most) does not assign types. It doesn't know that "IND" is a "register" or that "C" is a "statusbit" or that "W" (and "F") is an "accumulator" or a "destination" which is not a "register". If it did, then the definition COMF register could throw an error like COMF W ERROR ^- COMF expects a register. W is a destination. or COMF W, W ERROR ^- COMF expects a register. W is a destination. ERROR ^- COMF expects 1 parameter. Also, if you tried to do ADDWF PCL, PCL ERROR ^- ADDWF has PCL as register but needs a destination. PCL is a register. As Rich says, all the assembler knows is number. Every symbol gets translated to a number first, then plugged in. COMF W becomes COMF 0 which complements IND. --- James Newton (PICList Admin #3) mailto:jamesnewton@piclist.com 1-619-652-0593 PIC/PICList FAQ: http://www.piclist.com or .org -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of rleggitt@CONCENTRIC.NET Sent: Friday, April 28, 2000 12:16 To: PICLIST@MITVMA.MIT.EDU Subject: Re: COMF W On Fri, 28 Apr 2000 PDRUNEN@AOL.COM wrote: > Date: Fri, 28 Apr 2000 14:06:21 EDT > From: PDRUNEN@AOL.COM > Reply-To: pic microcontroller discussion list > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: COMF W > > In a message dated 4/28/00 11:45:31 AM Central Daylight Time, > rleggitt@CONCENTRIC.NET writes: > > << Try XORLW 0xFF instead. >> > > Thanks!! > > But still, why not the COMF W, I also tried COMF W,W but that just put the > value > into w as $FF, so something else was read as $00. File register instructions have a destination code, 0 or 1, i.e. MOVLW REG,0. But saying '0' or '1' is a pain, so the assembler has predefined: #define W 0 #define F 1 The address of the INDF file register is 0, so the definition of 'INDF' is: #define INDF 0 The COMF instruction works with a register address, i.e. COMF 0. The symbol you used to plug the '0' in there is irrelevant. You could also say 'COMF C' and get the same result, because the carry bit is bit 0 of the status register, thus: #define C 0 Remember that symbols don't exist to the PIC, these are for your edification only. Take a look at the listing file and you'll see the actual opcodes being generated, you can reference back to the spec to see what's going on. These are the only things that the micro sees (although not in hex :). -- Rich