I've been mucking around more with programming the Atari 2600, and have just begun to figure out the vagaries of moving the player missiles around.
Basically, as the video hardware scans from left to right, you set the horizontal position of a player by issuing a store to hits horizontal position register. The problem: the 6502 is only fast enough to set the position within 15 pixels of a given location. To refine the horizontal position, you need to issue a shift of -8 to +7. The timing is critical and tricky.
I haven't really worked it all out yet, but I have players moving behind the playfield here in my example.
I think I need to carefully work out the timing on paper before doing anything more refined.
Addendum: Not really sure where that little black bar is coming from either.
This dive into the world of retro computing has rekindled my interest in field programmable gate array technologies. I found this page which contains interesting FPGA based CPU designs. Mostly marked as a bookmark to re-examine later.
From time to time, I get this curious nostalgia for the computers of my youth. Don't get me wrong: I love having megaflops to burn, and would gleefully accept more. But sometimes I hearken back to the simpler days of my youth and my first computer: an Atari 400 that I bought with the money I earned by mowing lawns and cleaning the volcanic ash from Mt. St. Helens out of gutters. My old Atari was actually a pretty fun machine with a flexible, powerful (for its day) video architecture. The entire OS ROM was (if memory serves) 10K of 6502 assembly code, and I got hold of the assembly source for it, and read it front to back, studying it for its mysteries.
Over the past couple of weeks, I decided to set my clock back even further, and learn how people programmed the Atari 2600: the first programmable video game that became truly popular. I had forgotten just how primitive the thing was:
- 1.19 Mhz 6507 processor (like a 6502, but with only 4K of addressable memory)
- So called "player missile graphics", two 8 bit wide sprites and two one bit wide missiles
- No framebuffer: all backgrounds are generated "on the fly"
And yet, people made lots of games for these things. In that spirit, I set out to implement a simple game. I haven't really gotten two far in a couple of hours of programming, but on the right you can see a screen dump of a title screen that was actually generated by writing assembly code, assembling with p65, a 6502 assembler written in perl and then running the binary image on Stella, a 2600 emulator.
I'll yap about some of the technical details in this evening's podcast. If you are interested in this gunk, tune in!
Addendum: Josh reports that he's getting my "don't steal bandwidth" image when reading this feed in bloglines. I just checked my own bloglines subscription, and it appears to be working fine for me. Is anyone else having problems seeing linked images in bloglines? I put in a special exception for bloglines, so there shouldn't be any problems (that is, if my weak understanding of how all this stuff works is actually correct). Drop me an email if you are still having difficulties.