My recent experience with ca65, asm6, nesasm, and wla-dx

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

User avatar
Banshaku
Posts: 2417
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Post by Banshaku »

@Blargg:

I didn't say that they're evil per se: I'm just biased because I never used them. If used and documented properly, it should have it place I guess. But I saw some example in the past with no documentation and abuse of them (up to 5 or 6 +) so you can see that it can get quite messy in the hands of, I would guess, beginners. So I would not add them in my "coding practices" for beginners.

Nesasm:

As for nesasm popularity, my only guess would be from a "mental image" of it. If you want a "nes assembler", when you see the name "nesasm" then it seems to be the right tool for the job for someone looking for the first time for an assembler, isn't it? That's how I feel about it. I could be wrong thought.
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Post by Bregalad »



As for nesasm popularity, my only guess would be from a "mental image" of it. If you want a "nes assembler", when you see the name "nesasm" then it seems to be the right tool for the job for someone looking for the first time for an assembler, isn't it? That's how I feel about it. I could be wrong thought.
Exactly, that's why I did back when I was a noob.


I didn't say that they're evil per se: I'm just biased because I never used them. If used and documented properly, it should have it place I guess. But I saw some example in the past with no documentation and abuse of them (up to 5 or 6 +) so you can see that it can get quite messy in the hands of, I would guess, beginners. So I would not add them in my "coding practices" for beginners.
I rarely, if ever, use more than 2 + or -, however I use these all the time. You can't imagine how I has happy after quiting Nesasm to not have to find labels for every little damn thing any longer.
A .png to .chr converter that can handle sizes less than full banks allows this easily.
True, however I just like to have "full" CHR banks of a 2^n size in .chr files (as opposed to a small set of tiles).
Something that ld65 handles easily with its load and run addresses.
This sounds really great. Same that other assemblers lacks this - especially considering that loading code from ROM to RAM is common.
Useless, lumbering half-wits don't scare us.
Drag
Posts: 1615
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Post by Drag »

For those of you talking about how good/bad anonymous labels are, let me share my labeling convention.

Code: Select all

[game.asm]

game_init
  jsr game_loadlevel
game_main
  [...]
  jsr system_wait_vblank
  [...]
  jmp game_main

game_loadlevel
  [...]            ;Initialize some variables
game_loadlevel_loop
  [...]            ;Read a pointer or something
game_loadlevel_loop_getchunk
  [...]            ;Copy a block of bytes to ram
  bne game_loadlevel_loop_getchunk
  [...]            ;Process them somehow
  bne game_loadlevel_loop
  rts

[system.asm]

system_wait_vblank
  [...]            ;Check a variable that my NMI routine sets when vblank occurs
  beq system_wait_vblank
  [...]            ;Reset the aforementioned variable
  rts
This is how all of my labels look. They might be wordy, but at least you know exactly what each label is for, and I rarely ever have any problems with duplicate labels, or running out of names for labels. :P

Plus, if you ever start having trouble coming up with label names (too many labels), perhaps you need to revise your code's structure? :P
User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg »

Verbose labels obscure the relevant information of what the code is doing. More noise, less signal = less readability = most cost to maintain. Being able to use local @symbols and +/- unnamed labels is what the assembler is for, to allow more concise expression of things, to do the tedious work so you don't have to (in this case, your eyes having to wade through increased noise).
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

There are several instances where I don't feel the need to name labels. Now that I think of it, this usually happens with labels used to simulate FOR, IF, and other commands present in high-level languages. You don't really need labels to identify these structures.
Wave
Posts: 110
Joined: Mon Nov 16, 2009 5:59 am

Post by Wave »

tokumaru wrote:There are several instances where I don't feel the need to name labels. Now that I think of it, this usually happens with labels used to simulate FOR, IF, and other commands present in high-level languages. You don't really need labels to identify these structures.
That's one reason why I use NESHLA, avoiding creation of such labels.
User avatar
Hamtaro126
Posts: 818
Joined: Thu Jan 19, 2006 5:08 pm

Post by Hamtaro126 »

