Apple ][ Fire Demo -- 64 Bytes

80 byte version64 byte version


I was inspired to do this by Fabian Sanglard's Blog Post about flame effects on the PSX version of Doom. The algorithm sounded doable on the Apple II. I decided to see how small I could make it.

The code cheats a bit. It's only 40x24 lores graphics (as getting 40x48 adds a lot of extra nibble manipulation). It's an 8-bit linear shift random number generator which repeats fast enough that the fire looks really regular. Also it's doing the simple algorithm that only adjusts the heat vertically, it doesn't mix in horizontal.

The 64-byte version still looks cool but is a slightly different algorithm than the one from the PSX Doom blog post.


See the demo running on reall Apple IIe platinum and Apple II+ hardware. I'm Still having difficulties with my video capture setup, so you're stuck with recordings from my cheap camera.

System Requirements

Direct Entry, 64-byte version

To enter this directly on your Apple II, at the BASIC prompt enter CALL -151 and then enter the following two lines.
70: 2C 50 C0 2C 52 C0 20 70 FC A9 FF 91 2A 88 10 FB A9 16 85 25 20 22 FC A0 27 68 F0 05 0A F0 04 90 02 49 1D 48 30 09 B1 28 29 07 AA B5 A8 91 28 88 10 E7 C6 25 10 DE 30 CE 00 BB 00 AA 00 99 00 DD


Disk Image


Development Notes

V1.4 notes -- 1/4/2019

Tested on real hardware, problem on the Apple II+! MIXCLR is never set at boot and on real II+ hardware was being left in split GR/TEXT mode. Added code to set this, but now we were back to 66 bytes. It took a lot of crazy optimization attempts to simply realize I could save the random number seed on the stack and was just barely able to get things back in 64B.

V1.3 notes -- 1/4/2019

qkumba found another byte to remove, so it's down to 63 bytes now.

V1.2 notes -- 1/3/2019

Spent a lot of time digging through the monitor rom listing to find routines I could call into. Realized SCROLL was powerful, and it results in a neat look but it's a different algorithm than before. I'm keeping it though because I've always wanted to write a 64 byte Apple II demo.

V1.1 notes -- 1/2/2019

Was reminded on usenet that I could call into the ROM firmware to save some bytes. I'm only calling into the monitor firmware, avoiding Applesoft specific calls to ensure things will still run on an original II with integer basic. With these changes we can get down to 80 bytes. Also qkumba helped shave a few extra bytes off.

V1.0 notes -- 1/1/2019

Spent a lot of time optimizing this for size. Was hoping for 100 bytes but ended up being 106. For full notes on the optimizations see the comments at the top of the source code.
Other VMW Software Demos
Other Apple2 Projects
Back to the VMW Software Productions Page