This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: call insn in z80
- To: brahmaiah vallabhaneni <vbrahmaiah at yahoo dot com>
- Subject: Re: call insn in z80
- From: Hartmut Schirmer <hartmut dot schirmer at arcormail dot de>
- Date: Thu, 15 Mar 2001 19:39:43 +0100
- Cc: gcc at gcc dot gnu dot org
- References: <20010315122641.6248.qmail@web3104.mail.yahoo.com>
- Reply-To: hartmut dot schirmer at arcormail dot de
On Thu, 15 Mar 2001, brahmaiah vallabhaneni wrote:
>Hi all,
> I am working for z80 port. I have the following
>problem with the call insn pattern.
[snip]
>
> the code looks like
>
> ld bc,_first_fun
> ld (_p),bc
> ld bc,(_p)
> ld iy, bc
> call (iy) // problem.
> but actually z80 does not have an instruction
> call throgh a indirect register address.
The Z80 can jump via hl, ix and iy.
Just add
__call_indirect_hl:
jp (hl)
__call_indirect_ix:
jp (iy)
__call_indirect_iy:
jp (iy)
to libgcc and emit the following code
ld bc,_first_fun
ld (_p),bc
ld hl,(_p)
call __call_indirect_hl
The call will place the correct return address and
the jp (hl) will set the pc
Hartmut