Aubrey McIntosh, Ph.D. wrote : > Does banksel always generate two instructions on the > 16F877? I think so. I'd guess (if MPASM is smart enough) one instruction on two page PICs and two instructions on four page PICs. > Is there a > clever way have a macro generate only the minimum number of > instructions? Yes, Olins DBANKIF macros does that. Note that you must have a system of assembler symbols to keep track of the current bank settings, and in some cases you can't now what the settings are (such as after an "entry point"). That's where Olins macro UNBANK comes into play. UNBANK removes all assumptions of bank settings so the next DBANKIF always creates the bcf/bsf instructions. > I have thought of a design that compiles the > .lkr file into > an include file that cooperates with the macros, but I haven't gone > anywhere with it. You must also have a list of all FSR with information on which FSR goes into which bank, I think. One idea could be to download Olins environmet and learn from his work :-) (Don't know about PAGESEL...) Jan-Erik. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.