This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

NESASM (Incorrect addressing mode!)

NESASM (Incorrect addressing mode!)
by on (#55335)
i'm getting an error when i try assembling this.. i'm using nesasm3
  LDX #$01
  LDA $04,X
  EOR $F9,X
  AND $04,X
  STA $F5,X
  STY $F1,X
  STY $F9,X

i get the message "Incorrect addressing mode!" for both ( STY $F1,X ) and ( STY $F9,X ).. anyone know why?

by on (#55339)
I believe NESASM has some problems with ZP addressing. Even if you use just 2 digits for the address it uses absolute addressing, and since STY doesn't have an absolute indexed mode it throws an error. I think you have to use a "<" before the address so it uses ZP addressing.

by on (#55340)
that fixed the problem! :)
is their a list of bugs laying around?.. or a doc that better explains how its used? thanks for the help

by on (#55355)
Wanna solve the problem? Don't use NESASM... =)

by on (#55369)
One other thing to watch out for is the use of indirect addressing with NESASM. You need to use [] brackets instead of () paranthesis.

by on (#55370)
Wasn't there something about lines that were too long?

One thing that scares me is that there were times when people had problems with NESASM and it turned out that it was outputting broken code instead of throwing errors, something that makes bugs nearly impossible to catch unless you use an emulator to trace the disassembly, but even then you don't really know where to start looking.

by on (#55371)
tokumaru wrote:
Wasn't there something about lines that were too long?

Yes, this is a known problem with the "stable" build of NESASM. I couldn't ever get the development/current build to assemble anything (it'd just segfault/crash).

by on (#55377)
There have been quite a few threads over the years about NESASM's many problems. Issues like this one lead to quite a few programs never using zeropage addressing mode (ever). I usually recommend using a different assembler, now I'd recommend ASM6 because it is fully featured and easy to start with. You'll just have to rip an iNES header from somewhere or make one with .ORG $7FF0 followed by your 16-byte header.

ASM6 will assemble code that you can easily turn around and use in another assembler like CA65 and DASM, which IMHO are kind of the standards for 6502 assemblers. Local labels are the main area of incompatibility though.

NESASM used to segfault/crash for me too, but for me I thought it was the oldest version and not the newer ones. Weird. Too often it would crash if I made an error/typo in the source code being assembled (!!).

by on (#55382)
Doppel once made me a nice asm6 template: heres prety much a complete set up dev enviroment for it. :-)

[You can include a space in a URL by replacing it with %20 -- MOD]

by on (#55386)
thanks everyone for all the help :)
i'll give ASM6 a shot! it's nice that it's open source
before i get to work...does it have any known bugs? sorry i can't help but be a little paranoid lol nesasm was crazy :)

by on (#55387)
jims cool wrote:
does it have any known bugs?

The few ones I bumped into were already fixed by the author (loopy). If you find anything wrong you can report it to him, he usually fixes bugs very quickly! =)

by on (#55396)
thanks tokumaru :D

by on (#55562)
:) I like useing NESASM ,but have the same problem like STY $00,X,zero page mode: STA $00, must this format:STA <$00,I use NESASM Version 3.0,also have these BUGS,CA65 is very good! :D ,
What about NESHLA(NES High Level Assembler ),Open Source, too,you could find it on sourceforge:

by on (#55572)
I like to use WLA-DX. Some people don't quite like it, but it was what I learned to use after NESASM, so I found it to be a huge improvement. If the setup is too much of a hassle for you to be interested, in the Newbie Help Center sticky there's a link to a simple NROM setup I've created so that you can just start coding with it right away. Just in case you're curious. But I hear CA65 is awesome, and I also hear good things about ASM6. However, I have not used these assemblers, so I can't say anything about them.

by on (#55599)
i'm starting to like asm6 :) it's simple like nesasm but way better and open source no bugs that i've found

by on (#55613)
Yeah, the simplicity is great. I'm probably either lazy or dumb for not being able to handle the configuration needed by the "professional" assemblers, so I really like the fact that I can just start typing any program from scratch using ASM6 without having to worry about mappers, segments and whatever before writing a single line of code.

by on (#55614)
I don't think it because you're dumb or something, ca65 as a steep learning curve from the get go. It was hell at the beginning but now I'm happy that I made the choice. There is a lot of interesting features that I cannot get from other assembler (I think) and I like them (scope for variable, struct for defining memory location, enums, define scope a and assign existing memory location to it to make it more like myManager::myFunction etc.).

But like I mentioned before, there is no better assembler as long as the one you're using does the job. The hardest part is to get used to your new tool. I'm sure after using it a little bit I would be fine with asm6 too. Maybe this could be useful for quick test without the need to configure the memory map for ca65 (but you can always make a template for your test code and just copy it to a new folder when you need it).

And sometime there is a workaround if you really like the tool that much by avoiding the bug or something. Battle kid, Splash! were made with nesasm so it's possible to use it to make a complete game if you really want to. It's all depends how you like the tool.

by on (#55615)
CA65 isn't that bad. As I see it, it abstracts the process of "where your code goes" into a nice neat config file. With most assemblers, you must set the program counter or pad in numerous places. In CA65, your config file specifies memory areas and segments, with starting addresses (the program counter) and whether to fill to the specified size. It's really the same thing, only now your source code just fills segments specified by your config file. So, if you understand a normal assembler, there's really nothing stopping you from using CA65. It took me maybe an afternoon of hair pulling, now it is my favorite assembler.

by on (#55621)
the only feature i would add to asm6 is a chr and prg label with a command line argument that makes it output the chr and prg files without changing anything :)

;header stuff

;prg stuff here

;chr stuff here

so for a .nes file you would assemble it with "asm6 main.asm rom.nes"
and if you want it in two files something like "asm6 split main.asm rom.nes"
output would be "rom.nes.prg" "rom.nes.chr"

even thats pointless tho.. you could have main.asm then prg.asm and chr.asm