[Coco] 6502 to 6809 translation

Roger Taylor taylor at newfoal.com
Mon Aug 1 20:29:39 EDT 2011


At 03:57 PM 8/1/2011, you wrote:
>On Monday, August 01, 2011 04:56:24 PM Arthur Flexser did opine:
>
> > Wouldn't lda data_addr,y (without the parentheses) do the equivalent?
> > Add data_addr to y and load the a register from the address $8020?
> >
> > Art
>If it doesn't work, what have I been doing for 20+ years?
>It works.  What is the problem?
> >
> > On Mon, Aug 1, 2011 at 7:02 AM, Phill Harvey-Smith
> >
> > <afra at aurigae.demon.co.uk> wrote:
> > > Hi All,
> > >
> > > I'm currently trying to translate some 6502 code to run on the
> > > Dragon/CoCo, all is prety easy except for one thing, the 6809 doesn't
> > > appear to have one of the 6502 indexed modes namely :
> > >
> > > asume that data_addr contains $8000
> > > and y=$20
> > >
> > >        lda     (data_addr),y
> > >
> > >
> > > which will IIRC take look in data_addr, find $8000 and load a from
> > > $800+$20 = $8020.
> > >


Wait a second.  data_addr is a variable (no?) and has to be resolved 
at assemble/compile time.  Therefore, the 6809 is not looking in 
data_addr but already has the offset in the opcode at run-time.  Gene 
may be correct here, but then I've only breezed over the messages.

When in doubt, assemble some examples and you'll see what the 6809 is 
doing.  Otherwise you'll end up debating for weeks over this.


-- 
~ Roger Taylor




More information about the Coco mailing list