I am creating this blog mostly as a means of logging my progress in a personal project of mine. The basic goal of the project is writing an NES emulator in java which I plan to release as open source. This is a fairly ambitious project. While I've been working as a professional developer for approximately 5 years, I don't know very much about emulation. Also, while I know a little bit about assembly programming, I'm hardly an expert. The majority of my programming experience has been with higher level languages. Couple these things with the fact that I don't know very much about NES architecture and it's plain to see that there's going to be a significant learning curve involved with this project.
This project came to my mind about five years ago. I was reading an article on slashdot. I think it was an Ask Slashdot article in which the writer was a new computer science graduate who had recently graduated and was kind of concerned about how much they didn't know about computer science. They mentioned that they had no idea how emulators worked. This resonated a lot with me. I was a new computer science guy myself who had just gotten hired to do java programming for a place in town. I was a little bit overwhelmed with my new position and like the guy in the article was kind of concerned about how much I didn't know about computer science. One of the guys in the article recommended looking at some open source emulators. This struck me as a great idea. I'm a java guy and I found an open source NES emulator written in java. I think it was called nesticle. I took a look at it, but not so much that I really understood it. There's a significant amount of knowledge that I don't have to truly understand the code. I might understand the general concepts behind what it's trying to do, but I don't understand the architecture it's trying to emulate. It became clear to me that if I wanted to understand what was going on I could either study this code or start writing my own emulator. I recently decided to do the latter. This is a bit foolhardy and definitely unnecessary, but it sounds fun to me right now.
I see this blog as a means of recording my progress and of connecting the project with the world. That said, I really doubt that anybody will be interested in my project. There exist NES emulators. As I've mentioned, there even exist java based NES emulators. Also, emulator guys are pretty talkative. There is tons of documentation concerning how to write emulators. Especially, it seems, NES emulators. The NES is historically significant architecture. It has been emulated again and again by anyone and everyone. My project isn't going to do anything new. It's just going to do it again largely as a personal learning project. This blog is going to record the day to day progress on the project. Maybe someone will come along who is also trying to learn more about programming or emulation and might be interested in what I'm doing. Toward that end, one of the things I'm planning on doing is keeping an extensive bibliography of the materials that I read in order to educate myself on the information necessary to get the project off the ground. That will probably be of more use to such a person than this blog and the associated code.
I wrote the very first lines of code for the project today. The portion that I have written now largely just opens up a zipped rom, searches for a .nes file, and reads that file. As I understand it, there are two main functions that an NES emulator has to do. The first is to load the rom, the second is to run the code pulled from the rom. Loading the rom is fairly easy. As it stands right now, the code looks for my test rom (super mario bros.), which is hard coded into the main class. I have not yet bothered to code an interface that will allow the user to pick a rom to load. Nor have I coded in support for roms that are not zipped. My test rom is zipped, so this is what I am sticking with for the time being.
There are several things on the agenda:
1. I have not ran my test rom in a known good emulator. Therefore, whether or not my rom is a good test case is questionable.
2. I want to find a decent and free code repository service so that I can store the code for other people to see it if they want.
3. so far as coding goes, I'm not storing the code that I am reading from the rom into anything yet. I'm actually just writing it to the console. My understanding is that I need to read the rom in a fixed increment. 16 bits maybe? All of the instructions are 16 bits, I think, but I'm not quite certain. Also, I'm not sure how the format of the rom is laid out. I am not certain which portions of the rom are sprites, which are instructions, and which are music. I know absolutely nothing about how the music is encoded. It ought to be pretty interesting to figure that out.
4. This blog is great for the day to day recording of my progress, I'm not sure it will fit the bibliography I want to write. We'll see.
Anyway, thanks for reading.
No comments:
Post a Comment