Drawing
on
the
Screen
•
Code
Effect
8 colour 4 colour
0
black
black
1 blue black
2
red red
3
magenta
red
4 green
green
5
cyan green
6
yellow white
7
white white
•
•
For
example, INK 3 would give magenta
In
MODE 8 and red
in
MODE
4.
We
will
explain
in
a later chapter how the basic colours can be 'mixed'
In
various ways
to
produce a startling range of colours, shades and textures.
You
can get some interesting effects with random numbers which can be generated
RANDOM
EFFECTS
with the RND function.
For
example:
PRINT
RND(1
TO
6)
..
"
will
print a whole number
in
the range 1
to
6,
like throwing an ordinary six-sided dice.
The following program
will
Illustrate
thiS:
NEW"'II
10
LET
die
= RND(1
TO
6)
..
"
20
PRINT
die.'
RUN
"'11
If
you run the program several times you
will
get different numbers.
You
can get random whole numbers
in
any range you
like.
For
example:
RND(O
TO
100)
will produce a number which can be used
In
scale graphics.
You
can re-write the line
program so that
it
produces a random
colour.
Where the range of random numbers
starts from zero you can omit the
first
number and write:
RND(100)
NEW"'II
10
PAPER 7 :
CLS
..
"
20
INK
RND(S)
..
"
30
LINE
50,60
TO
RND(10OJ,
RND(100)
..
"
RUN
"'11
ThiS
produces a line starting somewhere near the centre of the screen and finishing
at some random point. The range of possible colours depends
on
which mode
is
selected.
You
will find that a range of numbers 'something
TO
something' occurs often
in
SuperBASIC.
The part of the screen
in
which
you
have drawn lines and create other output
is
called
BORDERS
a window. Later you
will
see how
you
can change the
size
and position of a window
or create other windows.
For
the present we shail
be
content
to
draw a border round
the current window. The smallest area of light or colour you can plot
on
the screen
is
called a pixel.
In
mode
8,
called low resolution mode, there are 256 possible pixel
positions across the screen and 256 down.
In
mode
4,
called high resolution mode,
there are
512
pixels across the screen and 256 down. Thus the
size
of a pixel depends
on the mode.
You
can make a border round the inside edge of a window by typing for example:
BORDER
4,2
..
"
This
will
create a border 4 pixels wide
in
colour red (code
2).
The effective
size
of the
window
is
reduced by the border This means that any subsequent printing or graphics
will
automatically
fit
Within
the new Window
size.
The only exception
to
this
is
a further
border which will overwrite the existing
one.
12/84
15