NESASM vs CC65

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
mattheweston
Posts: 25
Joined: Tue Feb 09, 2010 5:48 pm

NESASM vs CC65

Post by mattheweston »

What are the fundamental differences between these two assemblers ?
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Re: NESASM vs CC65

Post by Bregalad »

NESASM is specific for the NES, while CC65 is not.

NESASM is buggy and unreliable, as it doesn't supports too long labels, or too many labels. It does not support unnamed labels ('+' and '-'), nor relocatable code (i.e. if you have some code in ROM and copy it to RAM for any reason, and want the labels to be referred as their RAM version). It requires you to split your PRG-ROM in 8kb banks, even though many (most) cartridges configurations uses 16k or 32k banks. It requires the '<' symbol for all zero page instructions.

CC65 requires complex configuration scripts that are extremely annoying to use as a beginner (and also as a non-beginner). This is the price to pay for more features.

Many other assemblers (such as ASM6) are in-between, they are not as complex to use as CC65, yet they are more reliable than NESASM. I'd recommend using one of those for a start.
mattheweston
Posts: 25
Joined: Tue Feb 09, 2010 5:48 pm

Re: NESASM vs CC65

Post by mattheweston »

Should the assembly code be about the same assuming the use of ca65 instead of cc65?
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Re: NESASM vs CC65

Post by Bregalad »

In practice not really, unfortunately. It's long and tedious to convert assembly code from one assembler to another, however, a script or even a dedicated program could do that more rapidly if this was needed.

For example, the way to declare labels (with or without the ":" symbol) and support for unnamed labels and/or local labels is very different. The way zero pages variables are declared and used, too.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: NESASM vs CC65

Post by tepples »

Bregalad wrote:NESASM [...] requires you to split your PRG-ROM in 8kb banks, even though many (most) cartridges configurations uses 16k or 32k banks.
That's because NESASM was derived from a TurboGrafx-16 assembler. Among mappers used in NES games, a bunch use the same 8 KiB banks as the TG16: MIMIC-1/Namco 108, MMC2, MMC3/MMC6, FME-7, and MMC5. But you're right that AOROM/BNROM, UNROM, and MMC1 are probably more common.
CC65 requires complex configuration scripts that are extremely annoying to use as a beginner (and also as a non-beginner).
Unless you have me make your ld65 scripts. My project template has an NROM script and a fixed-$C000 script that should work for UNROM or MMC1.
Bregalad wrote:It's long and tedious to convert assembly code from one assembler to another, however, a script or even a dedicated program could do that more rapidly if this was needed.
I made a Python script to translate the NESASM of Shiru's LAN Master to ca65 so that I could stuff Munchie Attack into unused space. It should be included in the source code pack distributed alongside STREEMERZ: Action 53 Function 16 Volume One.
zzo38
Posts: 1080
Joined: Mon Feb 07, 2011 12:46 pm

Re: NESASM vs CC65

Post by zzo38 »

Another thing about NESASM: It uses a nonstandard syntax. As already mentioned, < is used to indicate zero page instructions. Also, square brackets are used for indirect addressing instead of round brackets. (I prefer this nonstandard syntax, though.)

"Unofficial MagicKit" is a NESASM based assembler with many improvements and avoids many limitations (although the nonstandard syntax is still used). It is what I use (and prefer). This is a matter of opinion, really.
[url=gopher://zzo38computer.org/].[/url]
User avatar
Movax12
Posts: 529
Joined: Sun Jan 02, 2011 11:50 am

Re: NESASM vs CC65

Post by Movax12 »

At a high level (skipping the technical details), I would say the main difference is that ca65 and most other assemblers is that ca65 doesn't care about addresses. It can create completely portable object code for each module. In your ca65 source file you are not expected to specify addresses for code or data, and you shouldn't try. When linking and creating the final binary, your linker configuration file specifies where everything actually goes based on segments that were declared in your ca65 source file. This flexibility brings advantages, one being that you can organize code and data in a different way than it ends up in the final binary.

The linker config can be a bit odd to deal with, and there should be better documentation on how to use it, but it is very flexible.
User avatar
Light-Dark
Posts: 53
Joined: Sun Dec 08, 2013 9:53 pm
Location: Canada

Re: NESASM vs CC65

Post by Light-Dark »

I remember NESASM seeming decent at first when I started out and as I started making more complex things for the NES I found it buggy and irritating so much so that I switched to ASM6. It was definitely worth it.
Post Reply