Chapter
10
I
BASIC
Ke.ywords
PSET/PRESET/Graphics Statement
PSET
[STEP] (x,y)[,colorl
PRESET
[STEP] (x,y)[,colorl
Draws
a
point on the display.
The STEP option tells BASIC that the
(XJ)
coordinates are rela-
tive to the last point referenced.
(XJ)
specify the coordinates in which to draw the point.
X
is the
horizontal coordinate and
y
is
the vertical coordinate.
Color
specifies the color of the point.
See Chapter
8,
“Displaying Color and Graphics” for information
on coordinates and colors.
The only difference between the PSET and PRESET statements
is
the default values for
color.
If you use PSET,
color
defaults to
the foreground color. If you use PRESET,
color
defaults to the
background color.
Note:
BASIC does not print and does not issue an er-
ror message for points the coordinate values
of
which
are beyond the edge of the screen. However, values
outside the integer range (-32768 to 32767) cause an
overflow error.
Sample
Program
5
SCREEN
3
10
FOR
1=0
TO
100
20
PSET
(1,I)
30
NEXT
I’draw
a
diagonal line
to
(100,100)
40
FOR
I
=
100
TO
0
STEP
-1
50
PRESET
(1,1),0
60
NEXT
I
70 ‘clear
the
line
by
setting each pixel
to
0
80
SCREEN
0
Lines 10 to 30 draw a diagonal line on the screen from the home
position to Position 100,100. Lines 40 to 60 erase the line by
drawing another line at the same position in the background
color.
279