IOCaste Physics Routine

ATARI GRAPHICS BASICS

The Atari 2600 draws each raster line with a chip called the Television Interface Adapter (TIA). Calling it a graphics chip I think is a bit generous since it doesn’t even generate a frame of video signal. For any given state it only generates one line. The CPU needs to handle all the timing and tell it when to start and end each frame, timing the vertical blanking interval etc..

ANATOMY OF A FRAME

PRECALCULATION NUMBER ONE

The box rotation is precalculated in the following way:

DRAWING THE FRAME

Now we’re ready to put it all together and go through the complete process of how the screen is drawn.

PRECALCULATION NUMBER TWO

To calculate the actual physics I used a fantastic library called Box2D. Check it out, it does lots of cool stuff and pretty much every game you’ve ever seen that uses 2D physics is almost certainly using it.

PRECALCULATION NUMBER THREE

The third and final precalculation generates a “script”. It simply consists of sets of number that say “wait for X frames and then begin animation starting of address Y and going to address Z”.

PLAYBACK

So we have our precalculations and we have the ability to draw three boxes provided that they don’t overlap on the vertical axis. The only thing left is to update the box slots each frame.

FINAL THOUGHTS

This routine a little unusual for me. Usually I try to write code that pushes the hardware to the brink.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store