From
Basic
to
SuperBASIC
RECTANGLES
AND
LINES
normally provides a space but not
at
the start
of
line.
If
an
item
will
not
fit
at
the
end
of
a line
it
performs a new line operation.
10
Allows tabulation
to
a deSignated column position.
The
program below draws a green rectangle
In
256 mode
on
red
paper
with
a
yellow
border one pixel
wide.
The rectangle
has
its
top
left
corner
at
pixel co-ordinates
100,100
(see
OL Concepts).
Its
Width
is
80 units across
(40
pixels)
and
Its
height
is
20 units down
(20
pixels).
100 REMark
RectangLe
110
MODE
256
120
BORDER
1,6
130
PAPER
2 : C
LS
140
BLOCK
80,20,100,100,4
You
have
to
be a bit caretul
In
mode 256 because across values range
from
0
to
511
even
though there
are
only 256
pixels.
We
cannot
say
that the block produced by the
above program
is
80 pixels wide
so
we
say
80
Units.
SuperBASIC has the usual LET, INPUT, READ and
DATA
statements
for
input The
INPUT
AND
OUTPUT
PRINT statement handles most
text
output
In
the usual
way
with
the
separators:
tabulates output
Just
separates -
no
formatting effect
forces new line
•
•
FOR SERVICE MANUALS
CONTACT:
MAURITRON
TECHNICAL
SERVlCEf
www.maurilron.co.uk
TEL:
01844
-
351694
FAX:
01844
-
352554
•
You
will
be familiar
With
two
types
of
repetitive loop exemplified
as
follows:
(a)
Simulate 6 throws
of
an
ordinary six-sided
die.
100
FOR
throw
= 1
TO
6
110 PRINT
RND(1
TO
6)
120
NEXT
throw
(b)
Simulate throws
of
a die
until
a
six
appears.
100
die
= RND(1
TO
6)
110PRINTdie
120
IF
die
<>
6
THEN
GOTO
10
Both
of
these
programs
will
work
in
SuperBASIC
but
we
recommend
the
following
instead.
They
do exactly
the
same jobs. Although program
(b)
is
a little more complex there
are
good reasons for preferring it
(a)
100
FOR
throw
= 1
TO
6
110 PRINT
RNO(1
TO
6)
120
END
FOR
throw
(b)
100 REPeat
throws
110
die=RND(1T06)
120 PRINT
die
130
IF
die
= 6
THEN
EXIT
throws
140
END
REPeat
throws
It
is
logical
to
provide a structure
for
a loop which terminates on a condition (REPeat
loops)
as
well
as
those which
are
controlled by a count
The fundamental REPeat structure
is:
LOOPS
REPeal identifier
statements
END REPeat identifier
The EXIT statement can be placed anywhere
in
the
structure but
it
must be followed
by
an
identifier
to
tell
SuperBASIC which loop
to
exit;
for example:
EXIT throws
would transfer control
to
the
statement
after
END REPeat throws.
This
may seem
like
a
uSing
a sledgehammer
to
crack the nut
of
the simple problem
illustrated. However the REPeat structure
is
very powerful.
It
will
take
you
a long
way.
12/84
43