Apple II Fancy Lores Rasterbars

This demo does some fancy cycle-counting and some "racing the beam" to get the Apple II displaying part of the screen in a 40x192 15-color mode. Traditionally the machine maxes out at 40x48 in 15-colors (or 280x192 in 6 colors). Later models can do double lo-res or double hi-res which can do equivelent things, but thost modes take extra RAM and hardware and were not available at the first release of the Apple II back in 1977.


Theory

This demo uses "vapor lock" (the floating bus) plus careful cycle counting to alternately display both lo-res graphics pages at once. The original Apple II had no way to find when the HBLANK or VBLANK occurred, but by being really clever and reading unused ports you can catch the after image of the video scan. By writing a pattern to memory and watching for it you can find the location of the beam and from there extrapolate everything else.

I did some previous work where I used this technique to display interlaced 40x48 and a non-interlaced 40x96 mode by switching between the two lores graphics pages (PAGE1 and PAGE2) in the HBLANK between lines. You can see that work here.

This work extends this a bit. With the 40x48 interlaced mode, you are getting 40x192, but each lores page can only be addressed at 4 line increments, so switching between those you can pick 2 colors, but they repeat immediately afterward, you could only display colors in multipes of two.

The trick is, it takes 65 cycles to scan a line. So after displaying one line and switching to the other page, you have 65 cycles to change memory before you switch back again. There are various complicated ways you can take advantage of this, but one is to re-write as many blocks as you can in that time. You can write 14 blocks if they are all the same color, or 9 blocks if each is a different color.

In theory you can do more complex things, including sprites and such, if you are fine with 40x96 graphics on most of the screen and then choose wisely which 9 blocks per line you want to make extra colorful.
Downloads For now you can get the disk image here: interlace.dsk (140k) 11 June 2019

The souce code can be found on github in the https://github.com/deater/dos33fsprogs repository in the vaporlock/rasterbars directory.

Screenshots

Initial proof-of-concept showing this all might work:



Back to my Apple2 page