Monday, August 23, 2010

Read up a little bit on the INES format, but haven't done a whole lot of the implementation of that. I did, however, download a hexeditor so I could look at my test rom to see what was actually in there and downloaded a known good NES emulator to test the rom. I used Nestopia. The rom seems to work well. I played through to about world 2-3. Those damn jumping fish.

I fixed a few small bugs. I initially was using ZipInputStream.read(). This was loading only the first 500 bytes or so for whatever reason even if I set the read size to the entire size of the file. Rather than inspecting why that was I switched over to using ZipEntry to read the file and am now getting an InputStream via ZipFile.getInputStream. Using InputStream.read appears to be loading the entire file. This is a better design and works, so I'm not curious as to why ZipInputStream did not work.

My test rom contains 40976 bytes. This is a little interesting. The NES itself has 32k of program memory and 8k of character memory. This maps directly to the super mario bros rom, which has 32k of program code and 8k of character code. The additional 16 bytes unaccounted for are the ines file header.

Some of the other roms have additional memory built into them which need to be emulated for the emulator to run them, but I don't plan on implementing that feature right now. If I get the NES running with this standard rom I'll consider new features.

Now that I'm reading the entire file I need to work on supporting the INES file format. This means separating out the header from the program code from the character code. Then I can start work on emulating the CPU. I expect this blog will be a bit more interesting once I start writing the actual emulation. Right now I'm still doing the formative work, which isn't all that interesting.

No comments:

Post a Comment