The PIC instruction set is uncommonly filled with things that on other processors are done with a particular instruction, but which are done on the PIC by some clever use of one of its small number of instructions. The bit-oriented instructions can test conditions in the status register, including such things as the Z or zero bit and the C or carry bit. The MPASM recognizes special mnemonics (they are actually in the help file!) for several of these, including skpz and skpnz, which skip if zero flag is set or not set respectively. The MOV family of instructions set the Z bit as a side effect, so your example can be coded as: MOVF WWW,f ; Assuming WWW is a variable in memory, and not the W register... ; At first glance, this instruction looks like a complicated NOP, ; since it moves WWW back onto itself, but as a side effect, it ; tests the value for zero and sets the Z flag skpz call SOME_ROUTINE If you meant for your W to mean the W register, then you can probably skip the first instruction, because almost any instruction that leaves a value in W alters the Z flag to reflect the contents of W. One notable exception is RETLW. With the PIC, "You can't tell the players without a scorecard!", so keep the instruction set pages of the datasheet handy to check for all the side effects, especially which instructions alter which flags. > -----Original Message----- > From: Dylan Hillier [mailto:xonius@IHUG.COM.AU] > Sent: Wednesday, October 24, 2001 10:46 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: Simplest Solutions always the hardest to find. > > > Hello People, > > Just curious about the PIC equivalent to an C if statement to > compare one > byte to another: > > I have looked through the manual only to find that there > seems to be only > instructions for bit oriented or counter skipping of next instruction. > I looked in the online help to come up with something like > below, but it > appears only to be a macro used during compile time and skipped > when run through the debugger. > > IF W != 0 > CALL SOME_ROUTINE > GOTO STR_LOOP > ENDIF > > > Is there a simple way of checking if byte 'A' = byte 'B' then > call this > routine, else call this one. > > Incase your wondering what im trying to do. Im trying to > store strings in > the EEPROM that are zero terminated and read through them until i > reach that zero. > eg. > EE_LINE1 DE "My LiL EEPROM String ;o)", 0 > > > While im on the topic of using internal EEPROM of a > PIC16F84A, im yet again > confused as to some of the wording in the manual. > It says in section 5.0 that this device has 64 bytes(chars) > of data with > address range from 0h through to 3fH. BUT this appears to be > in conflict with the memory model shown in figure 2-1 in > section 2. My > main concern is when defining the use of EEPROM in the source > where on earth to i ORG it to ? The online help mentions something > about H'2100', but where did this value come from. > > arggggg.. driving me insane. I will be bald from pulling my > hair out soon. > > > Regards, > > Dylan Hillier. > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads