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

Beginner Errors

Beginner Errors
by on (#58077)
Hello,
As you can see on my signature, I'm a very experienced Assembly developer, but as every beginner on a Assembly language, we can do some mistakes, then I've written this to test if the compiler works(nesasm):
Code:
.bank 0
.org $8000

ldx #$01
stx #200

But when I was compiling I've got some errors:
Code:
ubuntu@eeepc-laptop:~/dev/nes-learning$ nesasm test.asm
NES Assembler (v3.01)

pass 1
#[1]   test.asm
    1  00:E000            .bank  0
       Local symbol not allowed here!
    2  00:E000            .org $8000
       Local symbol not allowed here!
    4  00:E000            ldx #$01
       Unknown instruction!
    5  00:E000            stx $200
       Unknown instruction!
# 4 error(s)
ubuntu@eeepc-laptop:~/Desktop/nesasmsrc/nesasmsrc/source$

Someone can help me?

Best Regards,
Nathan Paulino Campos

by on (#58078)
I think the lines may need to be indented.

by on (#58079)
What Dwedit means is that some assemblers require a space at the start of the line before every instruction, so as not to confuse labels with instructions.

You can't store immediate ('stx #'); that operation makes no sense.

by on (#58081)
Now when I emulate the ROM file on nesterJ I got a saying this:
Code:
Error Reading ROM Banks


What I need to do?

PS: Nice to see you here too Dwedit, also tepples I think I already saw you on other forum... Did you remember me?

by on (#58098)
You probably need to tell the assembler to set up the iNES header (first 16 bytes of the ROM file) properly when generating the .ROM file, or you get to make one yourself.

Also, why are you using nesterJ? Good grief. Use Nestopia or Nintendulator.

by on (#58116)
Now my code is like this and I still got the same error:
Code:
  .inesprg 1
  .inesmap 0
  .inesmir 0
  .ineschr 0

  .bank  0
  .org $8000

  LDX #$01
  STX $200


Also, I'm going to download another emulator as your suggestion. :)

by on (#58133)
Okay, so you're using mapper 0, which requires at least 1 PRG bank (16KBytes in size) and one CHR bank (8KBytes in size):

http://wiki.nesdev.com/w/index.php/NROM (be sure to see the bottom of the page too).

Yet, in your directives you're stating 0 CHR banks, which obviously won't work.

If you're not using any CHR data, then you should append an 8192 byte file of zeros that represents your CHR bank and use .ineschr 1.

You should also consider not using NESASM. Try asm6 instead. ;-)

by on (#58139)
koitsu wrote:
You should also consider not using NESASM. Try asm6 instead. ;-)

If you are interested, I just posted a couple of ASM6 templates you can use.

by on (#58148)
koitsu wrote:
Okay, so you're using mapper 0, which requires at least 1 PRG bank (16KBytes in size) and one CHR bank (8KBytes in size):

http://wiki.nesdev.com/w/index.php/NROM (be sure to see the bottom of the page too).

Yet, in your directives you're stating 0 CHR banks, which obviously won't work.

If you're not using any CHR data, then you should append an 8192 byte file of zeros that represents your CHR bank and use .ineschr 1.

You should also consider not using NESASM. Try asm6 instead. ;-)

I thought setting 0 CHR banks was just how you specify that you're using CHR-RAM rather than CHR-ROM.

by on (#58160)
Technically you could have a cart with no mapper (mapper 0) and CHR-RAM, but since Nintendo never manufactured one of those, some emulators will refuse to run ROMs with that configuration, which is wrong IMO. If you want to keep it simple and use CHR-RAM maybe you should try UNROM (mapper 2). Some emulators will complain if you have less than 8 banks (128KB), but some will accept 2 or 4.

by on (#58166)
tokumaru wrote:
Technically you could have a cart with no mapper (mapper 0) and CHR-RAM, but since Nintendo never manufactured one of those, some emulators will refuse to run ROMs with that configuration

Nintendo never manufactured a game with the Color Dreams or Camerica mapper, instead preferring GNROM or UNROM, yet emulators take them just fine ;-)

(By "Nintendo" you meant "makers of commercial games".)

Quote:
If you want to keep it simple and use CHR-RAM maybe you should try UNROM (mapper 2).

That would work for 16 KiB PRG. But once you go up to 32 KiB PRG, executing from $8000-$BFFF before setting up the mapper results in undefined behavior. There are two solutions: either make sure your entry point is in $C000-$FFFF and initializes the mapper, or switch to BNROM (mapper 34) or CPROM (mapper 13).

by on (#58169)
tepples wrote:
That would work for 16 KiB PRG. But once you go up to 32 KiB PRG, executing from $8000-$BFFF before setting up the mapper results in undefined behavior.

I didn't mean he could simply change the mapper number, of course he'd have to put the reset code above $C000 and properly map the first bank to $8000-$BFFF if using 32KB of PRG-ROM, something that would take 2 lines of code.