scene.org File Archive

File download

<root>­/­parties­/­2022­/­vccc22­/­christmas_star_challenge/geirs_c64_basic_vc3-2022.zip

File size:
4 724 bytes (4.61K)
File date:
2022-12-30 11:32:13
Download count:
all-time: 2

Preview

  • file_id.diz 1.61K
  • result.png 733B
  • source.png 864B
  • source.txt 97B
  • star-79.prg 79B

file_id.diz

Christmas Star 79

Author: Geir Straume
Category: Christmas Challenge
System: C64
Language: BASIC
Len source code: 97 chars (as LIST'ed on screen)
Len exe file:    79 bytes
Instructions:
Install the VICE emulator, drag and drop the prg file into it.

Description:
This BASIC one-liner displays the star on the screen by drawing four partly overlapping triangles.

Here's a breakdown of how the code works, statement by statement:

    READA,B                     Reads initial screen offset and the row offset for a triangle.

    FORC=0TO12                  There are 13 rows to draw for each triangle.

    FORD=ATOA+C                 There are up to 13 columns to draw for each row. The screen offset is added.

    POKE6^4+D,42                Puts an asterisk character on the screen at the address calculated.
                                1296 was chosen as the base address because it can be written as 6^4, saving a byte.

    NEXT                        Next column.

    A=A+B-41                    Adjusts the screen offset for the next row (up or down on the screen).
                                -41 is used as a constant here to minimize the DATA statement, and to ensure that the last value read is zero.

    NEXT                        Next row.

    IFBGOTO                     This ends the program after the last DATA value (zero) has been read, avoiding an ugly crash ("?OUT OF DATA  ERROR")
                                Line number can be omitted for GOTO when it's zero.

    DATA-8,81,,80,632,1,640,    Pairs of screen and row offsets (adjusted) for the four triangles. Zero values can be omitted in a DATA statement.