Hello there, first time posting here and first time working with the nes, so sorry in advance if this has been asked before as I wasnt able to find a post.
I am currently writing an NES emulator in verilog to be synthesized for an FPGA. And I am running into some issues understanding where the PRG and CHR ROM would be located if I was loading a ROM block with the data from a .nes file. (I'm only talking about NROM due to it's simplicity at the moment)
As I understand it, the NROM cartridge (aka mapper 0) contains 16 bytes of header data followed by 16384 bytes of PRG ROM (assuming there isn't a trainer.) In the actual NES this ROM would be mapped to $C000 to $FFFF and consequently mirrored to $8000 to $BFFF. Knowing this I think I should be able to read the .nes file and locate the end of the PRG ROM and consequently find the $FFFC/D reset vector for the 6502.
The ROM I used to test so far was the nestest.nes file from the nesdev wiki
So by some simple arithmetic I found what I think is the Reset Vector at byte $400C/D inside the .nes file. Following the vector to address location $C004,
I go to byte $0014 in the .nes file. finding the instruction #78 which is the opcode for SEI, so it appears that my assumption is correct for this file. Additionally I did the same with donkey kong as well and it would seem that the address at the reset vector leads me to $07AE which has again the instruction #78.
Now my question is this, have I made any mistaken assumptions regarding the organization of the format? if not, is the CHR rom just the next 2k bytes from the $400F in the file?
Additionally, are all NROM-mapped roms organized the same way?
Thanks in advance to anybody who can lend an answer.
I am currently writing an NES emulator in verilog to be synthesized for an FPGA. And I am running into some issues understanding where the PRG and CHR ROM would be located if I was loading a ROM block with the data from a .nes file. (I'm only talking about NROM due to it's simplicity at the moment)
As I understand it, the NROM cartridge (aka mapper 0) contains 16 bytes of header data followed by 16384 bytes of PRG ROM (assuming there isn't a trainer.) In the actual NES this ROM would be mapped to $C000 to $FFFF and consequently mirrored to $8000 to $BFFF. Knowing this I think I should be able to read the .nes file and locate the end of the PRG ROM and consequently find the $FFFC/D reset vector for the 6502.
The ROM I used to test so far was the nestest.nes file from the nesdev wiki
So by some simple arithmetic I found what I think is the Reset Vector at byte $400C/D inside the .nes file. Following the vector to address location $C004,
I go to byte $0014 in the .nes file. finding the instruction #78 which is the opcode for SEI, so it appears that my assumption is correct for this file. Additionally I did the same with donkey kong as well and it would seem that the address at the reset vector leads me to $07AE which has again the instruction #78.
Now my question is this, have I made any mistaken assumptions regarding the organization of the format? if not, is the CHR rom just the next 2k bytes from the $400F in the file?
Additionally, are all NROM-mapped roms organized the same way?
Thanks in advance to anybody who can lend an answer.