scene.org File Archive

File download

<root>­/­parties­/­2023­/­vccc23­/­christmas-diamonds/tnt_c64_basic_vc3-2023.zip

File size:
8 438 bytes (8.24K)
File date:
2024-01-03 14:15:18
Download count:
all-time: 2

Preview

  • turtle/ dir
  • turtle/file_id.diz 1.88K
  • turtle/result.png 2.62K
  • turtle/source.png 3.01K
  • turtle/source.txt 126B
  • turtle/turtle.prg 93B

file_id.diz

Turtle

Author: TNT / Beyond Force
Category: Christmas Challenge
System:   C64
Language: BASIC
Len source code: 126
Len exe file:    93
Len code only:   93

Instructions:
Install vice, drag and drop the prg file into it

Description:

The image is drawn  much like turtle moves in Logo (*1), starting from
bottom left corner and moving top left. Drawing position is moved
repeatedly in the same direction until it turns 90 degrees clockwise. This
forms lines of length 3, 12, 6, 6, 12 (*2) after which the process is
repeated but the starting direction has turned 90 degrees clockwise as we
turned right five times. After the above sequence has been repeated four
times, drawing position is back where it started and the program ends.


(*1) https://en.wikipedia.org/wiki/Logo_(programming_language)

(*2) These length are multiples of 1, 4, 2, 2, 4, which may be easier to
     visualize as diamond edges.


Comments:

To save couple of bytes the program was crunched into single line
exceeding the normal line length limitation. Data order and the initial
drawing position were selected to avoid initializing two of the variables.

Side lengths are encoded directly in the program memory as "'0**0" string
to save space, length loop going from 37 to PETSCII value of each letter.
Starting value was selected so the last byte can overlap the next table.

Moving the cursor position is done by adding -41 (top left), -39 (top
right), 41 (bottom right) or 39 (bottom left) to current position. These
offsets too are stored directly into program memory. Because negative
numbers can't be represented as is, N+89 was used for their values,
resulting in "02" and BASIC tokens for NEXT and END. The offset was
selected so I could send some greetings to my friends in Extend. (*3)


(*3) Easter egg in sizecoding challenge! (*4)

(*4) Actually there is one more! X marks the spot!