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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/23/04 06:26
Read: times


 
#77983 - RE: Modifying the program counter
Responding to: ???'s previous message
An alternative to jmp @a+dptr, especially if you need the dptr already for something else, or if you need a bigger range than jmp @a+dptr is capable of is to calculate the address where you want to go, push it on the stack and then execute a RET instruction. This will also get you where you want to go.

Example:
		add	a,low(base_addr)	;Calculate low order address
		push	acc			;put it on the stack
		mov	a,high(base_addr)	;Calculate high order address
		push	acc			;Both bytes on the stack now
		ret				;Pop them and put them in the PC



List of 14 messages in thread
TopicAuthorDate
Modifying the program counter            01/01/70 00:00      
   RE: Modifying the program counter            01/01/70 00:00      
      RE: Modifying the program counter            01/01/70 00:00      
         RE: Modifying the program counter            01/01/70 00:00      
            RE: Modifying the program counter            01/01/70 00:00      
   RE: Modifying the program counter            01/01/70 00:00      
      RE: Modifying the program counter            01/01/70 00:00      
         RE: Modifying the program counter            01/01/70 00:00      
   RE: Modifying the program counter            01/01/70 00:00      
      RE: Modifying the program counter            01/01/70 00:00      
         RE: Modifying the program counter            01/01/70 00:00      
   RE: Modifying the program counter            01/01/70 00:00      
      RE: Modifying the program counter            01/01/70 00:00      
      RE: Modifying the program counter            01/01/70 00:00      

Back to Subject List