Commodore 128D User Manual page 334

Hide thumbs Also See for 128D:
Table of Contents

Advertisement

To simulate the rolling of a die, use the formula INT(RND(1 )*6 +1).
First the random number from 0 to 1 is multiplied by 6, which
expands the range to 0-6 (actually, greater than zero and less than
six). Then 1 is added, making the range greater than 1 and less than
7. The INT function truncates all the decimal places, leaving the
result as a digit from 1 to 6.
EXAMPLES:
PRINT RND(0)
.507824123
PRINT INT(RND(1)*100
89
X = RND(-Y)
Displays a random number
between 0 and 1.
1) Displays a random number
between 1 and 100.
Seeds random number generator for
different reproducible random
sequences.
u
u
RREG
—Returns register contents after a SYS command.
RREQ [a[, [x] [, [y] [,statusDD
This function returns the contents of the computer's internal register
after a SYS command. The contents of the a, x, y, and processor
status registers are assigned to the variable list.
EXAMPLE:
10 SYS DEC ("FF59"), 8
calls kernal routine "LKUPLA"
20 RREG A, X, Y, S
30 IFS and I then print "NOT FOUND": END
40 Print "FOUND:"; A; X; Y
The above example calls a standard kernel routine to check if a given
logical channel is in use. (In this case, logical file 8). If it isn't, "NOT
FOUND" is printed. If it is in use, "FOUND" is printed, and the logi
cal file number, device number, and secondary address of the chan
nel is printed.
RSPCOLOR
—Return sprite multicolor values
RSPCOLOR (register)
When:
X = 1 RSPCOLOR returns the sprite multicolor 1.
X = 2 RSPCOLOR returns the sprite multicolor 2.
326
BASIC 7.0 ENCYCLOPEDIA—Basic Functions

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 128D and is the answer not in the manual?

Table of Contents