PATTERN
Archive contents:
-rw-rw-r-- 1 julie julie 1280 Dec 24 20:28 disc_image.ssd Disc image
-rw-rw-r-- 1 julie julie 2771 Dec 24 20:20 id.diz This file!
-rw-rw-r-- 1 julie julie 12974 Dec 24 20:22 listing1.png BASIC listing pt1
-rw-rw-r-- 1 julie julie 14557 Dec 24 20:23 listing2.png BASIC listing pt2
-rw-rw-r-- 1 julie julie 48 Dec 24 20:29 PATTERN Machine code
-rw-rw-r-- 1 julie julie 10386 Dec 24 20:23 result.png Result image
-rw-rw-r-- 1 julie julie 577 Dec 24 20:28 SOURCE Source ASCII
-rw-rw-r-- 1 julie julie 487 Dec 24 20:29 SOURCE.tok Source tokenised
Author: Julie Kirsty Louise Montoya <bluerizlagirl@gmail.com>
Category: Christmas Challenge
System: BBC Micro
Language: 6502 Assembler -- BBC BASIC native assembler
Len source code: 487 bytes (Tokenised)
577 bytes (ASCII text)
Len exe file: 48 bytes
Len code only: 48 bytes
Instructions:
Install, if necessary, and launch a BBC emulator such as BeebEm.
Load the file `disc_image.ssd` as a disc image in drive 0.
Make sure drive 0 is not write protected.
Load and run the source code file:
CHAIN "SOURCE"
The machine code will be assembled and saved onto the disc.
Once the code has been assembled, run it by typing at the BASIC prompt
*PATTERN
You may optionally press CTRL+L to clear the screen before you press
RETURN to enter the command.
Description:
The program draws the pattern
* * *
* * * * * *
* * * * * *
* * * *
* * * * * *
* * * * * *
* * *
* * * * * *
* * * * * *
* * * *
* * * * * *
* * * * * *
* * *
* * * * * *
* * * * * *
* * * *
* * * * * *
* * * * * *
* * *
on the screen.
A lookup table is used consisting of the following sequence:
19,20,21,22,21,20,19,20,21,22,21,20,19,20,21,22,21,20,19
For each of 19 rows, and each of 19 columns, the values in the table
corresponding to the row and column are added together, plus an extra
one; and if the sum is exactly 42, the ASCII code for a star, this is
printed. For any other sum, a space is printed. After each complete
row, a new line is started. Once the complete image is printed, the
program returns to the BASIC prompt with the cursor at the beginning
of the next line.
Comments:
The program should also work fine on an Acorn Electron, though this has
not been tested.
Anything I tried like reversing halfway through to keep the table small
seemed to wind up taking more bytes in code than it saved in data.
Sometimes a static table is just smaller than doing complex maths .....
Making the table add to 42 if we need to print a star was a last-minute
byte-saving effort.