Apple II 8k Lores Mode 7 Demo

A short demoscene-style demo for the Apple II


This started out as some mode7 graphics routines I made for my Talbot Fantasy game and it quickly got out of hand.

"Mode7" is a scaled tiling mode on the Super Nintendo (SNES) that allows easily creating pseudo-3D effects. The SNES does this in hardware. My code does this fully in software. This is difficult, as there are a lot of multiplies and divides involved, which are *extremely* slow on the 6502 chip found in the Apple II.

The original demo I had was pretty boring, so I threw in some other things to make it more like a demoscene-type spectacle:
Except for the sound, you can run this demo on an Apple II from 1977 (assuming you were rich and could afford 48kB of RAM).

There are many other, better, demos for the Apple II. I particularly recommend the ones from French Touch.


For some reason there is a faq.


Video of the demo!

Older video discussing the optimization of the Mode7 routines:


Checkeboard scene:


Showing the filesize. Each disk block in DOS3.3 is 256 bytes, so 32*256=8KB. The extra disk block is the Track/Sector list (part of the filesystem, not the binary, but CATALOG accounts things in unusual ways).

Did you spot the hidden VMW logo on the decompression screen? You can't see it in the video because (I assume) the MP4 compression couldn't handle all the random values.

How it Works

For full details see this writeup: mode7_demo.pdf

A version of that writeup appeared in PoC||GTFO 0x18

It's coded up in 6502 assembly. It fits in one 8k binary (it's on a 140k disk image but that's mostly empty space).

The sound is a YM5 sound file that has the envelope stripped off and otherwise fit into 11 (rather than 14) registers. It also runs at only 25Hz so all the audio can fit in the roughly 32k of free RAM we have to work with.

Uncompressed in RAM the demo is 22k or so, but it compresses down to 7.5k or so with LZ4 and is decompressed at startup via qkumba's LZ4 code.


Apple II Code/Disk Images

Vote for this at pouet.

Related Links

Development Log

4 September 2018
Released v1.1. Fixes a bug with the interrupt handler than meant the demo would crash on older (pre IIe enhanced) Apple II machines.

June 2018
Description of DEMO published in PoC||GTFO 0x18

20 March 2018
Worldwide launch of v1.0 of the demo.

March 2018
Spent a lot of time finishing things up. Getting a decent sound file to fit in the 8k limit was difficult. Some sound quality was sacrificed.

Optimizing for size is one thing, optimizing for size of something that's LZ4 compressed is quite another.

3 February 2018
After a year of waiting my Mockingboard finally arrived! Time to start working on the sound code.

31 January 2018
Added in the credits at the end.

30 January 2018
Optimized the rasterbars and added them into the demo.

28 January 2018
Some improvements to the sphere graphics. Looks less horrible. Also added some shadows.

27 January 2018
Have the bouncing-sphere checkerboard scene more or less working.

26 January 2018
Finally have the prototypes for the credits scene more or less working.

31 December 2017
Finally got the starfield code working.

21 December 2017
Start adding the self-flying code in.

19 December 2017
Got the background scrolling working.

17 December 2017
Got the title screen working.

Other Apple2 Projects
Back to the VMW Software Productions Page