Difference between revisions of "ROM Addressing"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
There are several different ways to refer to data in memory in Zelda II. Which one you use depends on your reasoning for doing so. This page will explain where they're useful and how to translate between them. | There are several different ways to refer to data in memory in Zelda II. Which one you use depends on your reasoning for doing so. This page will explain where they're useful and how to translate between them. | ||
− | =Memory | + | =ROM File= |
+ | |||
+ | NES ROM files are in a format generally called iNES. Most ROMs (including Zelda 2 ROMs) are in [[https://wiki.nesdev.com/w/index.php/INES|iNES 1.0 format]]. The layout of a Zelda II ROM file is as follows (an [[https://wiki.nesdev.com/w/index.php/MMC1|MMC1]] cartridge with 8 PRG ROM banks, 16 CHR-ROM banks, and 4KB of SRAM -- for more details see [[https://datacrystal.romhacking.net/wiki/Zelda_II:_The_Adventure_of_Link|Data Crystal]]): | ||
+ | |||
+ | {| | ||
+ | !Type | ||
+ | !Number | ||
+ | !File Offset | ||
+ | !Size | ||
+ | |- | ||
+ | |iNES Header | ||
+ | | | ||
+ | |0x00000 | ||
+ | |16bytes (0x10) | ||
+ | |- | ||
+ | |PRG Bank | ||
+ | |[[PRG Bank 0|0]] | ||
+ | |0x00010 | ||
+ | |16KB (0x4000) | ||
+ | |- | ||
+ | | | ||
+ | |[[PRG Bank 1|1]] | ||
+ | |0x04010 | ||
+ | |16KB (0x4000) | ||
+ | |- | ||
+ | | | ||
+ | |[[PRG Bank 2|2]] | ||
+ | |0x08010 | ||
+ | |16KB (0x4000) | ||
+ | |- | ||
+ | | | ||
+ | |[[PRG Bank 3|3]] | ||
+ | |0x0C010 | ||
+ | |16KB (0x4000) | ||
+ | |- | ||
+ | | | ||
+ | |[[PRG Bank 4|4]] | ||
+ | |0x10010 | ||
+ | |16KB (0x4000) | ||
+ | |- | ||
+ | | | ||
+ | |[[PRG Bank 5|5]] | ||
+ | |0x14010 | ||
+ | |16KB (0x4000) | ||
+ | |- | ||
+ | | | ||
+ | |[[PRG Bank 6|6]] | ||
+ | |0x18010 | ||
+ | |16KB (0x4000) | ||
+ | |- | ||
+ | | | ||
+ | |[[PRG Bank 7|7]] | ||
+ | |0x1C010 | ||
+ | |16KB (0x4000) | ||
+ | |- | ||
+ | |CHR Bank | ||
+ | |[[CHR Bank 0|0]] | ||
+ | |0x20000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 1|1]] | ||
+ | |0x22000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 2|2]] | ||
+ | |0x24000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 3|3]] | ||
+ | |0x26000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 4|4]] | ||
+ | |0x28000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 5|5]] | ||
+ | |0x2a000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 6|6]] | ||
+ | |0x2c000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 7|7]] | ||
+ | |0x2e000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 8|8]] | ||
+ | |0x30000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 9|9]] | ||
+ | |0x32000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 10|10]] | ||
+ | |0x34000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 11|11]] | ||
+ | |0x36000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 12|12]] | ||
+ | |0x38000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 13|13]] | ||
+ | |0x3a000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 14|14]] | ||
+ | |0x3c000 | ||
+ | |8KB (0x2000) | ||
+ | |- | ||
+ | | | ||
+ | |[[CHR Bank 15|15]] | ||
+ | |0x3e000 | ||
+ | |8KB (0x2000) | ||
+ | |} | ||
+ | =Memory= | ||
+ | |||
+ | ==CPU Memory Map== | ||
+ | |||
+ | |||
==CPU Address== | ==CPU Address== | ||
==Bank And Offset== | ==Bank And Offset== | ||
− | |||
− | |||
=Converting= | =Converting= |
Revision as of 06:11, 15 April 2021
There are several different ways to refer to data in memory in Zelda II. Which one you use depends on your reasoning for doing so. This page will explain where they're useful and how to translate between them.
ROM File
NES ROM files are in a format generally called iNES. Most ROMs (including Zelda 2 ROMs) are in [1.0 format]. The layout of a Zelda II ROM file is as follows (an [[1]] cartridge with 8 PRG ROM banks, 16 CHR-ROM banks, and 4KB of SRAM -- for more details see [Crystal]):
Type | Number | File Offset | Size |
---|---|---|---|
iNES Header | 0x00000 | 16bytes (0x10) | |
PRG Bank | 0 | 0x00010 | 16KB (0x4000) |
1 | 0x04010 | 16KB (0x4000) | |
2 | 0x08010 | 16KB (0x4000) | |
3 | 0x0C010 | 16KB (0x4000) | |
4 | 0x10010 | 16KB (0x4000) | |
5 | 0x14010 | 16KB (0x4000) | |
6 | 0x18010 | 16KB (0x4000) | |
7 | 0x1C010 | 16KB (0x4000) | |
CHR Bank | 0 | 0x20000 | 8KB (0x2000) |
1 | 0x22000 | 8KB (0x2000) | |
2 | 0x24000 | 8KB (0x2000) | |
3 | 0x26000 | 8KB (0x2000) | |
4 | 0x28000 | 8KB (0x2000) | |
5 | 0x2a000 | 8KB (0x2000) | |
6 | 0x2c000 | 8KB (0x2000) | |
7 | 0x2e000 | 8KB (0x2000) | |
8 | 0x30000 | 8KB (0x2000) | |
9 | 0x32000 | 8KB (0x2000) | |
10 | 0x34000 | 8KB (0x2000) | |
11 | 0x36000 | 8KB (0x2000) | |
12 | 0x38000 | 8KB (0x2000) | |
13 | 0x3a000 | 8KB (0x2000) | |
14 | 0x3c000 | 8KB (0x2000) | |
15 | 0x3e000 | 8KB (0x2000) |