scene.org File Archive

File download

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

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

Preview

  • atomsnow.ssd 768B
  • file_id.diz 2.58K
  • result.png 515B
  • snow 151B
  • snow.inf 30B
  • source.png 1.58K
  • source.txt 149B

file_id.diz

SNOW

Author: regregex
Category: Christmas Challenge
System: Acorn Atom, Acorn System 3/4/5
Language: Atom BASIC
Len source code: 149 bytes
Len exe file:    151 bytes
Len code only:   151 bytes
Instructions:
  Install and open Atomulator ( http://atomulator.acornatom.co.uk/ ).
  Ensure that Settings -> RamRom -> RamRom Diskrom Enabled is OFF.
  Click File -> Load disc :0/2, select atomsnow.ssd.
  Enter the following:
  *DOS
  LOAD"SNOW"
  RUN

Description: The program runs under Atom BASIC, and displays a specific
snowflake pattern on the screen.
It selects display mode 0, which automatically clears the screen.
For each character cell in the leftmost part of the screen 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:
CLEAR0;                 Put display in text mode and clear screen.
Z=TOP-14;               Point Z to the semicolon after END.
FORY=-9TO9;             Loop over rows -9 to 9:
  PRINT';               Move the cursor down one line and to left edge
  FORX=-16TO9;          Loop over columns -16 to 9, first 7 blank:
    H=Y*Y+X*X;          H := square of the Euclidean distance from (0,0)
    C=32                Preset the character to be printed to " "
1   R=12;               R := 12, beyond last character of radius string
    DOR=R-1;            Repeatedly subtract 1 from R; extract R'th value
      UNTILH>97         unless point=(7,7) (*) or out of bounds ( )
          ORR*X*Y=0     or string exhausted ( ) or point on an axis (*)
          ORZ?R-37=H;   or translated value (2..74) matches our radius
    IFH<99ANDR>0        If match found and within bounds
      C=42              then set character := "*"
2   PRINT$C;            Print the character by its ASCII value
  NEXT;                 Loop until last column
NEXT;                   Loop until last row
LINK-29;                Call #FFE3 (OSRDCH) and discard input character
END;                    Exit program; base of table points to semicolon
EBW7b6i-m'o             Table of radii; never reached, REM not required

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

  7^2 + 1^2 == 5^2 + 5^2.

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