Diamond for Atari 8-bit computers in FastBasic
Author: dmsc
Category: Christmas Challenge
System: Atari 8-bit
Language: FastBasic
Len source code: 48
Len exe file: N/A
Len code only: N/A
Instructions:
With the provided ATR floppy disk image, type FB to load FastBasic, then load
the source file pressing CONTROL-L and typing "D:DIAMOND.FB", and finally run
the program by pressing CONTROL-R
After the program runs, press the BREAK key to interrupt and return to the
FastBasic IDE with any key.
Description:
This program calculates the position of the stars to draw using the following
formula for each value of N:
X = ABS((N + 4) MOD 36 - 18)
Y = N MOD 30 - 11
Any negative value of X and Y is ignored by the Atari OS, this restrict the
output to the needed coordinates.
This is the "expanded" source code of the program:
DO
INC N
POSITION ABS((N + 4) MOD 36 - 18), N MOD 30 - 11
? "*";
LOOP
Comments:
FastBasic is a good language to write small source code, as all keywords can
be abbreviated, and the language does not use line numbers. For example,
here, we use "POS." as abbreviation for "POSITION", "A." to abbreviate
"ABS()" and "M." to abbreviate "MOD"
You can compile a standalone executable from the FastBasic IDE by pressing
CONTROL-W and typing any name ending on ".COM".