Lovebyte 2024 Apple II sizecoded Demos


Background

Lovebyte is a demoparty aimed directly at sizecoding!

Source Code

The full source code for all of these entries is available on my dos33fsprogs github project under the demos/lovebyte2024 directory.

Byte-athlon

I only qualified at the last minute but I managed to get 3rd in the oldschool category. I thought not having a 512 byte entry would hurt my chances, but in the end my smaller intros actually placed better.

The Entries



Oldschool 1k -- Don't Tell Valve



A scene from your favorite cake-acquisition simulator! This was a 512 byte entry that got out of hand. This is sort of based on the
Applesoft BASIC "demake" I made a while ago.

I originally compressed the image with zx02, but coupled with the decompression code was too big for 512B. So then I spent a lot of time writing compact rectangle and sprite drawing code to draw the background... which then effectively ended up being only 100 bytes or so smaller than the compressed version.

In the end I decided to go for 1k and compress the whole thing and went back to just decompressing the graphics directly to $2000 (HGR PAGE1) at the start.

The circular logo at the beginning was actually a 16B attempt which made me think of the aperture logo and led to this whole thing happening, so I had to include it.

The protagonist is a shape table drawn with XDRAW. She can only get to an X value of 256 on the screen because it saves a few bytes not having to track the extra values (x resolution of hires on Apple II is 280).

I actually had some reduced ASCII art for the end sequence, but sacrificed it to get more of the song in. The music is using Electric Duet by Paul Lutus, which plays two channel audio out the speaker (beeper), a stock Apple II can play this (no Mockingboard needed). I do have the full song implemented, but it's truncated to whatever will fit in 1k.

I've made it a "boot sector". You might say isn't it large? But the Disk II firmware is smart enough to load up to sixteen 256 byte sectors from disk without any external help. So the program is 1020 bytes plus the 4 bytes to indicate 4 sectors and to turn off the floppy motor.

As a boot sector, the remaining 140k of the floppy would be empty, which seems like a waste, so I used Bzotto's Picture Disk to add this image to the magnetic flux patterns (in case you have a floppy disk flux imager). Unfortunately did my best to get the aperture logo on it but the imager wasn't having it:


Finish: 6/7 1k Oldschool
Download: dont.woz.zip
Video: https://youtu.be/NahMhVNjaA8
Sourcecode: dtv_1k
Pouet: https://www.pouet.net/prod.php?which=96094

Oldschool 1k -- Plasma Mask



I had much grander plans for this, including having it alternate with a hi-res version of the plasma (like in the second reality demo) as they share a lot of the same code/lookup tables. In the end this was the best I could manage.

This is based on the code from the French Touch "Plasmagoria" demo by Grouik. Everything was massively shrunk down and as much as possible generated on the fly.

