On Wed, Apr 25, 2012 at 11:03:33AM -0600, Dwayne Reid wrote: > Many thanks, Byron. Its been a while since I last did any serious /=20 > difficult macro writing and you've given me much to think about. I=20 > think that I can automate the whole process even more than my=20 > previous stuff - I had to manually set / clear the rp0 & rp1 bits=20 > with my previous (current) setup. >=20 > However, I'm confused by something: >=20 > At 08:51 PM 4/24/2012, Byron Jeff wrote: >=20 > >Works fine, but I had simply disabled the 302 directives. Poking around = the > >manual I found the SET directive, which facilitates assembler variables > >that can be changed. I figured that we can keep track of the current ban= k > >in the macro. Since we only need the bank, I decided the shift the targe= t > >down, then shift it back up: > > > >SETBSR macro target > > movlb (target >> 7) ; gpasm assember's BANKSEL=20 > > doesn't work for exhanced 16F parts. > >CURBANK set ((target >> 7) << 7) > > endm >=20 > I'm assuming that you are shifting the target down, then back up so=20 > as to strip off the low-order address bits? A simple 'AND' would=20 > have worked just as well - correct? Correct. > Or is there a good reason to do=20 > it your way instead of using a simple 'AND' to mask off the low-order=20 > address bits? I already had the shift in place and was just testing quickly. At first I simply copied the movlb line from the original macro that already had the shift. I then realized that I needed the bank bits back in their original location. At the time it was just faster to do the shift back instead of trying to figure out the mask to AND. BAJ >=20 > dwayne >=20 > --=20 > Dwayne Reid > Trinity Electronics Systems Ltd Edmonton, AB, CANADA > (780) 489-3199 voice (780) 487-6397 fax > www.trinity-electronics.com > Custom Electronics Design and Manufacturing >=20 > --=20 > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist --=20 Byron A. Jeff Department Chair: IT/CS/CNET College of Information and Mathematical Sciences Clayton State University http://cims.clayton.edu/bjeff --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .