snowflake
Author: mmphosis
Category: Christmas Challenge
System: Apple II
Language: BASIC
Len source code: 171
Len exe file: 256
Len code only: 148
Instructions:
Insert "snowflake.dsk" 5 1/4" disk and turn on the Apple II
Insert/Load "snowflake.dsk disk image in the emulator and start the Apple II emulator.
There are so many Apple II emulators. Here are 4 popular ones:
web: https://www.scullinsteel.com/apple2/
linux: "KEGS" mac: "Virtual ][" wine: "AppleWin"
Description:
It's 5 nested loops with the variables L I G H T
T is the Top-most loop iterating 9 times from 0 to 8.
H Handles a lot of calculations:
when 0 X = T and Y = X except for X > 7 because shorter diagonals
when 1 X = t except when X = 3 then X = 4
Y iterative through the 9 values in the string 900512512
when Y = 9 and X = 0 the cross gets drawn
G Gives mirrors on the Y axis.
I Iterates mirrors on the X axis.
L is Left swapping the X and Y coordinates.
Comments:
Boot and run an Applesoft BASIC program.
The 143360 byte snowflake.dsk image file has a 256 byte BOOT1 boot loader at the beginning of the file.
The first 25 bytes of BOOT1 is the coldstart routine.
800 The first byte of the coldstart routine is a 1 indicating to the bootloader to load 1 sector.
801 The 24 byte coldstart routine does a bunch of things before coldstarting Applesoft BASIC:
turn off the drive motor
resets input routine and text screen but preserve the VTAB value
setup a special input routine that calls the run routine at the end of coldstarting Applesoft
coldstart Applesoft
819 The next 148 bytes is the tokenized BASIC program.
8AC The next 58 bytes are unused, but can be filled with easter eggs.
8E3 The last 25 bytes is the run routine.
Once a request is made to print ], the Applesoft prompt character, the run routine will:
reset output routine so that printing characters to the screen works
clear the ON ERR flag
set the beginning and end of BASIC program pointers
run the Applesoft BASIC program.