This includes the 768 bytes of SINE tables. (I actually had to use a FFT to reverse-engineer which values were used for the sines, I've tried for years to get a nice plasma on Apple II and have never managed to do it myself).

To save space the Applesoft (Microsoft) BASIC FAC floating point routines are used to generate the SINE tables, which is *slow*. I'd probably be better off doing some fixed point math but while faster that might take more room.

I ended up compressing the entire program using zx02 compression. This let us have three full-screen masks which compress down to essentially nothing.

Thanks to mA2E for making the music track. To fit in a reasonable (256 bytes or so) space I essentially hand-craft a tracker that is tiny, and also makes some assumptions about having a Mockingboard in Slot #4, left channel audio only.

Optimizing compressed code is a pain, as shaving off bytes often makes everything larger. The final challenge was trying to get the credits printed during the precalc. Spent a lot of time re-arranging the source code so that the full line could be printed.

Finish: 2/7 1k Oldschool
Download:
plasma_mask.dsk
Video: https://youtu.be/sK_UM4act7s
Sourcecode: plasma_mask_1k
Pouet: https://www.pouet.net/prod.php?which=96095

256B Intro -- Desire Wires



I've had this hi-res wires effect around for a while, for so long that I forget how the vertical line drawing part of it works. It wasn't a convenient power-of-2 size and not really that exciting. I thought maybe I'd combine it with the tiny rectangle-drawing code from the abandoned work on the 1k dtv demo, add some page flipping, and maybe it would make something mildly compelling.

Finish: 17/21 256B Oldschool Intro
Download:
dsr_wires.dsk
Video: https://youtu.be/NBZdGSmsJMo
Sourcecode: dsr_wires_256
Pouet: https://www.pouet.net/prod.php?which=96098


128B Intro -- Rainbow Squares



This is a cool looking pattern that is surprisingly colorful for Apple II hi-res which only has 6 colors. It's two frames from Hellmood's sierpinski rotozoom (in Memories) that I found by accident. For this intro we just (slowly) draw the two frames to PAGE1 and PAGE2 and then page flip them rapidly in a decreasing rate. A speaker click is mixed in to give some sound when drawing.

Finish: 10/19 128B Oldschool Intro
Download:
rainbow_squares.dsk
Video: https://youtu.be/BMFxgKP2p60
Sourcecode: rainbow_squares.s
Pouet: https://www.pouet.net/prod.php?which=96035


64B Intro -- Box Entropy



This is based off of a famous Applesoft BASIC 2-liner "entropy" by Dave McKellar. It's hard to replicate the exact effect without floating point, and especially without a good random number generator. I made an approximation of one in 6 bytes using ROM values EORed with another ROM value indexed with the Y value. Still not great but made it slightly less repetitive.

The effect is just using XDRAW to draw boxes of size 1, with randomly increasing it to size 2. That's it, but it makes a neat effect. The realization that helped this time was the BASIC shape tables were actually already double sized, so I could reduce it from 10 to 6 bytes as long as I made the SCALE values 2,4 instead of 1,2.

Finish: 9/16 64B Oldschool Intro
Download:
box_entropy.dsk
Video: https://youtu.be/aF1_GRqXVoc
Sourcecode: box_entropy.s
Pouet: https://www.pouet.net/prod.php?which=96031


32B Intro -- Sawblade



More Apple II shape tables. Was trying rotating things around the middle of the screen, which is hard because you waste 9 bytes to get the drawing starting there. Also wanted the scale to be 1 so we start with the *second* byte of the code at $E7 (HGR_SCALE) wasting a bit at $E6 where we start. It's using ROM at $E2E0 as the shape, and increasing the SCALE after each rotation.

Finish: 7/13 32B Oldschool Intro
Download:
sawblade.dsk
Video: https://youtu.be/g6ZPqk7Rtks
Sourcecode: sawblade.s
Pouet: https://www.pouet.net/prod.php?which=96026

Quick run on your own Apple II or emulator:
CALL -151
E6: A0 01 20 D8 F3 A8 A2 8C  A9 60 20 11 F4 A2 E0 A0
F6: E2 E6 E8 A5 E8 29 3F D0  02 E6 E7 20 5D F6 F0 E5
E6G

32B Intro -- Spiraling Shape



Another shapetable demo, again I was trying for rotating around the center of the screen again (which as mentioned takes 9 bytes). We did get a nice spiral effect. We're using the shape at $E2DF. We load at $E9 so that $FE which we use as rotation happens to be in the right place in the code for loading as a constant. We don't have to set HGR_SIZE at $E7 because we base its value off the rotation. This freed up enough room for the 3 bytes it takes to get a little sound going.

Finish: 1/13 32B Oldschool Intro
Download:
spiral_32.dsk
Video: https://youtu.be/-pbPeGJ_mMA
Sourcecode: spiral_32.s
Pouet: https://www.pouet.net/prod.php?which=96019

Quick run on your own Apple II or emulator:
CALL -151
E9: 20 D8 F3 2C 30 C0 A8 A2  8C A9 60 20 11 F4 A2 DF
F9: A0 E2 E6 FE A9 01 29 7F  85 E7 20 5D F6 F0 E4
E9G

16B Intro -- hhhh



Now that 16B is official I didn't want there to not be an Apple II representative. I thought I was out of time but then the deadline was mysteriously increased so I had time to search for yet another interesting (to me at least) XDRAW pattern.

This one did look a bit more compelling in the emulator than it does on the screen capture (all of these were captured on an actual Apple IIe platinum). I thought it looked like some sort of sci-fi spaceship background. The name is from the "hhhh" pattern at the start of the run.

Sadly I wasn't able to wake at 6am to watch the compo live.

Finish: 2/22 16B Oldschool Intro
Download:
hhhh_16.dsk
Video: https://youtu.be/Q5Gh52hUkRQ
Sourcecode: hhhh_16.s
Pouet: https://www.pouet.net/prod.php?which=96139

Quick run on your own Apple II or emulator:
CALL -151
E7: 20 D8 F3 20 57 F4 A9 E3 A8 88 AA 20 5D F6 F0 F6
E7G

Back to my Demos
See my Apple II projects
See my writeups on my Apple II twitterbot demos