NESASM incbin placement in ROM file

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
swee
Posts: 2
Joined: Sun Dec 10, 2017 9:01 am

NESASM incbin placement in ROM file

Post by swee »

I'm trying to understand why NESASM is placing my .incbin file at $0524 in ROM file when the i want it to place at $8514 ?
The only code im compileing is:

Code: Select all

  .inesprg 8   ; 8x 16KB PRG code
  .ineschr 0   ; 1x  8KB CHR data
  .inesmap 0   ; mapper 0 = NROM, no bank swapping
  .inesmir 0   ; background mirroring
  
  .bank 0
  .org $8514
  .incbin "noheader.nsf"
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: NESASM incbin placement in ROM file

Post by lidnariq »

NESASM forces you to use 8 KiB banks.
ORG only lets you set the address within that bank (as well as the nominal memory address that will be used when it's referred to later)
NES files have a sixteen byte header.

($8514) & $1FFF = $0514
$0514 + 16 = $0524.

Also, you are going to have a bad time trying to stuff a bigger-than-32KiB NSF inside a ROM. Just use rainwarrior's eznsf tool instead.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: NESASM incbin placement in ROM file

Post by tokumaru »

ROM begins at $8000, so the contents of file offset $0524 will indeed be loaded at CPU address $8514, after you take the 16-byte ($10 in hex) iNES header into account.

But yeah, I don't know if NESASM's 8KB banks limitation will let you .incbin a file larger than that.
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: NESASM incbin placement in ROM file

Post by zzo38 »

tokumaru wrote:But yeah, I don't know if NESASM's 8KB banks limitation will let you .incbin a file larger than that.
I believe it will; incbin is the only exception to that limitation.
(Free Hero Mesh - FOSS puzzle game engine)
Post Reply