PhilTipping-PlasMa-PleX-2025

Author: Phil Tipping
Category: Christmas Challenge
System:   PlasMa machine & PlasMaSim simulator
Language: PleX, assembled with Plasm assembler
Len code only: 120 bytes (60 words)

Instructions:
... for the simulator:
1. Install & run PlasMaSim from philizound.co.uk/plasma/plasma.html
2. Follow startup instructions to load microcode 3 (PleX)
3. Set hex 3043 onto left-hand LOAD switches
4. Press 't' to load Challenge program from .plh file
5. Press Z (uppercase) to set PC to hex 10 (start address of program)
6. Press 'r' to run

... for the real machine:
1. Switch on and follow startup sequence to load microcode 3
2. Press RESET switch, press RUN switch
3. If a bootstrap has been pre-programmed into fixed store, the machine will loop waiting for a paper tape to be loaded
4. Insert sd-card containing .pl8 file contents into 'paper tape reader' slot
5. Press LOAD PTR switch
6. Bootstrap will read paper tape and jump to address hex 10 to start the program

Description:
The program draws the snowflake as 2 halves, top & bottom.
PlasMa's Oper (operator's console screen) is too small for this challenge, and the display wraps round (scrolling is unsupported), so an assembler switch on line 41 can be used to generate code to output to a printer with no wrap-round.
The machine code size of 120 bytes is the same for both versions.

The assembler switch TEST on line 42 causes each line to use a different character for representing the star. This makes it easier to confirm all rows are output correctly after wrap-round occurs.

The top half of the snowflake is defined as a bit pattern starting at line 135, where 1 is a star and 0 is a space.
Each line is held in a 16-bit word, and the main loop scans these in a forwards direction to draw the top half, then repeats the scan in the reverse order to draw the mirrored bottom half.
The central vertical & horizontal lines are not stored in the data definition as this would exceed 16 bits, so they are drawn explicitly at lines 67 and 92 when the scan loop reaches the appropriate positions. 

All counters count down so conditional tests can just check for zero.

The PleX instruction set is described here:
http://www.philizound.co.uk/plasma/PlasMa-InstructionSet-PleX.pdf

Comments:
Code.jpg shows a compact version of the .pll assembler listing file. Code size is on last line.
Results.jpg shows the result on the oper screen and dot-matrix printer attached to the machine.
video.mp4 is a small video showing both output versions running on the machine. A higher resolution video is on YouTube (marked private until the competition ends): https://youtu.be/Prh0520TDoM
sim.jpg shows the result on the PlasMaSim simulator.

The 4 files with root names 3-LogikerChallenge-2025-3043 are:
.pls = source code
.pll = assembler listing; the final line gives the code size
The additional .pll file named 'compact' is an edited listing with blank lines and comments removed for display purposes.
.plh = hex output for loading on the simulator
.pl8 = 8-hole punched 'paper tape' for loading on the real machine
(if you open it with a text editor, e.g. Wordpad on Windows, or Leafpad on linux, you'll see the holes)

The '3043' suffix is just an arbitrary number using my convention for naming source files. The first '3' indicates a PleX program (1 is for Toy-A, and '2' is for Toy-B). The other digits are just a unique number.
These are also the digits which are entered onto the simulator LOAD switches to tell it which file to load when you press the 't' key.
