Jinx wrote: > Does anyone have such a thing for the 18F ? I've got a bunch > of retlw messages for an LCD, of the type > > addwf pcl > dt "message1" There is no need for RETLW style tables on a PIC 18 since they can all read program memory and it is nicely byte addressable. Change the DT to DB and remember to put it in a CODE_PACK section instead of a CODE section. Accessing a byte in the string is easy. You load TBLPTR with the address of the byte and execute one of the table read instructions. If the same routine is geting successive string bytes, you can use TBLRD+, which automatically post increments the table read address. After a table read, the byte value is in TABLAT. > in lower memory, 0x100 - 0x580, and some cross boundaries, > which means updating PCLATH. Normally I don't have such a > large number of messages, and would arrange it so that page > straddling is avoided With the table read method, there are no special considerations about whether the table straddles a 256 byte boundary or not. > 1) re-write them as tables. Not so bad but that seems defeatist Why? That's the right way to do it on a PIC 18. The weird thing is that you ever used RETLW tables for this in the first place. If the source needs to be compatible with a PIC 16, then you can create a string definition macro that does the appropriate thing depending on what machine you are on. > 2) possibly re-invent the wheel by writing my own macro This can't be more than a few lines of code. > Ideally I'd want a macro that's self-modifying, perhaps using > something like > > get message1 > > which would find PCLATH (ie high(message1)) then correct > PCLATH if ADDWF PCL goes over a boundary I'm not sure what the GET macro is exactly supposed to do. You can't really "get" a whole string on a PIC. You probably want one macro to set up for reading a string, then a subroutine to call to get each byte. All this together should be 1/2 page of code, so I'm not sure what you're really asking about. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist