gift box (BASIC) 1.2
Author: David Payne
Category: Christmas Challenge 2024
System: BBC Micro
Language: BBC BASIC
Len source code: 53 bytes
Len exe file: 53 bytes
Len code only: 53 bytes
Instructions:
Save the VCCC24.ssd file on your local PC
From the https://bbc.xania.org website
click on Discs
From examples or local
Choose file
select the saved VCCC24.ssd file
enter CHAIN"PROGRAM"
Description:
Clear the screen
Output 8 spaces followed by "\O/"
loop...
The expression (spaces have been added for clarity):
32 OR POS<19 AND(POS MOD9=0 AND 4 EOR VPOS MOD9=1 AND 39)DIV 3
returns the ASCII code of one of the below characters:
space, -, !, and +
(POS and VPOS return the cursor position x and y)
the character is output (trailing spaces are used)
...until 20 rows of characters (this includes the \O/ row) have been output
Comments:
Note that this program cannot be manually entered or edited due to 2 spaces having been removed.
The spaces are needed when editing the program, but not when running it.
Logiker confirmed that this is within the rules.
The version containing the spaces that can be manually entered is 2 bytes longer:
1CLS:PRINTSPC8"\O/":REPEATVDU32ORPOS<19AND(POS MOD9=0AND4EORVPOS MOD9=1AND39)DIV3:UNTILVPOS>19
Also, the backslash character (\ = ASCII 92) isn't available in the default screen mode.
It is displayed as ½.
Selecting another screen mode (e.g. MODE4) before running the program will correctly output the \.