Steve Hardy wrote: > > > From: Tjaart van der Walt > > > > A simple solution is to use a MPASM address for a label. Right shift it > > 8 times, and load it into PCLATH. You can even make a macro out of it : > > > > Fix_up_PCLATH MACRO > > local Local_Label > > Local_Label > > movlw ((Local_Label>>8)&&0xFF) > > movwf PCLATH > > ENDM > > > > Now all you have to do after returning from a unknown address location, > > is "Fix_up_PCLATH" > > > > It uses two words of ROM, but saves your sanity. > > Unfortunately, it also destroys W which forces subroutines to return > results in registers. There are plenty of solutions. How about the > following untested macro for general calls. No doubt Andrew Warren et > al. have something similar in their web pages, but this is my 5 cents > worth (sorry, Oz doesn't have 2 cents any more - inflation, you know). > Your are right about it destroying W. However, sometimes that doesn't matter much. I usually use it before table reads. Talking about cents.... At R7.50 to the Quid and R4.50 to the UD$, we are HOPING for inflation (ouch!) -- Friendly Regards Tjaart van der Walt ______________________________________________________________ | Another sun-deprived R&D Engineer slaving away in a dungeon | |WASP International GSM vehicle tracking and datacomm solutions| | +27-(0)11-622-8686 | http://wasp.co.za | |______________________________________________________________|