jamesadrian wrote:
This is my first post to the group.
Is there such a thing as a cross assembler that accepts 6502 or 65C816 assembly language as input and produces machine code for a PC or an OS X iMac?
Thank you for your help.
Jim Adrian
jim@futurebeacon.comHi, James. It sounds like a really cool
idea but I'm not sure how much you could get done. The two languages are "somewhat" similar in a few ways and it's not really all that hard to transition from one to the other, yet the two are very different in so many other ways.
With macros (and FASM has a macro engine specifically designed for doing this) you can simulate ANY 6502/816 instruction in x86, but...
x86 (especially) has many more registers and how they deal with data sizing (different opcodes, not SR bits), some extremely complex addressing modes, a slightly different stack, differences with the carry in both addition and subtraction, and no zero page, not to mention a flat address space in Protected Mode and a different segmenting (banking) scheme than '816 in Real Mode (and many, many more things to consider than just this little bit here) so if the question is, "Can I write 65x source in an x86 assembler and expect x86 output?" the answer is an extremely narrow Yes*. The asterisk is a killer because the two instruction sets just don't line up with each other. x86 is altogether much more involved than 65x.
Now, if you are looking to make '816 binaries using an x86 assembler, or emulation of '816 instructions, then sure, it can be done with macros and custom code -- I do lots of both actually. Also, it's very possible to translate old 16-bit x86 source code to '816 (there's a lot out there still!) and I have done it many times (3D gfx code, string handling, number conversions, etc.) to get something I needed in '816 but wasn't sure how to do it.
P.S I have an
endless library of good (great) x86 & 65x digital books if you need them.