3 ms·
I always wondered how the video output was controlled without video memory. Do you have some sort of 'current color' register which need to be set to different
by flohofwoe 12y ago
I always wondered how the video output was controlled without video memory. Do you have some sort of 'current color' register which need to be set to different values during video output, timed with nop loops?
I have coded on several 8-bit machines in 80s, but never on one without video memory. I stumbled over this curious property of the Atari 2600 when Ed Fries wrote 'Halo 2600' a couple of years ago (boss of the Microsoft games business during the late 90' and early 00's).
- nmeofthestate 12y ago"I always wondered how the video output was controlled without video memory." There's masses of information explaining how it works on the Internet. I think this is the interesting video that I found out about from a HN post: https://www.youtube.com/watch?v=aNyebnxV9R8 https://www.youtube.com/watch?v=aNyebnxV9R8
- mjn 12y agoMore or less yes, but it's more than one register. The video output as the scanlines go across is built up from a number of registers. Three registers encode a 20-bit "playfield graphics" layout (blocky background graphics) for half of the current scanline; four registers are higher-res sprite-like things (2 "sprites", 1 "ball", and 1 "missile"), which also do other things like collision detection; etc. You typically do useful work rather than a NOP-loop, though, and just carefully arrange it with cycle-counting, since there aren't many cycles to spare. An even more minimalist design where you just have one register, the next pixel to output, wouldn't work because the CPU isn't fast enough to update it: the electron beam outputs 3 pixels per CPU cycle, and of course many instructions take more than one cycle, too. Instead an auxiliary microprocessor, the TIA, is clocked 3x as fast as the main CPU and does the real-time compositing of these various registers into the one value to output. All the details you could want are in the Stella Programmer's Guide, a 1979 guide/manual that resurfaced on the net: http://alienbill.com/2600/101/docs/stella.html http://alienbill.com/2600/101/docs/stella.html There is also an interesting book looking at a few case studies (one per chapter) of how the Atari's weird hardware influenced the design of some of its games: http://mitpress.mit.edu/books/racing-beam http://mitpress.mit.edu/books/racing-beam
- soneil 12y agoThere's a fascinating guide, http://pdf.textfiles.com/technical/2600_guide.pdf http://pdf.textfiles.com/technical/2600_guide.pdf In short, the TIA chip does act as video memory - but not the way we treat it today. It has various registers that you can write into to define how the next line will be drawn. eg, you create a background by writing 20 bits into the 'playfield' register. This is mirrored vertically to fill out a 40-bit wide background, and then you write in a foreground & background colour. Similar registers exist to hold sprites for a ball, two players, and two missiles. And then if all of this didn't seem limiting enough for you, your game (the only process running on the machine) is responsible for maintaining most the timing for the television controller itself - so you actually spend most your time managing the TIA, with only a small number of cycles at the end of each line, and a better number of cycles after the last line, but before the next screen starts drawing - in order to actually perform game logic itself.
- bane 12y agoThe book "Racing the Beam" has a great survey of how the 2600 worked and it's a pretty quick and breezy book to read through. But basically you set various display registers as the scan-line was being drawn. Then you have the time it takes for the electron beam to move down and across to the next scanline to do some setup and calculations and so on. And then at the bottom of the display you have the time it takes for the scanline to get back up to the start position for a frame to do more number crunching. Basically instead of RAM, you read right out of ROM and fiddle with various display registers either between lines of while lines are being drawn. It's an old 8-bit "trick" as most people assume the registers get set and then you do something not knowing that you can play with them while things are going on.
- Someone 12y agoThat trick wasn't limited to 8-bit. The original Macintosh used a variant of this to generate sound and to adjust the rotation speed of floppy disks. Just past the bitmap for the screen, it had two 740-byte buffers. It read a single byte from those buffer at the end of each horizontal scan line, and fed it into the sound system/as a PWM signal for the motor of the floppy drive (http://en.m.wikipedia.org/wiki/Macintosh_128K/512K_technical_details#Sound http://en.m.wikipedia.org/wiki/Macintosh_128K/512K_technical.... I think the section on the floppy drive is incorrect; the original Mac didn't have a IWM; it was all done in software) If you wanted to generate continuous, non-repetitive sound, you had to fill the sound buffer with new values at the end of each vertical blank interrupt. Quite a bit easier than on the 2600, as the update frequency is only 60 Hz and the CPU a lot faster, but the same principle, and still quite a challenge at the time, if you wanted to do something in the screen at the same time.