Friday 27 March 2015

Creating a NES Emulator From Scratch Part 2.25: CPU Code: Actual Progress Update


This is a project update, not a research log. I will be posting a blog entry explaining everything I have learned in detail in coming weeks. I don't have time right now (due to school) to study for exams, write the emulator, and summarize, edit and post all my research at the same time. But it will be up, and if you don't understand everything on this post, you will once you read that one. Stay tuned!

I posted a few weeks ago saying that I had rebooted the project and in fact I have. I'm close to having CPU emulation working. Here is a rundown of what I have done over the last few weeks:
 
  • I'm calling the project "ALIAneS" because emulator names are weird and have strange capitalization like that
  • I had to re-research everything again because I hadn't made any real notes the first time that I looked into the project way back in August. Focusing mostly on CPU I learned a lot more about the NES file format and CPU memory addressing methods than I remember learning about before. So taking notes would have been good, but looking at it again with more knowledge of programming helped.
  • Began coding basic frameworks for the CPU. I'm splitting the class files into System, CPU, Cartridge, PPU, and APU, as well as having headers for all of those of course. Only the first three of these are actually written as PPU and APU are secondary goals of mine for this project.
  • Wrote functions for setting and getting all values of registers as well as memory, given a location.
  • Coded the startup sequence of actions outlined on NesDev into the emulator init function
  • Got the cartridge loading methods done: right now this emulator will load a 8K or 16K PRG-ROM cartridge only; I have not (and will not for a while) support any mappers, as they are a tertiary goal.
  • Working currently on opcode decoding..

That last one, opcode decoding is taking the longest time. Luckily the binary of the byte that makes up an opcode can be parsed to more efficiently determine the operation and the addressing mode.
This is the last step in CPU emulation as far as I know, other than to implement memory mirroring functions for the RAM, which I haven't done yet for some reason.

That’s it for now. All source code on GitHub! See you again after exams are done!

No comments:

Post a Comment