Tuesday, August 23, 2016

Atari vs NES

It's really interesting to me the differences and similarities between Atari and NES programming. They both use the same 6502 processor (well, a variation on the same processor -- the Atari's is missing a few address lines, and the NES is missing a BCD mode), clocked at similar speeds (the nes is about 50% faster).

But beyond that, things start to diverge.  The most interesting to me is fundamentally where things happen, based on how their video chips work.

On the Atari, the video chip (the TIA) is designed to handle a scanline at a time. Which means that, like I've mentioned before, the whole time your TV is drawing, you spend that time babysitting the process, using all your processing time updating each scanline.  Then during vblank (the time the TV is repositioning the electron beam), you get to hurry and do your game logic updates.

On the NES, it's practically the opposite. The video chip (the PPU) is designed to handle a whole frame at a time (GASP!).  So during rendering, unless you're doing any fancy effects, you get all that time free to do your game logic updates, while the PPU does its thing in the background. Then during vblank, you hurry to push new data to the PPU so its ready for the next frame.

There's still hurrying involved in the NES -- there can be a lot of data that you want to shove into the PPU (new tiles for scrolling, etc), and not a lot of time to do it (most video data has to passed to the PPU over a janky serial interface, written one byte at a time), but compared to the Atari, I feel like I have EONS of time to work with.

It also helps having more RAM than I know what to do with. The Atari had 128 bytes. The NES has 2048 bytes. (Two whole kilobytes!)  It's crazy town.

There's still some challenges. Talking to the PPU is weird, you're limited to only 8 sprites per scanline, mid-screen scrolling (ie if you want to add a status bar) is tricky.  But so far, it's a different world.

4 comments:

sverx said...

I guess that's exactly the main difference from 3rd generation consoles onward... and if you still remember it has remained this way on the GBA and DS too. Screen blanking time to update VRAM/OAM etc... and screen draw time (usually a lot more) to do game logic. Phew ;)

Nathan Tolbert said...

Absolutely. It amazes me how different the NES and Atari were, but how similar Nintendo kept its general architecture all the way through the DS.

Jere said...

You might find this video useful, or at least entertaining (if you haven't watched it already): https://www.youtube.com/watch?v=Hvx4xXhZMrU It's not that technical, but it might give you some ideas (even though I think you'll face less problems than with the Atari port).

PD: I've started learning GBA programming to develop a game/POC on the console. Would you mind if I bombarded you with questions from time to time?

Nathan Tolbert said...

Sure, I'm happy to help. You can email me at Nathan Tolbert at gmail

Robo-Ninja Climb

Well, out of the blue, I decided that I was missing out by not entering something into this year's NesDev competition , so a couple week...