ARCstar Author: Stephen Harrison Category: Christmas Challenge 2022 System: Acorn Archimedes RISC OS Language: BASIC (ARM BASIC V) Len source code: 77 bytes Len exe file: 77 bytes Len code only: 77 bytes Instructions: Copy the file "BASIC_77b,ffb" unchanged into the "HostFS" folder on your Archimedes or RiscPC emulator (tested on Arculator and RPCEmu), open the emulator and double-click to run. Description: This is very similar to (and based on) my BBC Micro entry, however the different screen width means the encoded data is different and interestingly this ARM BASIC version can be further optimised 1 byte more than the BBC version, see comments below. The code uses two variables, X and A. A is the main loop counter, going from -25 to +25. The star is encoded in the DATA statement at the end of the file (description below). Within the loop, the data is read directly by reference to the TOP (end of file) pointer, subtracting 3 (get past end of file marker) and then further subtracting the absolute (+ve) value of loop counter A. Using the absolute value of A is important because the star is symmetrical, so this way we only need to encode half the star. So when the loop counter moves from -ve to +ve, the lower half of the star is reproduced by re-reading the data used for the top half (absolute value of A goes from 25 to 0, then back to 25 again). X is the ASCII code of the character to print out, and alternates on each cycle of the loop, between a star (#42) or a space (#32). The final 26 bytes of code following the "DATA" statement represent the image, in the format number of spaces (as 1 character) then number of stars (as 1 character), eg. the first row of the star is coded as 4,1,7,1,50 (4 spaces, 1 star, 7 spaces, 1 star, then 50 spaces to loop to next line...). But to avoid having unprintable control characters (ASCII<32) in the BASIC code, the data is further encoded by adding the value of X to each data point (recall X is always either 32 or 42). This means the data can be typed and displayed as normal characters (4 1 7 1 50 becomes $ + ' + R). Overall this gives the target star in 77 bytes of fully ARM BASIC V compliant code, which exits cleanly and can be typed into the computer by the user unaided (without any tricks). Comments: 2 more bytes can be saved by removing the terms ":DATA" from the line, so the code ends with the encoded data straight after the NEXT statement eg. ":NEXT$+'+R...". This runs and plots the star correctly, however it causes the code to end with "Syntax error" after the star is plotted (size 75 bytes). This is different to the BBC Micro version, because the BBC BASIC version requires a ":" after the NEXT statement, or it won't run at all, ARM BASIC still runs but exits with error. So we save an additional byte with the ARM BASIC optimisation.