I write programs in assembly language using HGR mode. For a fluid display, I use the double buffering technique. Is it possible to use this technique in DHGR (double high resolution)? If so, I am looking for examples or explanations to do so.
[The following is written under the assumption it's done in Assembly. For BASIC it works rather different, but doable]
I write programs in assembly language using HGR mode. For a fluid display, I use the double buffering technique.
I assume by alternate use of Page 1 ($2000) and Page 2 ($4000), right?
Is it possible to use this technique in DHGR (double high resolution)?
Yes, works exactly like in normal High-Res. Except of course now Page 1X and 2X in Aux-RAM have to be handled as well.
If so, I am looking for examples or explanations to do so.
It's reading the usual switches:
- $C056/57 switch on/off High-Res
- $C054/55 switch to Page 2 / back to Page 1
- $C05E (AN3) turn on Double Highres
If you want to use mixed text mode as well, then
- $C053 reading turns it on mixed mode, while
- $C00D writing enables 80 column text.
Writing to either page is as well simple for basic usage.
- $C004/05 (RAMWRT) redirects writes to either 'side' of Aux-RAM
This is done for the whole area from $0200 to $BFFF, so essentially the entire basic RAM except for zero page and stack. So a safe write routine will load a byte, switch on Aux-RAM, write it and swich back. Something like:
LDA some_byte ; Whatever data we want to move STA $C005 ; Switch writing to Aux-RAM STA target_loc STA $C004 ; And switching write back to main memory.
Of course one may copy more bytes at once, reading them from main and writing to Aux-RAM. The fine part of zero page not being switched allows to keep pointers there, regardless of how RAMWRT is set.
Now, reading from Aux gets a bit more complex, as simply setting RAMRD ($C002/03) would as well start to read code from Aux-RAM, so code must reside in ZP, stack or Language Card RAM. Well, or keeping a copy in Aux-RAM at the same address, which would make it resistent any flip between main and Aux-RAM. Doesn't need to be the whole program, just the routines that do switch reading.
At this point I would recomend to read Apple's own Apple IIe Technical Note #3 which describes all switching and relation between these switches in great deail.