Mappers and .NES file layout
Moderator: Moderators
Mappers and .NES file layout
I'm working on a project using mappers, but I'm not sure exactly how I should set up the ROM file.. I know each mapper is different but are the .NES files always arranged the same way?
like for mapper #180 which has a fixed first bank (starting at $8000) and swappable 2nd bank (@ $c000), do I put the fixed bank first, then all of the banks which will be swapped, and then the CHR?
or for UNROM do I put all of the swappable banks first, then the fixed bank, then the chr? and MMC3 seems super complex
like for mapper #180 which has a fixed first bank (starting at $8000) and swappable 2nd bank (@ $c000), do I put the fixed bank first, then all of the banks which will be swapped, and then the CHR?
or for UNROM do I put all of the swappable banks first, then the fixed bank, then the chr? and MMC3 seems super complex
Try not to confuse the ROM layout of the iNES mapper and the layout of PRG/CHR ROM space in the NES' actual memory space.
iNES ROMs always have a 16-byte header, which tells you what follows: A (512-byte?) trainer, if ever (rarely) present, then 1 or more 16K ROM banks, followed by 0 or more CHR-ROM banks. If the CHR-ROM is set to 0, then the game uses CHR-RAM.
iNES ROMs always have a 16-byte header, which tells you what follows: A (512-byte?) trainer, if ever (rarely) present, then 1 or more 16K ROM banks, followed by 0 or more CHR-ROM banks. If the CHR-ROM is set to 0, then the game uses CHR-RAM.
yeah, i'm wondering the layout of the actual .NES files.ccovell wrote:Try not to confuse the ROM layout of the iNES mapper and the layout of PRG/CHR ROM space in the NES' actual memory space.
I know the NES ROM space is from $8000 to $FFFF and is usuallyk broken up into 2 banks at $C000
I just was wondering if there is a standard way or a document which tells the layout of the .NES file
i was thinking something like
- 10NES header
- 16k PRG-ROM bank1, can be swapped into $8000
- 16k PRG-ROM bank2, can be swapped into $8000
- 16k PRG-ROM bank3, can be swapped into $C000
- 16k PRG-ROM bank4, can be swapped into $C000
- 8k CHR-ROM
In the NES file, there is no such thing as a bank that "can be swapped into $XXXX". UNROM games, for example, have 128KB of RG-ROM, broken up into 8 16KB banks, but the "fixed bank" is defined by the mapper. The mapper makes the last 16KB bank visible at $C000-$FFFF at all times, but you can make this same bank visible at $8000-$BFFF as well. I don't know why you'd want that, but it's possible.
i just meant which banks in the NES file correspond to which banks that the mapper uses
here's the layout for UxROM (mapper 2) which i just used
- 10NES header
- 16k PRG-ROM banks 1-15 (Must be 1, 3, 7 or 15 banks) can be swapped into $8000.
- 16k PRG-ROM last bank , fixed at $C000
- 8k CHR-ROM
i was just wondering if there was a document which has this information. i found one which has it for most mappers and got what I wanted to do done, though it still would be nice to keep my options open
here's the layout for UxROM (mapper 2) which i just used
- 10NES header
- 16k PRG-ROM banks 1-15 (Must be 1, 3, 7 or 15 banks) can be swapped into $8000.
- 16k PRG-ROM last bank , fixed at $C000
- 8k CHR-ROM
i was just wondering if there was a document which has this information. i found one which has it for most mappers and got what I wanted to do done, though it still would be nice to keep my options open
- Hamtaro126
- Posts: 783
- Joined: Thu Jan 19, 2006 5:08 pm
Hey, It's Frantik!frantik wrote:i was just wondering if there was a document which has this information. i found one which has it for most mappers and got what I wanted to do done, though it still would be nice to keep my options open
If you want a list of mappers and it's list of capabilities, Try to go to RHDN and Download ''Disch's NES Mapper Docs'' in the documents section. I have kept it as a reference myself, too.
I will be gone for three days, Enjoy and Have Fun!
iNES layout is simple:
- $10 byte header
- optional $200 byte trainer (typically absent)
- X*$4000 PRG-ROM banks
- X*$2000 CHR-ROM banks
The number of PRG and CHR banks is indicated in the header, as well as whether or not the trainer exists.
Like tokumaru said ... there's no such thing as a bank which can/can't be swapped into X. The mapper simply uses the selected (swapped in) page number to fill in the high bits of the address when it reads from the ROM chip. Therefore:
If dealing with 16K PRG banks:
bank 0 = offset 0x00010-0x0400F
bank 1 = offset 0x04010-0x0800F
bank 2 = offset 0x08010-0x0C00F
... etc
Or if dealing with 8K PRG banks:
bank 0 = 0x00010 - 0x0200F
bank 1 = 0x02010 - 0x0400F
bank 2 = 0x04010 - 0x0600F
... etc
(note: offsets assume no trainer)
CHR works the same way.
Any bank can be swapped to anywhere, the mapper doesn't care (with a few rare exceptions which are always noted in documentation)
- $10 byte header
- optional $200 byte trainer (typically absent)
- X*$4000 PRG-ROM banks
- X*$2000 CHR-ROM banks
The number of PRG and CHR banks is indicated in the header, as well as whether or not the trainer exists.
Like tokumaru said ... there's no such thing as a bank which can/can't be swapped into X. The mapper simply uses the selected (swapped in) page number to fill in the high bits of the address when it reads from the ROM chip. Therefore:
If dealing with 16K PRG banks:
bank 0 = offset 0x00010-0x0400F
bank 1 = offset 0x04010-0x0800F
bank 2 = offset 0x08010-0x0C00F
... etc
Or if dealing with 8K PRG banks:
bank 0 = 0x00010 - 0x0200F
bank 1 = 0x02010 - 0x0400F
bank 2 = 0x04010 - 0x0600F
... etc
(note: offsets assume no trainer)
CHR works the same way.
Any bank can be swapped to anywhere, the mapper doesn't care (with a few rare exceptions which are always noted in documentation)
ok, i think i understand more. for most mappers, any bank can be swapped into the swappable bank area
that still leaves the 'fixed banks' though.. are those in the same place for each mapper? this is not in most mapper documentations i've found, even your crazy comprehensive list Disch (or at least not for mmc3).
but it's ok cause i got unrom working
(and i'm handling the bus conflicts dont worry
)
that still leaves the 'fixed banks' though.. are those in the same place for each mapper? this is not in most mapper documentations i've found, even your crazy comprehensive list Disch (or at least not for mmc3).
but it's ok cause i got unrom working
Banks fixed to $C000-$FFFF are usually the highest numbered bank, so they appear last in the PRG chip. Banks fixed to $8000-$BFFF are usually the lowest numbered bank, so they appear first in the PRG chip. There are a few exceptions, like that mapper used for pirate SMB2j that puts 8 KiB PRG banks 4, 5, 6, and 7 into $8000, $A000, $6000, and $E000 instead of the expected $8000, $A000, $C000, and $E000.
Last edited by tepples on Fri Mar 06, 2009 1:21 pm, edited 1 time in total.
I figured it was easier to put explanations for all the shorthand in one doc rather than making every doc overly wordy (they're already pretty wordy). But the problem with that approach seems to be that nobody reads the main readme ;_;.
__READ THIS FIRST__.txt wrote:Numbers surrounded by {curly braces} mean the page is fixed. Here, $E000-FFFF is fixed to page -1. Negative pages indicate the last pages are used. IE: "-1" means to use the last page of PRG, "-2" would be the second last, etc.