Page 1 of 1

most popular 6502 assembler

Posted: Mon Dec 18, 2017 9:04 am
by pokey
Hello everyone!
I need to generate some 6502 assembly code for my project, and I (due to lack of experience) is totally clueless about which assembler to target.
A safe choice probably would be to pick the most popular one providing it runs on Windows or Linux. Which one would you recommend?

Re: most popular 6502 assembler

Posted: Mon Dec 18, 2017 9:19 am
by GARTHWILSON
Does it need to be free? The best ones aren't necessarily free, but there indeed seem to be some excellent free ones nevertheless, and "free" of course contributes to popularity. One that comes to mind is Andrew Jacobs' As65 assembler for 6502, 65c02, and 65816, which has program-structure capability built in. I have not used it myself (I use C32 which costs $99) but the specifications for As65 look outstanding, and it has been out for many years, so I would expect it to be relatively bug-free by now.

Re: most popular 6502 assembler

Posted: Mon Dec 18, 2017 9:53 am
by pokey
GARTHWILSON wrote:
Does it need to be free? The best ones aren't necessarily free, but there indeed seem to be some excellent free ones nevertheless, and "free" of course contributes to popularity. One that comes to mind is Andrew Jacobs' As65 assembler for 6502, 65c02, and 65816, which has program-structure capability built in. I have not used it myself (I use C32 which costs $99) but the specifications for As65 look outstanding, and it has been out for many years, so I would expect it to be relatively bug-free by now.
Thank you!
Given that 6502's popularity peaked a few decades ago I assumed that all commercial assemblers were abandoned long ago.
I expect that most of my code will be generated and not hand written, so a simple assembler will suffice. I mostly care about syntax, I need to generate code that is not painful to look at for a seasoned 6502 programmer.

Re: most popular 6502 assembler

Posted: Mon Dec 18, 2017 10:08 am
by GARTHWILSON
pokey wrote:
I expect that most of my code will be generated and not hand written, so a simple assembler will suffice. I mostly care about syntax, I need to generate code that is not painful to look at for a seasoned 6502 programmer.
The 6502/65C02/65816 syntax will be pretty uniform, but the assembler directives will vary a little bit from one assembler to another. If you have to adapt 65xx source code to make it assemble on a different assembler, hopefully a text editor's search-and-replace feature will quickly do most of it, after you know what to search for and what to replace those things with. For example, .WORD on some assemblers is DWL on the C32 assembler, for "Define Word(s), Low byte first." Many will use ORG (ORiGin) for telling the assembler what address to start assembling the following section for, while others will use .ORG or *=.

Making your code clear and easy to look at depends on you, not really the assembler. It's something we all need to keep striving for, regardless of what level we're at so far. Visual factoring is important. See the last few paragraphs of the "Debugging" page of my 6502 primer, under "Debugging. Part III. An ounce of prevention..."

Re: most popular 6502 assembler

Posted: Mon Dec 18, 2017 11:06 am
by BigEd
There are lots of tools listed in the reference section of 6502.org - start here:
http://6502.org/tools/

Personally I usually use ca65 (part of the cc65 compiler) or any of several in-browser assemblers.

Re: most popular 6502 assembler

Posted: Mon Dec 18, 2017 2:37 pm
by pokey
BigEd wrote:
There are lots of tools listed in the reference section of 6502.org - start here:
http://6502.org/tools/

Personally I usually use ca65 (part of the cc65 compiler) or any of several in-browser assemblers.
The assembler accepts the standard 6502/65816 assembler syntax

Good enough for me. Thank you!

Re: most popular 6502 assembler

Posted: Mon Dec 18, 2017 2:39 pm
by pokey
GARTHWILSON wrote:
The 6502/65C02/65816 syntax will be pretty uniform
That's great, thank you

Re: most popular 6502 assembler

Posted: Mon Dec 18, 2017 7:07 pm
by cbmeeks
So, is your handle any reference to a certain audio/IO chip for the Atari? :-)

Re: most popular 6502 assembler

Posted: Wed Dec 20, 2017 4:00 am
by whartung
pokey wrote:
Good enough for me. Thank you!
Well, to be honest, you need to consider the ultimate destination for your assembly, in terms of the final form.

The CC65 suite is quite powerful, but the linking and loading can be very complicated.

Re: most popular 6502 assembler

Posted: Wed Dec 20, 2017 7:27 am
by BigEd
For simple projects, I've used ca65 in a very simple way. (For more complex ones, you might need to set up a config file which describes your target machine.) See here:

Code: Select all

ca65 -l boot816.as -D BASE=0x8000
cl65 boot816.o --target none --start-addr 0x8000 -o boot816.bin
Elsewhere in the forum, these conversations might help:
viewtopic.php?p=25277#p25277
viewtopic.php?p=51226#p51226
viewtopic.php?t=2455#p24636

Re: most popular 6502 assembler

Posted: Wed Dec 20, 2017 9:59 am
by Druzyek
I can second the recommendation for ca65. The macro system is really powerful and you will probably start using it sooner than you think.

Re: most popular 6502 assembler

Posted: Wed Dec 20, 2017 6:32 pm
by BigDumbDinosaur
Long-time user of Kowalski's assembler. It doesn't directly support the 65C816, but has an extensive macro capability that makes adding support possible.

Re: most popular 6502 assembler

Posted: Sun Jan 14, 2018 1:59 am
by Martin_H
I've been reading the CA65 docs as it comes with CC65. It does look pretty powerful, and supports label scope, anonymous labels, macros, and program sections. These were all standard features in the best macro assemblers, and are helpful as programs grow in complexity.

I've been using the Ophis assembler as it is written in Python, so it is cross platform. It has a similar feature set and remarkably similar syntax to CA65. A global search and replace should port code from one to the other. For example .endscope (CA65) to .scend (Ophis).