Page 1 of 1

Beginner Errors

Posted: Fri Mar 12, 2010 5:24 pm
by nathanpc
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: Select all

.bank 0
.org $8000

ldx #$01
stx #200
But when I was compiling I've got some errors:

Code: Select all

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

Posted: Fri Mar 12, 2010 5:54 pm
by Dwedit
I think the lines may need to be indented.

Posted: Fri Mar 12, 2010 5:54 pm
by tepples
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.

Posted: Fri Mar 12, 2010 6:08 pm
by nathanpc
Now when I emulate the ROM file on nesterJ I got a saying this:

Code: Select all

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?

Posted: Sat Mar 13, 2010 2:19 am
by koitsu
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.

Posted: Sat Mar 13, 2010 6:30 am
by nathanpc
Now my code is like this and I still got the same error:

Code: Select all

  .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. :)

Posted: Sat Mar 13, 2010 10:49 am
by koitsu
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. ;-)

Posted: Sat Mar 13, 2010 12:04 pm
by tokumaru
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.

Posted: Sat Mar 13, 2010 3:21 pm
by Drag
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.

Posted: Sat Mar 13, 2010 4:52 pm
by tokumaru
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.

Posted: Sat Mar 13, 2010 5:15 pm
by tepples
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".)
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).

Posted: Sat Mar 13, 2010 5:46 pm
by tokumaru
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.