Functions

BASIC-80

PEEK

The PEEK function reads a single byte from memory at the location specified. The corresponding POKE statement writes a byte into a specified memory location.

PEEK (expression)

PRINT PEEK(OFABH) 200

P~S

The POS function returns the position of the cursor after the last PRINT statement. The argument I is a dummy argument. The leftmost position is 1.

POS (integer)

10INPUT A$

20PRINT A$;

30IF POS(1) >10 THEN PRINT

40PRINT "HAS JUST BEEN INPUT" RUN

?AAAAA

AAAAA HAS JUST BEEN INPUT

OK

RUN ?AAAAAAAAAAA AAAAAAAAAAA

HAS JUST BEEN INPUT Ok

RIGHTS

The RIGHT$ function returns the rightmost I characters of string X$. If I equals or exceeds the length of X$, the entire string is the result. If I is 0, a null string results.

RIGHT$ (string,integer)

10A$ = "JOHN J. JONES"

20X$ = RIGHT$(A$,8)

30PRINT X$ RUN

J. JONES Ok

RND

The RND function returns a single precision random number between 0 and 1. The sequence produced is identical every time a program is run. If this is undesirable (such as in games) use RANDOMIZE to prompt the user for a seed.

RND

7-10

Page 74
Image 74
Intel 9800758-02 manual Rights, Peek expression, POS integer, RIGHT$ string,integer