2

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.

1
  • 1
    It's possible, and Raffzahn's answer explains the options. Some old programming books will cover DHR, but probably not page flipping. As for examples, there aren't many tutorials these days on DHR! There's this series, but it probably doesn't do exactly what you want. You can inspect old games and verify whether they use DHR and page flipping. For instance, Airheart does. Apr 6, 2021 at 10:34

1 Answer 1

4

[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.

6
  • Is double buffering on the Apple II fast enough for a "fluid display"? Apr 4, 2021 at 22:30
  • 2
    @snips-n-snails Define 'Fluid Display'. The Apple got two screen pages. Flipping between them is instant (well, one 4 microsecond long instruction it is), thus for sure fast enough to flip 60 times per second. If 16 ms are enough to draw a new screen with a 1 MHz 6502 is a different issue and may rather depends on the game.
    – Raffzahn
    Apr 4, 2021 at 22:57
  • 2
    @snips-n-snails: Have a look at Airheart and see for yourself. ; - ) Apr 6, 2021 at 23:56
  • 2
    D/Generation (in this collection) is perhaps a better example, given that it is much more visually complex, but yes it is indeed fast enough. Apr 9, 2021 at 23:55
  • I made several animations using double buffering, it works rather, for a machine dating back 40 years. Watch this: github.com/bruno185/Apple-II-Wolf-animation-as-tribute. They are in He Res, not Double Hi Res.But I had to put significant time delay between each frame. Which assumes that I still have enough time to use the DHGR, which requires twice as much byte manipulation.
    – bruno185
    Apr 21, 2021 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.