A small thread about the recent demos of Grouik/French Touch on Apple IIe.

You may think they're not a big deal because we see that kind of effect on other kind of 8-bit computers.

For instance Mad Effect #3 doesn't look very impressive at first sight... except it displays 120 colors instead of 16.


To achieve this, the demo changes the color of every plot (=huge pixel) every line. Except it uses the low graphics mode, which can only display plain 40x25 plots.

The way the demo does it is by using Apple II's double buffering mode and switches the buffer at each display line.

Except it doesn't have any specific chipset to sync with the display (nor any hardware acceleration), so everything should be done in software.

Show thread

This is what is called sync-code. The code runs in sync with the display and changes hardware switches at precise location of the display.

The instructions in red are the buffer switches, taking place during HBL. Every two lines of code run in exactly one scanline time.

Between them, in green, the code updates the framebuffers' content for the effect to move.

Show thread

This reminds me of what the Atari ST coders did with Fullscreen effects: making the effects run between precise sync timings.

But of course for it to work, you should make sure the code starts at the exact start of the display for each frame.

That's where Grouik made also some great progress recently, with Mad Effect #1 and #2.


Show thread

His demos work on Apple IIe because :

- There's 64k of RAM. That means you can change the interrupt vector, located at address 0xFFFE.

- You can know when the display enters or exits VBL.

- You can add a Mockingboard soundcard, which adds timers to the Apple II (which has none). And so you can use timed interrupts.

Show thread

In Mad Effect #3, Grouik starts by detecting when the IIe exits VBLANK by polling the appropriate address, and then waiting for the appropriate sync point.

(on Apple IIe, end of VBLANK means you enter the first HBL of the display)

Then it syncs a looping timer with the start of the display, and put the sync code in the interrupt handler.

Show thread

So the rest of the code is in sync with the display?

Well... Mostly. The interrput does not actually start at the exact same display location because the CPU has to wait for the current instruction to stop before jumping to the interrupt handler. It induces a 1-6 cycles jitter.

In Mad Effect #3 it doesn't matter because there's a single buffer change each line, that happens during HBL. So the jitter is not visible.

Show thread

But in Mad Effect #2 for instance, the effect is a giant scrolltext that is generated only in sync-code. The CPU can NOT do this effect the regular way (= by changing the framebuffer's contents). It's simply not fast enough.

So the way Grouik does that is by switching between two graphic modes on the fly (HGR and GR, with an empty framebuffer in GR). On a each line he makes 10 mode switches, and that's how characters are generated.


Ā· Ā· Web Ā· 1 Ā· 0 Ā· 0

But then the interrupt running the sync code *must* either start at the exact same location for each frame, or do some sort of resync to be sure there's no jitter.

We talked about this with Grouik, and he found a very elegant way to do it, by reading the timer counter and then resyncing the code each time the interrupt starts.

So while the effects may look not that impressive, they ask for a lot of work on Apple II :)

Show thread
Sign in to participate in the conversation

Discussions adultes, otaku et geek, avec des gens sympa