Thursday 30 December 2021

XTREE for Vintage Computing Christmas Challenge 2021


This is my response to Logiker's Christmas Challenge for 2021. Interesting exercise.


Author: Jim Gerrie (Sydney, Nova Scotia, Canada) http://faculty.cbu.ca/jgerrie/Home/Type-in-Mania.html

System: TRS-80 Micro Color Computer (MC-10)

Language used: Micro Color BASIC 1.0

Length of source code: 74 bytes (or 70 bytes if I use ? instead of PRINT)

Length of "executable" file: XTREE.C10 (365) 4TREE.C10 (679)-- these are files loadable by emulator.


Instructions on how to run the code: 

VMC10.exe is the Virtual MC-10 emulator. Unzip the emulator zip file into a directory of your choosing.  Execute VMC10.exe. Ignore any warnings. You should be fine.

The Challenge (XTREE.C10)

Type CLOAD & hit ENTER in the main emulator window. Select XTREE.C10 in the "Cassette" directory. Type RUN...


The Challenge - Variation 2 (4TREE.C10)

Type CLOAD & hit ENTER. Select 4TREE.C10 in the Cassette directory. Type RUN...

The source code for both programs are in the "quicktype" directory as text files.  These files can also be

loaded into the emulator via the "quicktype" feature in the Files menu.  Screenshots of the games are in the "screenshots" directory.


Description:

XTREE

0 FORY=1TO14:L=ASC(MID$("!#%'#'+/%+17##",Y))-32:PRINT,TAB((33-L)/2);:FORX=1TOL:PRINT"*";:NEXTX,Y

The XTREE program basically encodes the tree line lengths as a series of ASCII characters. The ASCII value

encodes the length of each line, which the program then decodes and prints the number of asterisks centred.

4TREE

0 FORC=1TO4:CLS0:FORR=1TO10:ONCGOSUB1,2,3,4:GOSUB6:ONCGOSUB5:NEXT:NEXT:GOTO

1 POKE49151,68:A$="":FORT=1TO23:A$=A$+CHR$(127+RND(128)):NEXT:RETURN

2 POKE49151,28:A$="":FORT=1TO23:A$=A$+CHR$(32+RND(64)):NEXT:RETURN

3 POKE49151,.:A$="":FORT=1TO23:A$=A$+CHR$((RND(8)-1)*16+143):NEXT:RETURN

4 POKE49151,28:A$="":FORT=1TO23:A$=A$+CHR$(32+RND(112)-(RND(2)=1)*64):NEXT:RETURN

5 FORT=1TO50:POKE49151,4-(RND(2)=1)*64:NEXT:RETURN

6 FORT=1TO14:L=ASC(MID$("!#%'#'+/%+17##",T))-32:PRINT@(T-1)*32+((32-L)/2),LEFT$(A$,L);:NEXT:RETURN

4TREE just uses a faster version of XTREE multiple times through GOSUBs but creates different type of characters strings in A$ such as the solid color graphic strings stored above ASCII 128.



It also puts the MC-10 into some of its stranger graphics modes to create some interesting special effects.  The POKES put the machine into these different modes.



No comments:

Post a Comment