Apple II 64k Cycle Counting Megademo

1st place Retro Demo at Demosplash 2018



This Demo first appeared at Demosplash 2018 on 3 November 2018.

The vapor-lock mode-switches really confused their projector so it had to be run in an emulator for the presentation, but it ran fine on the Apple IIe provided when it was hooked up to a real CRT.

You can see my talk on Apple II demo programming 2 hours into the video here

Disk Image

System Requirements


Source Code

Source code can be found at http://github.com/deater/dos33fsprogs in the megademo directory

FAQ

For some reason there is a FAQ

Notes on Vapor Lock and the Floating Bus

TLDR: on Apple II it's not racing the beam that's the hard part, but *finding* the beam.

More notes if you are curious:

Screenshots and Dev Notes

C64 Troll Screen/Curtain Wipe. This screen is HIRES, but then gradually opens with a mid-screen modeswitch to text. You can only switch modes with a 4-cycle (4 char) granularity and it is a bit glitchy at the edges.

The Apple II struggles to do white-on-blue text here. It looks a lot more clear if you draw white-on-black, but then you lose the traditional C64 look.
40x96 Apple II image: This image is split across LORES PAGE1 and PAGE2 and flips every 2 scanlines to give twice the usual LORES resolution. I originally planned a scroll-in effect but ran out of time.
This screen is flipping between 3 pages: LORES PAGE1 and PAGE2 as well as HIRES PAGE1. In theory HIRES color is a subset of LORES so by drawing blocky it should match up, but in practice it's not an exact match. You could get better animation with 4 pages, but we need the 8k of HIRES PAGE2 to hold code.
These screens are LORES on the left, HIRES on the right, and then the wipe effect on the bottom (the names start out in LOTR Tengwar at first). The name replacement copies from LORES PAGE2 to PAGE1 just ahead of the beam.

You'll notice that the emulator and the hardware don't agree with drawing the vertical bar, I tested on real hardware too late and didn't have time to fix it.
This is a text/LORES split, but the text is split 50/50 between PAGE1 and PAGE2 allowing to create lower-case letters out of top/bottom of unrelated uppercase characters. This is tricky as the text font on Apple II+ is offset one scanline from that on the Apple IIe, so we patch the screen split code at runtime to get the chars to look right. The LORES is 40x96 again.

You'll notice a glitch on the right edge of the tractor-feed paper; again the emulator doesn't match real life and I ran out of time to fix it.
This is just text mode on top, LORES graphics on bottom. Cycle-invariant animations are a pain as they usually involve lots of conditionals. We use a state machine and a jump table to make this a bit easier.
The scene that started it all. This is text on top, HIRES in middle, LORES on bottom. That's Mount Katahdin (highest point in Maine) in the background.
This scene is tricky, as there's a 4 frame pattern and the scanline splits changes each frame in complicated ways to give the twinkling stars and water effects. Also some complicated sprite/PAGE1/PAGE2 stuff is going on to give the pseudo-transparency of the waterfall.

And only just now noticed that this one is 1-cycle (one lores block) off too. I'm seeing the pattern now, the actual IIe vapor lock is one cycle off from what AppleWin thinks it should be. That should be a fairly straightforward fix (famous last words).
Takeoff is a HIRES/LORES split. Note that the tail of the spaceship is a smooth diagonal rather than stair-step.

Also, blame Scott Manley for the Mach Diamonds.
No cycle-counting on this one. For more details about how this works see the Mode7 Demo, or the writeup in PoC||GTFO 0x18.
This has text at the top, HIRES in the middle, and then a mid-screen change from HIRES to LORES and back to allow the colorful rasterbars and spaceship. This is tricky to do in time, and a bit glitchy too unless there is black coloring at the borders. I wanted 40x96 for the rasterbars but that is not easy to do without HIRES PAGE2 (because otherwise you have to do two softswitch flips on the transition which takes 8 cycles, too long)
Again, a text at top / LORES at bottom animation.
This mode is HIRES at top, with a cycle-invariant HPLOT routine used to draw the stars and fireworks. The bottom is interleaved every-line LORES PAGE1/PAGE2 to allow the blended gradient. The bottom right corner is TEXT, and it is interleaved too which gives the neat stripe effect when the text messages are scrolled in. It is limited to 256 bytes of message data, otherwise the text drawing code crosses a page boundary and I was too lazy to make that invariant.
Other notes:
Vote for this at Pouet

Demo running on real hardware


Back to my Apple II pages