file_id.diz
COPO 1.0
Author: Victor Parada/vitoco
Category: Christmas Challenge
System: Atari XL/XE
Language: Atari BASIC (ROM in XL/XE computers)
Len source code: 176
Len exe file: 178
Len code only:
Instructions:
(1) Start the Atari emulator with Atari BASIC enabled and wait for the READY prompt.
(2) Copy the following two lines and paste them into the emulator (e.g. right-click on the blue screen and select "Paste"):
1GR.1:C.10:S=1:F.I=0TO3:R=1-2*(I>1):F.J=0TO4:REA.X,Y,V,W:A=9+X*S:B=9+Y*R:C=9+V*S:D=9+W*R
2PL.A,B:DR.C,D:PL.D,C:DR.B,A:N.J:S=-S:RES.:N.I:D.0,0,0,9,0,0,7,7,5,5,5,7,4,1,5,2,7,1,8,2
(3) Type RUN in an empty line and press the Enter key.
Description:
COPO DE NIEVE (SNOWFLAKE) displays a snowflake in Atari's double width text mode using PLOT and DRAWTO instructions to draw some lines between two given points in the screen. There are two loops: the inner loop to read each start and end coordinates relative to the center of the screen (9,9) and draw both a line and a diagonal reflection of it, and the outer loop to use the same data four times but with different signs for each axis in order to cover all four quadrants.
Comments:
The two lines listing is an abbreviated form of the Atari BASIC program's source code listing, not a tokenized form of it. When the LIST instruction is entered, the abbreviations in the listing are expanded to full words (instructions), giving two longer lines. The program in free text format (with comments) is the following:
. Enable big text mode:
graphics 1
. Select star character (*) as pixels:
color 10
. Set one axis for first quadrant:
s=1
. Loop 4 times with same data:
for i=0 to 3
. Set the other axis for a quadrant:
r=1-2*(i>1)
. Iterate to read 5 pairs of coordinates:
for j=0 to 4
. Read each pair of coordinates:
read x,y,v,w
. Compute position of each coordinate in current quadrant:
a=9+x*s
b=9+y*r
c=9+v*s
d=9+w*r
. Draw a line:
plot a,b
drawto c,d
. Draw the reflection of the same line:
plot d,c
drawto b,a
next j
. Change to another quadrant:
s=-s
. Reset the pointer for the data to read it again:
restore
next i
. 5 pairs of coordinates:
data 0,0,0,9,0,0,7,7,5,5,5,7,4,1,5,2,7,1,8,2
The included copo.atr file is an Atari disk image that includes the abbreviated source file COPO.LST (178 bytes). To load the program from that file, drag the ATR file and drop it into the emulator screen to boot. Once the READY prompt appears, type ENTER "D:COPO.LST" and then RUN to start it.