scene.org File Archive

File download

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

File size:
711 607 bytes (694.93K)
File date:
2025-12-30 23:34:07
Download count:
all-time: 1

Preview

  • file_id.diz 3.07K
  • image1_code.png 78.02K
  • image2_result.png 49.83K
  • image3_realC64.png 571.50K
  • snowflake50b.asm 3.40K
  • snowflake50b.prg 52B

file_id.diz

Snowflake C64 - Vintage Computing Christmas Challenge 2025

Author: Srdjan Susnic 
Category: The Main Challenge (Compo)
System: Commodore C64
Language: 6502 Assembler (Kick Assembler)
Len source code: 3485 bytes (source with detailed comments)
Len exe file:    52 bytes
Len code only:   50 bytes (excl. load address)

Instructions:
Start the VICE C64 emulator.
Drag and drop "snowflake50b.prg" into the emulator window. 
Enter SYS 30168 to start.

Description:
The program starts at $75D8 because it uses zero page $19 as a row counter and the vector($19/$20) to get the address of the snowflake data in memory.

The snowflake is printed row by row. Its size is 19x19.
Each row except the middle row begins and ends with the space char.
The middle row and middle column contain only the star char.

In order to get all other snowflake data, and taking into account its symmetrical shape, the snowflake is divided into the following 4 parts:
1.) TOP-LEFT part is the only one that is stored in memory by using 9 bytes where 0 represents '*' (star) and 1 represents ' ' (space). This data is printed directly on the left side of the current row and must be pushed onto the stack to be used later in reverse order for the bottom-left part.
2.) TOP-RIGHT part is a horizontal flip of the top-left part and it is easily printed on the opposite side of the current row.
3.) BOTTOM-LEFT part is a vertical flip of the top-left part, so this data is pulled in reverse order from the stack.
4.) BOTTOM-RIGHT part is a horizontal flip of the bottom-left part and it is easily printed on the opposite side of the current row.

Here is a shematic representation of snowflake data where '.'=SPACE, '*'=STAR, 'X'=SPACE OR STAR:

       TOP-LEFT          TOP-RIGHT
       9 bytes           horizontal flip of
       in memory         the top-left part
       fetched if X>0     
                         1 1 1 1 1 1 1 1 1
  Y: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8
X: +--------------------------------------
 9 | . X X X X X X X X * X X X X X X X X .
 8 | . X X X X X X X X * X X X X X X X X .
 7 | . X X X X X X X X * X X X X X X X X .
 6 | . X X X X X X X X * X X X X X X X X .
 5 | . X X X X X X X X * X X X X X X X X .
 4 | . X X X X X X X X * X X X X X X X X .
 3 | . X X X X X X X X * X X X X X X X X .
 2 | . X X X X X X X X * X X X X X X X X .
 1 | . X X X X X X X X * X X X X X X X X .
 0 | * * * * * * * * * * * * * * * * * * *   print only stars if X=0
-1 | . X X X X X X X X * X X X X X X X X .
-2 | . X X X X X X X X * X X X X X X X X .
-3 | . X X X X X X X X * X X X X X X X X .
-4 | . X X X X X X X X * X X X X X X X X .
-5 | . X X X X X X X X * X X X X X X X X .
-6 | . X X X X X X X X * X X X X X X X X .
-7 | . X X X X X X X X * X X X X X X X X .
-8 | . X X X X X X X X * X X X X X X X X .
-9 | . X X X X X X X X * X X X X X X X X .

       BOTTOM-LEFT       BOTTOM-RIGHT
       it is reverse     horizontal flip of
       top-left part     the bottom-left part
       fetched from       
       the stack if X<0

See commented source code for further implementation details.