July 29, 2009

Where I Learned Programming

I spent some time tonight reading Mapping The Atari, a 1982 book that was the essential tool for programming the Atari 800. It was not a book about programming languages or algorithms. It was far more valuable that that: it was a list of useful memory locations within the 65536 addressable bytes in the computer's RAM.

I find it fascinating to read the book again now, 27 years later as a professional programmer. My adult self enjoys the fact that there were 29868 Atari 800 machine cycles available per screen refresh and 114 cycles of computation that could be done during a single TV scan line sweep.

I remember that as a sixth-grader, that type of high-speed programming was way over my head. What I was able to understand - and I remember this very distinctly - was this page about how to make tones with the Atari 800's sound chip. I played with sound quite a bit.

Reviewing the memory map reminded me of the specific memory location "PEEK(53770)" - that is the address of the Atari 800's random number generator. And I found that I also haven't forgotten "PEEK(764)" as the way to read the unbuffered state of the keyboard - far better than using BASIC's buffered "INPUT" statement.

I can still recall the sense of wonder at running the following program:

WINDOW = PEEK(88) + PEEK(89) * 256: POKE WINDOW,33

That code locates the start of graphics memory and puts the letter "A" on the screen in the upper-left corner. No cursor motion. No PRINT required. For a BASIC programmer, that feels very powerful.

I spent countless hours drawing sets of font glyphs as 8x8 matrices of pixels. A complete font was 1024 bytes: 128 symbols, each defined by 8 bytes. Fill up memory, point the font address pointer to your glyphs, and voila - Olde English Type.

I marveled at advanced programs that would form machine code into strings, and then execute the string using the magical incantation USR(ADR(CODE$)).

Sound is just data. Graphics is just data. Code is just data. That is a mind-bending lesson in Von Neumann architecture for an eleven-year-old.

Posted by David at July 29, 2009 12:59 AM
Comments

You can also _Mapping the Atari_ online:
http://www.atariarchives.org/mapping/

Posted by: Alan Monroe at November 4, 2009 08:53 PM
Post a comment









Remember personal info?