scene.org File Archive

File download

<root>­/­parties­/­2025­/­vccc25­/­christmas_challenge/regregex_bbcmicro_bbcbasic_94b_vc3-2025.zip

File size:
5 066 bytes (4.95K)
File date:
2025-12-30 23:34:07
Download count:
all-time: 1

Screenshot (by Demozoo)

Screenshot

Preview

  • bbcsnow.ssd 1.00K
  • file_id.diz 2.43K
  • result.png 569B
  • snow 94B
  • snow.inf 40B
  • source.png 1.71K
  • source.txt 116B

file_id.diz

SNOW

Author: regregex
Category: Christmas Challenge
System: BBC Micro A/B/Master, Acorn Electron
Language: BBC BASIC
Len source code: 116 bytes
Len exe file:     94 bytes
Len code only:    94 bytes
Instructions:
  Install and open BeebEm ( http://www.mkw.me.uk/beebem/ ).
  Click File -> Run Disc, select bbcsnow.ssd.
  On hardware, insert the disc then tap BREAK while holding SHIFT.

Description: The program runs under BBC BASIC version 1 and up, and
displays a specific snowflake pattern on the screen.
It selects display MODE 4, which automatically clears the screen.
For each character cell in a large rectangle in the top left corner it
then calculates the Euclidean distance from the centre, and prints an
asterisk if the radius is within a prescribed limit AND in a lookup
table of radii, or if the cell lies on an axis.  The program waits for a
keypress before exiting.

Comments: An annotated dissection of the code follows.  Abbreviations
have been expanded for clarity.

0                       A leading line number puts the line in memory:
MODE4:                  Display MODE 4 is preferred for square pixels.
FORY=-14TO9:            Loop for 24 rows of which five are blank:
  PRINT:                Move the cursor down, leaving row 0 also blank.
  FORX=-20TO9:          Loop for 30 columns per row, first 11 blank:
    H=Y*Y+X*X:          H := square of the Euclidean distance from (0,0)
    VDU                 Send one character to the VDU routine:
      32EOR10AND        " " if Boolean expression is FALSE, "*" if TRUE
      H<99AND(          All asterisks are within 7*SQR(2) of the origin
      X*Y=0OR           All points on axes starred (can't lookup (0,0)!)
      0<INSTR(          Search a string for a substring, return index
      "o'm-i6b7WBE",    11 radii define 76 stars due to aliasing
      CHR$(             Turn square of radius into a printable character
      37+H MOD90        Choosing modulo 90 wins us one alias
      ))):              Index converted to TRUE if a substring is found
NEXT,:                  Loop until last column, then until last row
IFGET                   Collect a character from console and discard it

The radius table contains 11 entries but defines 13 stars per octant.
This is because:

  2^2 + 2^2 == 7^2 + 7^2 (mod 90), and
  7^2 + 1^2 == 5^2 + 5^2 (mod 90).

As (0,0) and (5,0) each have an inconvenient alias, the lookup table is
not used for points on the axes.