Toying With Graphics
Using a monitor program makes experimenting with hardware really easy. Manipulating memory or flipping bits in hardware registers is nearly trivial, making it very easy to fiddle with what the system offers. I took advantage of this to experiment with the graphics modes on my Apple II. I used the monitor program to experiment with setting different colors on the screen, to change between the text and graphics modes, etc. This is a great way to get a feel for how things work.
During my experiments, I was reminded of the peculiar way that screen memory is arranged on the Apple II. One might expect that the data for the first pixel on the second line of the display would immediately follow the data for the last pixel on the first line, but on the Apple II that is not the case at all. This is a by-product of a simplification in the Apple II hardware design, but it certainly complicates things when writing software to plot graphics to specific lines on the screen. If you have ever noticed the "window blinds" effect when loading a graphic on an Apple II screen, you are observing what it looks like to write to the Apple II screen when accessing memory locations in a straight linear fashion.
|Clearing Lines In On-Screen Order|
As I mentioned in an earlier post, I am redirecting the Apple II console through the serial port so that I can drive the Apple II from my development machine. This works fine, but by default the output continues to be sent to the screen too. That is fine when I'm only accessing the monitor program, but it is a problem at least for low resolution graphics mode since the text and graphics screens share the same memory -- typing commands messes-up the low-res graphics screen! What to do?
There might be a way to convince the Apple II to stop sending output from the monitor program to the screen, but right now I don't know how to do that. Fortunately, the Apple II actually maintains two separate screen buffers and the monitor program only modifies one of them. Which buffer gets used for graphics output is determined by a set of registers in the Apple II that are called "soft switches". By using the right "soft switch" to change the graphics to use the other screen buffer allowed me to do graphics experiments from the monitor program without messing-up the graphics on the screen.
I am still working on Assembly Lines: The Complete Book. I have completed reading volume 1 and the original appendices, which should be equivalent to reading Assembly Lines: The Book (i.e. the original version). So as a 6502 programmer, I am now as qualified as a young John Romero! At least, that is how I interpret his quotation from the back cover... :-)
But seriously, there is plenty more to read. With that said, I am feeling a bit more qualified to code for the 6502. Plus, I am learning a bit about Apple II architecture and such -- I found some interesting stuff online about timing code to the vertical blank interval on the Apple IIe, IIc, and IIgs (all done differently). I'm still not sure what coding project I will do, but some options are coming into focus. If you want to read more about it then I hope you will stay tuned!