My Third Program for Atari 2600 - Drawing Pixels
Posted by rvertulo on August 28 2024 16:42:19
Continuing with my studies in Assembly language for the Atari 2600, I have now progressed a bit further in the book "Programming Games for Atari 2600". At this point, I started to study the functioning of the Ball element, which, from what I’ve observed, is nothing more than a pixel that can be drawn on each scanline. Interestingly, the X position of this pixel is determined by the number of machine cycles. Thus, it's essential to know exactly how many cycles each instruction takes in order to set the RESBL register at the exact moment that corresponds to the desired X position. It's a very crazy concept and completely different from what I am used to when it comes to drawing graphic elements on the screen using other programming languages.


In this part of the study, I decided to draw a vertical line in the center of the screen, on top of the gradient I created in the previous exercise. It was an interesting challenge, and I had to use the debugger from the Stella emulator to get an accurate view of what was happening in the code. I confess that, even though I understood how the Ball element works, I am still a bit insecure with so many concepts I need to absorb.


During this exercise, I learned that when WSYNC is activated, the current scanline is filled to the end of the line, regardless of its current position. I also learned a lot about using the Stella debugger and delved a bit more into analyzing the behavior of the various registers in the Atari architecture during code execution. Below, you can see how the screen looks at this stage of the study.


linhavertical.png
Result of running the third program for Atari 2600 using Assembly language.


If you enjoyed this article and want to learn more about this series, read the previous article.


If you wish to read the next article about this series, click here.