== Description of VIC20 Assembler Submission for VC3 2021 Christmas tree program ==

The widths of the Christmas tree are 1,3,5,7,3,7,11,15,5,11,17,23,3,3. While a nested loop can easily calculate the first 12 numbers, I found it shorter to store them in memory with an offset of -1. This makes the first number 0. Since C64 BASIC initializes A, X and Y values to 0 in addresses 780-782, we can assume A, X  and Y to be 0 after the first SYS call, which allows overlapping the table with the end of BASIC stub by 1 byte.

In the program, first the screen width is set to 23 chars (the VIC20 usually has 22 chars width, but the graphic chip is capable of more). 

The program consists of a loop reading first the next table value. This value is stored in the X register and also in the stack pointer register. The stack pointer register is not meant to be used as storage, but this works well for our program.
Then a subroutine for printing cursor right characters is called. The subroutine is short due to the help of a Kernal function for printing a cursor right character. Then the correct number of asterisks is printed. Then the subroutine is called again and the program loops. After printing the tree, the next value loaded is a value from the program code, $BC, the opcode for LDY addr,X, (the first instruction in the program). At this point, the program knows that the tree is fully drawn and loops forever.

The program code, including all tables necessary to operate correctly, is 55 bytes; the PRG file adds another 2 bytes for the load address. When the BASIC stub with the SYS call is added, the file size is 68 bytes.

The 68 bytes of the executable file comprise:

2 bytes      | 12 bytes   | 12 bytes   | 42 bytes
load address | BASIC stub | table data | machine code

The table size is actually 13 bytes, it borrows one byte from the BASIC stub.

