[Coco] 6502 to 6809 translation
    Roger Taylor 
    taylor at newfoal.com
       
    Mon Aug  1 15:13:34 EDT 2011
    
    
  
At 01:40 PM 8/1/2011, you wrote:
>Assume offset ($20) is in B and base address ($8000) is in X:
>
>         lda b,x
>
>This will not work if the offset is "negative" (bit 7 set) because 
>the "b,x" and "a,x" addressing modes treat the accumulator value as 
>a signed offset. So if B has $80 in it instead of $20, the above 
>instruction would read the address $7F80 ($8000-$80).
Depending on the program, this might be acceptible anyway.  A signed 
offset would access memory "around" a base address, while an unsigned 
offset would access memory to the positive side of the base 
address.  As long as the program is consistent with this method, 
where the data is actually stored and read might not matter so 
much.  You'd have to experiment in this area and see how it works for you.
>I'll close with a comment that it is very likely that completely 
>rewriting the code instead of doing a direct translation will result 
>in cleaner, faster, and more compact code on the 6809.
I'd do hand tweaking of the automatic translation, but not all by 
hand for a huge program.
-- 
~ Roger Taylor
    
    
More information about the Coco
mailing list