Re: A85: Help!!


[Prev][Next][Index][Thread]

Re: A85: Help!!




On Mon, 6 Jul 1998 21:08:24 EDT, you wrote:

>
>Here's the problem...
>
>I want to CALL a routine without using the CALL statement... and the word of
>the location I want to call is in HL... can someone help me?
>
>For example...
>

use

 ld hl,LABEL		;LABEL is absolute address, not relative
 jp (hl)		;jump to address in memory

or if you want to do something more "call" like (i.e. you can return
from it)

 ld hl,RET_LABEL	;RET_LABEL is absolute addr of where to return
 push hl		;put return addr on stack (like a "call" does)
 ld hl,LABEL		;LABEL is absolute address, not relative
 jp (hl)		;jump to address in memory
RET_LABEL:
 ...			;instruction to execute upon return


LABEL:
 ...			;some code
 ret			;pop RET_LABEL into PC

that should work.  and like i said, make sure that all of the
addresses are the absolute address (in Usgard use &, in ZShell add
PROGRAM_ADDR, in Rigel you don't need anything).

-mike pearce


References: