flake-sca: VC³ 2025 64B-C64 snowflake
Author: Saturnus the Invincible [STI\SCA]
Category: Christmas Challenge
System: C64
Language: Assembler
Len source code: 1515 bytes
Len exe file: 66 bytes
Len code only: 64 bytes
Instructions:
1. Drag flake-sca.prg to VICE emulator or LOAD "flake-sca.prg",8,1 on C64
2. Clear the screen to make it look pretty
3. SYS 270
Description:
Lazy as I am I didn't bother analyzing the nifty symmetries of the snowflake beyond the obvious X and Y flip.
I simply draw the center cross and four mirrored versions of the 8x8 quadrant that are stored as 8x8 bits.
To squeeze this into 64 bytes we need some optimisations:
* Use SETPNT ($E9F0) to calculate screen row position X
* In Y direction draw from center outwards, in X direction draw from edges inwards. End if Y=0
* Store the bitfield inverted, so when we LSR it 9 times we get the center column of stars for free
* Loop over 9 rows instead of 8 to get the horizontal part of the cross for free ($137 already contains 0)
* The carry flag is always clear when drawing, so we never need CLC/SEC before SBC
* Move the CRYSTALLISE subroutine to zero page, this allows us to use short addressing when manipulating Y positions
* Use one-byte BRA *+2 instruction to save the final byte
Comments:
@romwer challenged me to do this in 64 bytes, so I complied. I had to remove the clear screen call to make it fit,
oh well my coding skills on the C64 are rusty :-/ In case this violates the rules I also submitted a version that
clears the screen but it uses 69 bytes. And maybe I'll do an Amiga version. Merry Christmas! -Chris