| ??? 10/17/01 16:28 Read: times |
#15774 - RE: Converting my o/p to drive LCD disp |
J.Guy,
Another thing you can do is use your tabled string equates and the $ variable to automatically create a string identifier containing the offset to the start of string x. ;----- table: db "msg 1",eot equ msg1 $-table+adjust db "msg 2 is even longer",eot equ msg2 $-table+adjust db "msg 3 is here",eot equ msg3 $-table+adjust . . . mov a,msg2 call printfromtable ;----- now the accumulater is assumed to be preloaded with an index inside the 256 byte page that is added to the dptr value of table instead of clearing the initial pointer as before. i don't tend to do this technique much because when i needed canned messages (applications supporting several languages tables), i require a structure supporting larger size. i use the equate scheme above more commonly to automatically derive the length of various types of tables or strings so i don't waste time on termination characters; i pass the compiletime computed length as a parameter. that way i can easily add or remove records and have all the lengths or pointers recomputed at compilation time. ;----- record1: db XXh,...XXh equ lenrecord1 $-record1+adjust record2: db XXh,...XXh equ lenrecord2 $-record2+adjust ;----- its a neat trick. i use part of this structure in my background tasker, using the offset as the task identifier in the table. oh, the ADJUST is a value as necessary to make the address computation useful to the purpose. duh |



