Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/17/03 15:35
Read: times


 
#58843 - RE: Help Returning to same program location
Responding to: ???'s previous message
Lewis:
It is common practice to use a RAM location (one or more as necessary) to store the current state of a program activity. Go ahead and make your display activity a subroutine that exits when a key is pressed. But in the design of the subroutine, make it so that it keeps track of where it is fetching the characters to be displayed. For example if the subroutine was getting a string out of CODE space with the MOVC instruction you could set DPTR to point to the base of the string but use a RAM byte to be kept as an index to the string position. At each iteration of the loop in the display subroutine this index in RAM would get incremented and then just before the MOVC instruction you would move the index to the A register for use with MOVC A, @A+DPTR instruction. If you leave the subroutine early the current index gets kept in the RAM variable. This leads to one requirement however in that this index RAM location needs to be initialized (possibly to zero) outside the subroutine before it is called the first time (and also any subsequent time that the index has gone past the of the string).

Michael Karas


List of 4 messages in thread
TopicAuthorDate
Help Returning to same program location            01/01/70 00:00      
   RE: Help Returning to same program location            01/01/70 00:00      
   RE: Help Returning to same program location            01/01/70 00:00      
      RE: Help Returning to same program location            01/01/70 00:00      

Back to Subject List