fire= 128 +
LEFT 7
UP
I
8
6
3
RIGHT
5
DOWN
EXAMPLE:
IOY{2) with value
ol 135 fires joystick
#2 lo the
lett
LOG(X) (logarithm)
This returns
the
natural
log of
X
The
natural log is log to the
base e
(see EXP(X)J To
convert to
log
base 1
0, divide by
LOGO 0).
PEEK(X)
This (unction
gives tne
contents ol memory location X, where
X is
located in the range
ol to
65535,
returning
a result from to 255. This
is often used in conjunction
with the POKE
statement.
RCLR(N)
Returns current colour
assigned
to source N (0
=
< N
=
<
4)
(0-background,
1
-foreground.
2=multicolour
1, 3=multicolout
2.
4=
border)
RDOT(N)
Returns Information
about the current position
of the pixel cursor (PC)
at
XPOS/YPOS.
i
46
[
I
I
r
(
I
I
I
I
I
I
1
,11
I
I
I
I
N-OtorXPOS
1 for YPOS
2
colour source
RGB(X)
Returns current grannie mode (X
Is
a
dummy argumenl and
can
be
any
value.)
RLUM(N)
Returns
current luminance level assigned to
colour source N
I
i
[
(
I
I
I
1
1 1
1
t
1 1
i
r
i
i
RND(X)
(random number)
Thi6 function
returns
a
random number between and 1 .
This is useful
in games, to
simulate
dice
roils and other
elements
of
chance, and is
also used
ir some statistical applications. The
first random
number
should
be
generated by the formula
RND(-TI),
to
stan things
off
differently every time.
After this,
the
number In
X
should
be a
1
.
or any
positive number. (X
represents the seed, or what the
RaNDom number
is based on ) If X
is
zero.
RND is re-seeded from
the hardware clock
every
time
RND is used. A
negative
value
lor
X seeds the random
number generator using X
and gives
a
random
number sequence. The
use o'
the same
negative number for X
as a
seed results in
the same
sequence of
random numbers. A positive value
gives random numbers
based
on
the
previous
seed.
To
simulate the rolling of
a
die, use the
formula INT(RND<1
J*6+l
).
First
the
random number from
0-1
Is multiplied by 6.
which expands the
range
lo
0-6 (actually, grealer than zero
and less then
six) Then
1
is
added,
making the range 1 to
under 7 The
INT function chops off
all
the decimal places,
leaving
the
result as a
oigit from 1
to 6
To simulate 2
dice,
add
two of the
numbers oblained
by
the above
lormula together
1
47