STAR Author: regregex Category: Christmas Challenge System: BBC Micro A/B/Master, Acorn Electron Language: BBC BASIC Len source code: 115 bytes Len exe file: 87 bytes Len code only: 87 bytes Instructions: Install and open BeebEm ( http://www.mkw.me.uk/beebem/ ). Click File -> Disc Options -> New Disc 0, enter star.ssd Click Edit -> Import Files to Disc -> Disc 0, select star.inf At the BASIC prompt, type CHAIN"STAR" and press RETURN. To reproduce the screenshots: Click Hardware -> BBC Model -> BBC Master 128 Enter the following: *INSERT 9 *CONFIGURE FILE 9 *CONFIGURE MODE 4 Press Ctrl+F12 (CTRL+BREAK), releasing Ctrl last. Then follow the instructions above. Description: The program runs under BBC BASIC version 1 and up. First it clears the screen, turns the cursor off (with five little-endian words to the VDU driver) and backspaces; with the cursor in the rightmost column, the program loops through the 17 rows of the shape and each column of the screen, printing an asterisk or space in each position. Finally it waits for a keypress, then exits. FOR statements evaluate their expressions once, so the inner loop prints one row of characters to begin and end with the cursor in the rightmost column. The character is chosen by XORing 42 either with 0 to yield 42, the ASCII code for "*", or with 10 to yield 32, the ASCII code for a space. The Boolean expression in parentheses evaluates TRUE when the point has a grid distance more than 4 from the nearest diagonal, OR when both coordinates exceed +/-4. As FALSE is all zeroes in binary and TRUE is all ones, the first AND in the expression masks the Boolean result to 0 or 10. The final EOR produces the character code for the VDU statement to print. Comments: Accommodates all BBC Micro display MODEs and text windows down to 18 columns wide (e.g. VDU 28,0,24,17,0). Putting EOR after the bracketed expression separates it from a number, which would parse the E as an exponent. This saves a space before EOR. GET returns a number (the ASCII code of the key pressed) which IF, having no THEN or ELSE clause, discards.