This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: call insn in z80


rahmaiah vallabhaneni <vbrahmaiah@yahoo.com> wrote:

> > To: gcc@gcc.gnu.org
>
> > I am working for z80 port. I have the following problem with the
> > call insn pattern.
>
...
> >  I am calling the function through a function pointer
> > p . So, the code generator keeps, the address
> > of p in a register and then makes call to the
> > function.
>
> >   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.
>
> >   It supports only
>
> >     call (symbolic_address);
>

Mike Stump wrote:

> Sure it does, just be inventive:
>
>     ld hl,(p)
>
>     ld (.+4),hl
>     call 0

I think the RET approach is far cleaner.

It works on multi-CPU systems and it's ROMable.

(I had a dual Z80A Onyx multiuser system at one time.
 Still have the main CPU board.)

Toshi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]