Useful
Inventions
Favorite
Quotes
Game
Design
Atari
Memories
Personal
Pages

Guide to Cycle Counting on the Atari 2600

By Nick Bensema (adapted by Duane Alan Hahn)

Table of Contents

Original Document

Original document available at:

Nick Bensema's Atari 2600 Programming Page

Cycle counting is an important aspect of Atari 2600 programming. It makes possible the positioning of sprites, the drawing of six-digit scores, non-mirrored playfield graphics and many other cool TIA tricks that keep every game from looking like Combat. In fact, even Combat makes use of some cycle counting to position the tanks and to draw the scores into the playfield, though its methods aren't quite as precise as your typical Activision game.

 

Cycle counting's uses don't end at silly screen hacks. It is also useful for optimizing code to fit within a vertical blank, or a scanline, or a horizontal blank.

 

 

 

 

 

Concepts of Counting

Programming the Atari requires one to modify one's perceptions of space and time, because the Atari observes some sort of Abian physics where space is time. One frame is 1/60 of a second. One scanline is 1/20000 of a second. You get the idea. It is important to know how much code can be executed in the amount of time it takes to draw the screen. The unit of time we use is cycles.

 

 

 

 

 

 

 

 

How to Remember What Takes How Long

One cannot be expected to look at a table for every instruction they use, lest they go mad. Many instructions, however, have similar characteristics, and so general rules can be followed in order to estimate the time of each instruction.

 

 

 

 

 

 

 

 

Cycle Counting In Practice

 

 

 

 

 

Conclusion

Keep your code clean and tight. Make sure your display kernel routines use the same number of scanlines no matter what happens.

 

 

 

Other Assembly Language Tutorials

Be sure to check out the other assembly language tutorials and the general programming pages on this web site.

Atari 2600 BASIC

If assembly language is too hard for you, try batari Basic. It's a BASIC-like language for creating Atari 2600 games. It's the faster, easier way to make Atari 2600 games.

Try batari Basic

Back to Top

 

Disclaimer

View this page and any external web sites at your own risk. I am not responsible for any possible spiritual, emotional, physical, financial or any other damage to you, your friends, family, ancestors, or descendants in the past, present, or future, living or dead, in this dimension or any other.

 

 

Tip Jar

If my web site was helpful and you'd like to show your appreciation, feel free to send a gift card to me from my Amazon Tip Jar Wish List.

 

Home Useful Inventions Favorite Quotes Game Design Atari Memories Personal Pages About Site Map Contact Privacy Policy