Roman, you're right. I had forgotten about the "built-in macros" for Bn. Sorry. (Too much pollen from yard work on Saturday affecting my brain!) Douglas Wood Software Engineer dbwood@kc.rr.com Home of the EPICIS Development System for the PIC and SX http://epicis.piclist.com ----- Original Message ----- From: "Roman Black" To: Sent: Sunday, June 10, 2001 3:05 AM Subject: Re: [PIC]: instructions not in the instruction set ! > Douglas Wood wrote: > > > > Actually, Roman, they're not "standard mnemonics"; they're macros (or > > #defines, if you like) that are built into MPASM. There is no entry in any > > instruction set descriptions from Microchip that list these "instructions" > > as real instructions. (See my PIC Microcontroller Instruction Set Comparison > > Matrix for a complete list of all PIC microcontroller instructions. Note: > > this chart DOES NOT include any of the new dsPIC instructions.) > > > The "official" quick reference card I got from > Microchip with MPASM users guide lists these as > "PIC16C5X/PIC16CXX Special Instruction Mnemonics" > > And they are listed under the same name, all the > same official mnemonics on page 135 of the MPASM > users guide. Maybe they are not "real" instructions > as such but if listed as part of MPASM that makes > them official enough for me. And I never said they > were official instructions, I said they were > official mnemonics. :o) > > > > Secondly, the Bn conditional branch instructions 1) only appear in the > > enhanced 16-bit core products (i.e., 18Cxxxx/18Fxxxx) and 2) are all encoded > > in a single word (note, however, that they take two machine cycles, but NOT > > two program words). Skip instructions will work perfectly find with them. > > Wrong again Douglas! :o) > BZ, BNZ, BC etc are all included in the same list, > and they assemble to 2 instructions as I said. > See the "instruction set" pages in your MPASM > guide, they are all listed. > > I also forgot a couple of the other official ones > I use all the time; CLRC, SETC, CLRZ, SETZ. > > And one homemade one that is very useful to > simplify close branching without having to resort > to labels; > > #define SKP2 goto $+1+2 ; skips the next 2 instructions > > Example: > DECFSZ register,f ; dec register, and test zero > SKP2 > (do blah) ; if register==Z, do both these instructions > (do another blah) ; > ; if register==NZ, skipped them both > > > I know some purists won't like that, but so > often you need to do a conditonal test and then > do (or not-do) 2 instructions. This saves having > to add goto+label where there is really no need. > I don't use this all the time, only some times > when it gives simpler code. > -Roman > > > > > ----- Original Message ----- > > > > Patrick J wrote: > > > > > > > > U gurus seem to have some instructions to use that isnt in the > > > > instruction set like "skpnc" and "skpc", "skpcnc". I have seen them > > > > in examples and they compile so guess they are ok... weird. > > > > > > > > I have the PIC 16F87x pdf datasheet. Instruction set in page 138. > > > > What does they mean, and are there more of 'em ? > > > > > > > > > Hi Patrick, these are STANDARD Microchip mnemonics > > > for their PIC instruction set. As such I don't see > > > any problem in using them, in fact the opposite, I think > > > > > > SKPNZ (skip if not zero) > > > > > > is so much more sensible than > > > > > > BTFSC STATUS,Z > > > > > > Surely you agree? The MPASM handbook and associated > > > .PDF format list these mnemonics. > > > > > > The only ones I don't like are the BZ, BNZ, etc which > > > assemble to 2 instructions. That can cause problems > > > with other "skip" situations and I don't use them. > > > > > > The standard mnemonics that assemble to ONE instruction > > > are great, like SKPZ, SKPNZ, SKPC, SKPNC, and I use > > > TSTF a lot, great for testing if a register is zero by: > > > > > > TSTF register > > > SKPZ (this code is very obvious what you tested) > > > goto blah > > > > > > There are a few custom designed mnemonics that are not > > > official Microchip ones, but which are really handy, > > > I got these from Olin, > > > > > > SKPWGT skip if w greater than > > > SKPWLE skip if w less or equal > > > SKPWEQ skip if w equal > > > SKPWNE skip if w not equal > > > > > > These are amazingly useful when using the sometimes > > > confusing Microchip SUBLW and SUBWF instructions. > > > That can save so much effort and debugging. > > > > > > You can make some custom instructions yourself just > > > by using the define# command. A couple I like are INCW > > > and DECW, very useful. As long as they assemble to > > > one instruction I would recommend using these, they > > > can help you write and debug code so much quicker. > > >:o) > > > -Roman > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu