scene.org File Archive

File download

<root>­/­parties­/­2025­/­vccc25­/­christmas_challenge/sti-sca_c64_asm_64b_vc3-2025.zip

File size:
74 914 bytes (73.16K)
File date:
2025-12-30 23:34:07
Download count:
all-time: 2

Preview

  • file_id.diz 1.57K
  • flake-sca-src.png 74.07K
  • flake-sca.asm 1.48K
  • flake-sca.png 1.63K
  • flake-sca.prg 66B

file_id.diz

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