[Coco] Space Invaders - Translated from Intel 8080 to Motorola 6809 for the CoCo 3

Dave Philipsen dave at davebiz.com
Thu Dec 29 11:10:21 EST 2016


On 12/29/2016 9:57 AM, Glen Hewlett wrote:
> Hi cb,
>
> I’m sorry at this point I’ve only been looking into the Intel 8080 and now I’m learning about the Z80 which is based on the 8080.  As far as I know the 6502 will be completely different.  That being said though when you are working down at the assembly level there aren’t too many differences between the CPUs.  The biggest pain I have with the Intel and Z80 so far is the crazy way the 16 bit values are stored as LSB then MSB in memory.  So if you load that word into a 16 bit register like the X,Y or D register your value will be backwards.

That's commonly referred to as little-endian and big-endian. Different 
CPUs do it different ways.  I think all of the old Intel processors are 
little-endian and that influenced the way other companies did it.  
Motorola did big-endian but MOS Tech did it little-endian.  Fortunately, 
you won't run into too many problems with 6502 / 6809 conversion because 
there's only one 16-bit register in the 6502 and that's the program 
counter.  You probably won't have many cases where you'll need to 
manipulate its value when it's pushed/pulled from the stack.  And as far 
as doing 16-bit math with the 6502 then you can determine whether you 
want it to be little or big-endian.


> With D you can do an EXG A,B and you are good, but it is a pain to keep doing.  So there becomes a point if you should swap the original data and use the registers normally, but then you get to a point where you load a single byte from an address and it is pointing to the LSB.  For example  LDA   ,X.  Would need to be changed with LEAX. 1,X  then LDA  ,X.
>
> I’m sorry if I went on here, I’m just trying to let you know that if the 6502 stores it’s 16 bit values as LSB,MSB instead of what makes sense to me as the 6809 does it as MSB,LSB then you will have an idea of what kind of fight you are up against.

It does but as I mentioned you'll probably not encounter a problem with it.

>
> Doing the assembly translation really does let you know how the hardware works and is a good way to learn more about both the CoCo and the hardware you are trying to translate to work on the CoCo.  I hope you do give the 6502 translation a try, I might be asking you questions about it down the road.
>
> Good luck,
> Glen
>
> Ps - I probably should post more info on my Blog describing the process I’m using to translate the Pac Man Z80 code to 6809, it might be useful for others…  The only problem I see is that Namco who owns Pac Man, I think still protects their copyright on it.  I’ve seen that there have been take down requests when I was looking for assembly listings of the Pac Man code.  So maybe I would have to keep the blog more general.  We’ll see...
>
>> On Dec 29, 2016, at 10:15 AM, camillus gmail <camillus.b.58 at gmail.com> wrote:
>>
>> Hi,
>>
>> I'm kind of interested in 6502 to 6809 coe translation. Do you have experience with this or know of any computer aid software to do this?
>>
>> Any info about this I would appreciate.
>>
>>
>> cb
>> On 12/29/2016 6:09:57 AM, Mark McDougall <msmcdoug at iinet.net.au <mailto:msmcdoug at iinet.net.au>> wrote:
>> On 29/12/2016 2:54 AM, Glen Hewlett wrote:
>>
>>> I was thinking that with a 6502 to 6809 translation that someone
>>> could port the Apple II or Pet to the CoCo 3. Of course you couldn’t
>>> play any machine language games but you probably could run basic
>>> games made for those systems on the CoCo translated version. I think
>>> that would be cool to see…
>> I think someone had (Z80) CP/M running on the Coco3 a while back...
>> haven't heard much more about it lately.
>>
>> The Apple II (software) is a good candidate for the Coco3 because of the
>> similar graphics modes and - to a degree - CPU. Lode Runner translated
>> fairly well to 6809 in the end...
>>
>> Regards,
>>
>> --
>> Mark McDougall
>>
>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com <mailto:Coco at maltedmedia.com>
>> https://pairlist5.pair.net/mailman/listinfo/coco <https://pairlist5.pair.net/mailman/listinfo/coco>
>>
>> -- 
>> Coco mailing list
>> Coco at maltedmedia.com <mailto:Coco at maltedmedia.com>
>> https://pairlist5.pair.net/mailman/listinfo/coco <https://pairlist5.pair.net/mailman/listinfo/coco>



More information about the Coco mailing list