I was inspired to do this by Fabian Sanglard's
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.
Any sort of Apple II should work. I haven't tested
on IIGS or IIc.
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.
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.