//\\//\\//\\//\\//\\//\\//\\//\\//\\//
\\ VCCC 2021 ENTRY \\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//
Author: Devoid
Break Shit Labs
(@BSLabs6)
System: Commodore 64
+ H.E.S. Forth cart
Language: H.E.S Forth v1.2
(64FORTH 1.2)
Length: 30 lines (503 bytes)
w/ comments and spacing
Exec. Size: 2292 bytes (10 blks)
Filez:
file_id.diz - you're reading it
tree.d64 - D64 1541 disk image
tree.png - screenie in PNG fmt
tree.koa - screenie in Koala fmt
listing.txt - ASCII code listing
Missing:
I did not include the CRT ROM for HES
Forth for IP reasons. FWIW, I do own
this cartridge.
Instructions:
This entry is written in Forth for the
Commodore 64, and as such requires
additional hardware in the form of the
HES Forth cartridge. The ROM is fairly
available as a CCS64 CRT image. The
entry itself is provided as a d64 disk
image due to the way HES Forth handles
memory. For, e.g., the VICE emulator,
the cmdline would be something like:
x64 -cartcrt 64FORTH.crt -8 tree.d64
assuming you have your system ROMs and
what-not configured already, and your
Forth cartridge is named "64FORTH.crt"
Once booted, the entry can be run via:
DISK DLOAD TREE<CR>
TREE<CR>
Viewing the source is a bit more
involved, but with the same disk in
unit 8:
FILE VCCC2021<CR>
Which will attach the page file
containing the source. The source
occupies two screens, which can be
listed like:
1 LIST<CR>
or
2 LIST<CR>
If anyone needs to verify that the
code listed is the same as the code
executed, the two screens can be
compiled like:
1 LOAD<CR>
2 LOAD<CR>
which will re-compile the LIMB,
SECTION, BSECT, and TREE words. The
VCCC2021 page file must be attached
first ("FILE VCCC2021<CR>" as above).
Probably best to find me on Twitter
with any questions - I don't tend to
check emails.
The How:
It's pretty straightforward Forth
code. The only part that even
approaches fancy is the BSECT word
which just builds a list of "branch"
widths on the stack given a start,
stop, and step. HES Forth provides
words for things like setting screen,
border, and character colors - but the
addresses and PETSCII codes for that
kind of thing are burned into my brain
even after all these years, so I just
used those rather than figuring out
the built-ins.
The TREE word sets up the screen and
calls the BSECT word once for each
"section" of the tree/trunk. BSECT
loads the width values onto the stack,
then TREE calls SECTION which pulls
those values off the stack and uses
LIMB to draw lines of the given width
to the display (centered). The bit of
coloring happens in TREE.
Note:
I decidedly went the obscure route for
this challenge. The HES Forth cart.
was one of the very first carts. I
ever owned for the C=64, and the first
language I learned that wasn't BASIC
or 6502 assembly. I fully expect
no-one will bother putting together
the pieces required to run this, but
it was super fun and nostalgic. Human
Engineered Software and T.J. Zimmer
did a fantastic job implementing Forth
on this platform - I don't think I
really appreciated that when I was
younger. Anyway, thanks for the
challenge!
Sub-Note: It took me longer to write
the Python script that pulled the
source code out of the REL file that
HES Forth uses as page storage than
it did to code the entry :D But I
felt like being pedantic.
Gr33tZ tw0 t3h p33p13z!
((( RIP Ziltron 2019 ))
Devoid - BSL
-=EOF=-