On Mon, Mar 22, 2010 at 06:30:12AM -0400, Josh Koffman wrote: > 2010/3/21 Olin Lathrop : > > You can always make your own. ?For example, the following macros are defined > > in my STD.INS.ASPIC file, which makes them available to all 8 bit PIC > > projects: > > I think I will make my own routine. I'm not really comfortable with > the psuedo instructions, especially now that the 18F chips have so > many more operands for that type of thing. That brings up a thought. Maybe a set of macros that mimic the 18F branch instructions would be a good idea. It certainly would make porting code easier. It takes some mental gymnastics to remember to negate the flag, do the skip, then have the goto. Like checking for a command character: movlw 'X' ; See if it's the X command xorlw cmd,W ; compare for equality btfss STATUS,Z ; More to do if it is an 'X' goto notx ; Not an 'X', move along. As you can see you have to check for Z being set and skipping the goto when the cmd is not an 'X'. In 18F parlance the code would be: movlw 'X' ; See if it's the X command xorlw cmd,W ; compare for equality bnz notx ; Not an 'X', move along. One less instruction and the notx is associated with not Z, just like it should be. So if there's going to be a macro why not: bnz macro target btfss STATUS,Z ; Skip if Z set. goto target Of course this fails if target isn't on the same page. One that always works would be: bnz macro target btfsc STATUS,Z ; Skip if Z set. goto bnz_#v(fail) ; temp label. fail need to be incremented. Not shown pagesel target goto target bnz#v(fail) Probably should be able to conditionally choose between the two depending on if the target is on the same page as the macro expansion. I'm currently working on porting my budding forth executive to the 18F family. I plan to have both 16F and 18F kernels. This looks like a good idea. BAJ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist