Commodore 16 User Manual page 76

Hide thumbs Also See for Commodore 16:
Table of Contents

Advertisement

EXAMPLE
USR(X)
100 X=INT(FIND(1)*6)+INT(END(1)*6)+2
100 X=INT(RND(1)•1000)+
100 X+INT(END(1)4150)+100
Simulates 2 dice.
Number from 1-1000.
Number from 100-249.
When this function is used. the program lumps to a machine language
program whose starting point is contained in memory locations 1281
and 1282. The parameter X is passed to the machine language -
program in the floating point accumulator. Another number is passed
back to the BASIC program through the calling variable In other
words, this allows you to exchange a variable between machine code
and BASIC. See the Programmer's Reference Guide for more details
on this, and on machine language programming
SGN(X) (sign)
This function returns the sign, as in positive, negative, or zero, of X. The
result is + 1 if positive. 0 if zero, and - 1 if negative
SIN(X)
(sine)
This Is the trigonometric sine function. The result is the sine of X.
where X !s an angle In radians.
SQR(X)
(square root)
This function returns the square root of X, where X is a positive
number or 0. If X is negative. an ILLEGAL QUANTITY ERROR results.
TAN(X)
(tangent)
This gives the tangent of X. where X Is an angle in radians.
VAL(X$)
This function converts the string X$ into a number. and is essentially
the Inverse operation from STR$.
The
string is examined from the left-
most character to the right, for as many characters as are in recognizable
number format. If the Commodore 16 finds illegal characters, only the
portion of the string up to that point is converted
EXAMPLE
10 X=VAL("123.456")
X=123.456
10 X= VAL("3E03")
X=3000
10 X=VAL("12A1313")
X=12
10 X=VAL("RIU017"")
X=0
10 X =VAL("-1.23.23.23")
X=-1.23
148
r
149

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Commodore 16 and is the answer not in the manual?

Questions and answers

Table of Contents