More Ramblings from a Los Angeles Programmer

February 20, 2007

Update on NES Emulator

Filed under: coding, technology — Tags: — Josh DeWald @ 6:20 pm

I went 2 or 3 weeks without doing much on the emulator, but the time I have spent has been modestly productive. It’s that type of productivity though where I’ve spent most of the time within single methods fixing bugs and optimizing. I have the Name/Attribute Table mirroring working mostly. I literally swapped a value and suddenly Mario began looking significantly better. There were actually quite a bit of other code changes (which allowed screen scrolling to work properly) but I had the mirroring wrong which made the wrong sprites show up most of the time.

Oddly, “fixing” the mirroring made it so that Metal Gear doesn’t work properly, so I need to look into that. I believe that I’ve done Vertical mirroring incorrectly, but I actually suspect some other logic that determines what memory address to look for objects at.

I’ve fully redone the way that the internal rendering works. Using the documentation available, I’ve made it much closer to how the real PPU functions in loading the addresses from the latches at the start of screen rendering while also allowing some bits to be modified *during* rendering. This is actually what makes scrolling work. The downside is that it makes the logic a bit harder to understand because previously I did a more human-readable version of the logic but it was also more naive. I’d like to find a compromise between “here’s what’s happening” while allowing for mid-rendering writes.

Anyhow, here are some new screenshots:

mario demo 1mario demo 2

Again, there are definite flaws in it (what’s up with the green shading in the middle?) but I think it’s a significant improvement from the previous version. I still haven’t fixed the “bottom pixel” issue ont he sprites which is why there are lines running through them. That’s also why the bottom is cut off from the top status bar (which I only got working yesterday by properly implementing the “Sprite 0” detection which I previously had a completely naive version of). I also did a quick fix to get the transparent pixels working.

I’m not sure when I should move onto sound… I’m getting a little anxious but feel that I should probably get Mario actually playing! For some reason it won’t actually start. Bot Pacman and Metal Gear will start once I hit the START key, but I cannot get Super Mario Brothers to leave the demo mode. Very strange.

I played a full game of Othello last night against the computer, I think I beat it but it was a close game!

As before, want to do a shoutout. There is a good compendium of available documentation that’s been made into a nice color PDF available at from parodius written by Patrick Diskin. I think they also have emulators that actually work 🙂 In addition to NES-specific docs, it has a great introduction to how the 6502 functions which probably would ahve been useful when I was writing the core.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: