6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 3:47 pm

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Mon Dec 18, 2017 9:04 am 
Offline

Joined: Mon Nov 13, 2017 12:04 pm
Posts: 7
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?


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 18, 2017 9:19 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
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.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 18, 2017 9:53 am 
Offline

Joined: Mon Nov 13, 2017 12:04 pm
Posts: 7
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.


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 18, 2017 10:08 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
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..."

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 18, 2017 11:06 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
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.


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 18, 2017 2:37 pm 
Offline

Joined: Mon Nov 13, 2017 12:04 pm
Posts: 7
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!


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 18, 2017 2:39 pm 
Offline

Joined: Mon Nov 13, 2017 12:04 pm
Posts: 7
GARTHWILSON wrote:
The 6502/65C02/65816 syntax will be pretty uniform

That's great, thank you


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 18, 2017 7:07 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1250
Location: Soddy-Daisy, TN USA
So, is your handle any reference to a certain audio/IO chip for the Atari? :-)

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 20, 2017 4:00 am 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 20, 2017 7:27 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
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:
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


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 20, 2017 9:59 am 
Offline
User avatar

Joined: Mon May 12, 2014 6:18 pm
Posts: 365
I can second the recommendation for ca65. The macro system is really powerful and you will probably start using it sooner than you think.


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 20, 2017 6:32 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8505
Location: Midwestern USA
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.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 14, 2018 1:59 am 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 578
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).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: