barrym95838 wrote:
Old Apples suffered from this, because there was no way to know (screen refresh was transparent and there was no port to read that would tell the program what scan line was being drawn at any given moment).
But there
was. Have a look for Don Lancaster's "Vaporlock" (Enhancing your Apple II and IIe, Volume 2, enhancement 13, published in '85). Reads from the (write-only) casette output latch to sample a floating data bus, which holds the last data byte read by the video hardware, looks for video data stashed in areas of memory accessed only during refresh to sync the program flow to the refresh hardware, and from there on out "all" you have to do is use cycle-counted code to trigger your raster effects.
But, yeah, not trivial, and was extremely reliant on pecularities of the Apple II video systems, to the point where a single-cycle difference in the behavior of the II+ has to be compensated for, and it's unlikely to work as-is on clone hardware (and I have no idea if it works on the //c or IIgs). I doubt it was used in much commercial software.