Page 1 of 1

NESASM vs CC65

Posted: Wed Aug 13, 2014 9:00 am
by mattheweston
What are the fundamental differences between these two assemblers ?

Re: NESASM vs CC65

Posted: Wed Aug 13, 2014 9:11 am
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.

Re: NESASM vs CC65

Posted: Wed Aug 13, 2014 9:25 am
by mattheweston
Should the assembly code be about the same assuming the use of ca65 instead of cc65?

Re: NESASM vs CC65

Posted: Wed Aug 13, 2014 9:28 am
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.

Re: NESASM vs CC65

Posted: Wed Aug 13, 2014 10:03 am
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.

Re: NESASM vs CC65

Posted: Wed Aug 13, 2014 11:02 am
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.

Re: NESASM vs CC65

Posted: Wed Aug 13, 2014 2:12 pm
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.

Re: NESASM vs CC65

Posted: Fri Aug 15, 2014 8:32 pm
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.