EasyManua.ls Logo

Commodore 128 - Page 338

Commodore 128
448 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
MIDS
Return a substring from a larger string or overlay a substring into
a larger string
MID$ (string,starting position[,length])
This function returns a substring specified by the LENGTH,
starting at the character specified by the starting position. The
starting position of the substring defines the first character where
the substring begins. The length of the substring is specified by
the length argument. Both of the numeric arguments can have
values ranging from 0 to 255. If the starting position value is
greater than the length of the string, or if the length value is zero,
then MID$ returns a null string value. If the length argument is left
out, all characters to the right of the starting position are returned.
EXAMPLE:
PRINT MID$(COMMODORE 128,3,5)
MMODO
EXAMPLE using overlay:
A$=123456:MID$(A$,3,2)=ABCDE:PRINT A$
12AB56
Note: overlay cannot be used to expand the size of a string, thus
in the example above MID$(A$,3,5) is not possible.
PEEK
Return contents of a specified memory location
PEEK(X)
This function returns the contents of memory location X, where X
is located in the range 0 to 65535, returning a result between 0
and 255. This is the counterpart of the POKE statement. The data
will be returned from the bank selected by the most recent BANK
command. See the BANK command.
EXAMPLE:
10 BANK 15:VIC=DEC(D000)
20 FOR I = 1 TO 47
30 PRINT PEEK(VIC + I),
40 NEXT
18-10

Table of Contents

Other manuals for Commodore 128

Related product manuals