| ??? 10/17/01 16:07 Read: times |
#15773 - RE: Converting my o/p to drive LCD disp |
J.Guy,
i understand what you are saying now. my routine just takes the string address and loads it into the dptr and then retreives from that point on until the termination point. it isn't a program for 'print string X' as you are now discussing. i find that most applications for printing strings are not dynamic and so can be set in code. this means to runtime processing through several strings to find the intended one, is wasteful though when i need such a string indexer, the strings tend to be variable length and i use a indexed lookup table to find the start address. these structures can be autoformed in the assembly directives will a little thought. maybe its time to discuss print immediate? here i use a stack manipulation that may confuse some novices. think about what happens in a call. a return address is stored on the stack pointing to the next location after the call instruction. that can be used as the pointer to an imbedded text string as long as you restore the stack to the opcode following that embedded string before issuing the RET instruction in the called print routine. this can actually be done quite concisely and it avoids unnecessary CALL & RET pairs which are timeconsuming operations. the print immediate is most useful during incode debugging: ;----- call printimmediate db "enter routine x, section duh",eot call dosomethingelse ;----- the routine printimmediate loads dptr with the return address on the stack. its then used to fetch the characters of the string until it reaches the EOT (equated symbol for end-of-text). the dptr is adjusted to point to the following upcode, pushed to the stack to replace the original return address and a RET issued. the effect is that after the call printimmediate is executed, the next line in the original routine executed is the call dosomethineelse. i'll not post the code in order that those new to this technique, get the value of pondering how to do it. :) duh |