Memblers wrote:Yeah, the only notable complaint I've had with CA65/CC65 is the anonymous label syntax. I do remember there being a discussion about on the CC65 email list many years ago, not sure what the conclusion was, but maybe there's some insight there if it's available for searching. x816 seemed like a pretty good assembler, I can't use anymore though without using DOSBox. I mostly used it for my SNES 2A03 emulator, so it has to be assembled in DOSBox if I rebuild it anymore, heheh. Nerdtracker 2 used it originally (later I changed Bananmos' old code to assemble in CA65)
About the SNES side: CA65 also supports 65816. But CC65 (C compiler) is very limited/incomplete for that CPU. also, DA65 does not support the 65816 yet!

I tried using DOSBox on X816, Does not work, When assembling something with X816 in a DOSBox, It Stops Forever until exiting!

This is why I use CA65 and sometimes ASM6
AKA SmilyMZX/AtariHacker.
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers »

Yeah, I'd heard the C compiler is mostly geared for 6502.

x816 should work with DOSBox because I've definitely used it (it took a long time assemble the NSF player, which was funny to watch). Maybe it uses a DOS 32-bit extender .exe that wasn't in your path when you ran it? I guess it would've said so, though.

ASM6 sorta reminds me of the x816 (for 6502) in some ways, I guess because it's simple and effective.
darkhog
Posts: 192
Joined: Tue Jun 28, 2011 2:39 pm

Re: My recent experience with ca65, asm6, nesasm, and wla-dx

Post by darkhog »

blargg wrote:- Can't switch segments as in ca65, so order of things in file must match output (as far as I can tell).
Sorry about digging up such old thread, but as far as I'm concerned, I'd consider it as a plus of ASM6 - it makes debugging more straightforward and you can know where you made a mistake if assembly file closely resembles ROM in structure. And if you want modularity, you can always .include files that deal with different stuff.
User avatar
Banshaku
Posts: 2417
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: My recent experience with ca65, asm6, nesasm, and wla-dx

Post by Banshaku »

For quick sample it may be but for managing bigger projects ca65 is a must. As for order, it doesn't matter much and it become easier to manage with experience ;)
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: My recent experience with ca65, asm6, nesasm, and wla-dx

Post by tokumaru »

I too prefer to organize my source code sequentially. Even when using ca65 I don't switch segments all the time, I basically switch once to each bank, in order, and .include all the code/data that's supposed to be there. That doesn't mean that the OPTION of having the assembler do some organization on its own is a bad thing.

Unfortunately, the one time I really needed ca65 to let me shuffle segments around, it couldn't do what I wanted, which was to automatically right-align arbitrarily sized chunks of ROM. You have to either use constant sizes or stich the binaries afterwards.

I like how straightforward ASM6 is, and how versatile it is because it allows all kinds of expressions with all kinds of symbols, even in directives that affect the amount of generated code, such as IF, REPT and ORG. I still think ca65 is cool, but there are a lot of annoyances and limitations that arise from the fact it's single-pass and the mysterious ways in which macros are implemented.

Unfortunately, ASM6 lacks some things that are extremely useful in larger projects, such as any means to keep track of the memory banks each label belongs to. Another extremely annoying thing in ASM6 is how its anonymous labels break the scope of local labels, effectively making it impossible to use both in the same subroutine.
Drakim
Posts: 97
Joined: Mon Apr 04, 2016 3:19 am

Re: My recent experience with ca65, asm6, nesasm, and wla-dx

Post by Drakim »

tokumaru wrote:Another extremely annoying thing in ASM6 is how its anonymous labels break the scope of local labels, effectively making it impossible to use both in the same subroutine.
I always found this extremely strange and bizarre, to the point of seeing it as a bug.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: My recent experience with ca65, asm6, nesasm, and wla-dx

Post by tokumaru »

Yeah, forcing users to choose between nameless and local labels doesn't seem like an intentional design choice, but who knows? I haven't seen anyone being bothered by this over the years besides me...
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re:

Post by gauauu »

Memblers wrote: I used DASM before, I left it then because it didn't have incbin (it does now though), it seemed good but I was a newb at the time and wasn't using macros or any kind of fancy stuff yet. If it's got good macro support (I don't remember), it should be just fine.
It depends on what you want out of the macros, but they're decent. Maybe not as big and magical and complex as ca65, but they're not terrible.
Post Reply