Fill In The Blank
Old-fashioned video monitors (including televisions) literally drew images one line at a time, sweeping across and down the screen in the process. Image data in a computer generally is stored in RAM, and the contents of that memory is scanned by the video hardware as the video signal is generated and sent to the monitor. Computer programs that do not account for the timing of those scans while updating image data in memory tend to generate transient video "glitches" when a screen in shown on the monitor while that screen is being updated. A common technique for avoiding such glitches is to ensure that image data is updated during the vertical blanking interval. This is a period in the video signal which is literally reserved for the time it takes to move the electron beams in a CRT from one corner of the screen to the other. During this period, nothing is drawn on the screen. This is an ideal time for updating image data in memory.
The original Apple II and Apple II+ hardware did not provide any mechanism intended for software to synchronize with the vertical blanking interval, but the later Apple II models were more accommodating. Unfortunately, dealing with vertical blank synchronization seems to have been a creative outlet for the engineers at Apple back in the day -- the IIe, IIgs, and IIc all do it differently! I even found a Google Groups discussion about the topic. For now I am just going to use the method for the machine I am actually using in my coding experiments, the IIe. Something more robust can come later, if necessary.
The early coding examples in Assembly Lines: The Complete Book place code into memory starting at address 768, an open area of memory not used either by Applesoft BASIC or by the system monitor. However, that unused chunk of memory is not unlimited. As I added code in my own experiments, the size of that code crept slowly up. At one point, the program would immediately crash when it was run from the monitor -- not cool. Of course, the tail end of my code was overwriting something important to the proper functioning of the monitor program. So the lesson is "know where your code lives"... :-)
As I mentioned in an earlier post, my development environment includes a serial (i.e. RS-232 over Bluetooth) link between the Apple II and my workstation across the room. This provides me with a number of conveniences, but it has the drawback that I can't touch the Apple II when I'm running code on it. The only way to interact with a program (including telling it to stop) is over the serial port, which means my code experiments need to know how to talk to the serial port. So, I figured-out how the 6551 on the Super Serial Card is addressed and I wrote some code to let me poll the serial port for input -- remote access problem solved.
Well, that wraps up this progress report. I am having fun, and I am expanding my retro computing horizons. There is still more to come, so I really hope you will stay tuned!