I decided to work on an NES emulator to understand hardware better, but it's not working right.
I think it has to do with some misunderstanding I have with mappers. I'm using cpu_dummy_reads.nes as my test rom. My loading process; I read the ROM, read the 16 byte header, the (in this case) 32767 bit long program, the CHR, and I do nothing with the rest of the file because I've reached the end of it.
Because I'm using C#, I decided to be lazy and just have one 64 KB byte[0xFFFF] as all readable memory. I load my PRG into 0x8000 to 0xFFFF and set my program counter to 0x8000 (The addresses that mapper five says the PRG should go). I hit the run button and expect to start programming some opcodes. The opcodes are invalid, though. I'm running into 24576 empty opcodes (00), on top of some other strange things.
I also tried with donkey kong and I get some other problem with reading invalid opcodes.
Source https://pastebin.com/sCVFPcuY
And if I look at the actual hex data for cpu_dummy_reads.nes, after the header there are tons of 00's. I'm pointing my emulator to this code to start executing right off. Is this right?
I think it has to do with some misunderstanding I have with mappers. I'm using cpu_dummy_reads.nes as my test rom. My loading process; I read the ROM, read the 16 byte header, the (in this case) 32767 bit long program, the CHR, and I do nothing with the rest of the file because I've reached the end of it.
Because I'm using C#, I decided to be lazy and just have one 64 KB byte[0xFFFF] as all readable memory. I load my PRG into 0x8000 to 0xFFFF and set my program counter to 0x8000 (The addresses that mapper five says the PRG should go). I hit the run button and expect to start programming some opcodes. The opcodes are invalid, though. I'm running into 24576 empty opcodes (00), on top of some other strange things.
I also tried with donkey kong and I get some other problem with reading invalid opcodes.
Source https://pastebin.com/sCVFPcuY
And if I look at the actual hex data for cpu_dummy_reads.nes, after the header there are tons of 00's. I'm pointing my emulator to this code to start executing right off. Is this right?