ARRAYFILL n&(),n&                                      p. 30

In: n&() - a number array.
    n&   - a number.    

Result: Sets every element of n&() = n&.

DIM n&(20)                    ! dimension a word array
ARRAYFILL n&(),70             ! set every element of n&() = 70

*****
ASC(s$)                                                p. 32

In: s$ - a string$.
Out: the ASCII code of the first character in s$.


s$="Fish"             ! set s$ = to "Fish"
'
PRINT ASC(s$)

70                    ! the ASCII code of "F" is 70

*****
BIN$(n%,l&)                                            p. 34

In: n% - an integer.
    l& - length of string returned.

Out: a string  

Converts the number n% to binary and returns it as a string of
    length l&.

s$=BIN$(4,8)
PRINT s$

00000100

PRINT BIN$(5)

101

*****
CFLOAT(n%)                                             p. 38

In: an integer.
Out: a floating point number.


PRINT CFLOAT(12)

12

PRINT CFLOAT(12)+.17

12.17


*****
CHR$(n&)                                               p. 32

In: an integer
Out: 1 character

PRINT CHR$(71)

G                      ! the ASCII code for "G" is 71

*****
CINT(n)                                                p. 38

In: a floating point number.
Out: a rounded integer.


PRINT CINT(23.5)

24

PRINT CINT(23.4)

23

*****
CVD(s$)                                                p. 36

In: an 8 character string.
Out: a floating point number.

Used to convert an 8 character string to a floating point number.

*****
CVF(s$)                                                p. 36

In: a 6 character string.
Out: a floating point number.

Used to convert a 6 character string to a floating point number.

*****
CVI(s$)                                                p. 36

In: a 2 character string.
Out: an integer.

Used to convert a 2 character string to an integer.

*****
CVL(s$)                                                p. 36

In: a 4 character string.
Out: an integer.

Used to convert a 4 character string to an integer.

*****
CVS(s$)                                                p. 36

In: a 4 character string.
Out: a floating point number.

Used to convert a 4 character string to a floating point number.

*****
DFREE(n&)                                              p. 152

In: n& - a drive number.
Out: free bytes on drive n&

n&=0  Current drive
n&=1  A:\
n&=3  C:\

PRINT DFREE(0)     ! returns the free space on the current partition

*****
DIM s$(1000)                                           p. 28


DIM s$(20)     ! dimensions a string array, index 0 to 20

*****
DIM?(x())                                              p. 28


DIM n(20)        ! dimension a floating point array, index 0 to 20
'
PRINT DIM?(n())
21               ! 21 elements are in n()

*****
DPEEK(n)                                               p. 40

In: RAM address.
Out: 2 bytes beginning from the RAM address n.

NOTE: Use even addresses only.

*****
DPOKE a,n                                              p. 40

In: a - a RAM address.
    n - a 2 byte number.

Result: writes n to RAM beginning with address a.

NOTE: Use even addresses only.

*****
EXIT IF TRUE                                           p. 213

   Used to exit a loop.

a&=-1
b&=0
DO
  a&=b&+1
  b&=a&
  EXIT IF a&=10
LOOP

This loop will be exited when a&=10

*****
HARDCOPY                                               p. 189

 Sends a screen dump to the printer.

*****
HEX$(n%,l&)                                            p. 34

In: n% - an integer.
    l& - length of string returned.

Out: a string  

Converts the number n% to a hexadecimal number and returns
   it as a string of l& length.

PRINT HEX$(17)

11

n%=17
s$=HEX$(n%,5)
PRINT s$

00011

*****
HIDEM                                                  p. 186

 Hides the mouse.

*****
LEFT$(s$,n&)                                           p. 114

In: s$ - a string.
    n& - the number of characters to return.

Out: the first n& characters of s$.

PRINT LEFT$("12345",3)

123

PRINT LEFT$("abcd")

a

*****
LEN(s$)                                                p. 140

In: a string.
Out: the number of characters in s$, length of s$.

PRINT LEN("1234567890")

10

*****
LPEEK(n)                                               p. 40

In: RAM address.
Out: 4 bytes from RAM beginning from address n.

NOTE: Use even addresses only.

*****

LPOKE a,n                                              p. 40

In: a - RAM address.
    n - a 4 byte number.

Result: writes n to RAM beginning with address a.

NOTE: Use even addresses only.

*****
LPRINT                                                 p. 189

 Outputs to the printer.

LPRINT "Cats";
LPRINT " are cool"

Cats are cool        ' is sent to the printer

*****
MID$(s$,p&,n&)                                         p. 115

In: s$ - a string.
    p& - starting position in s$.
    n& - number of characters to return.

Out: n& characters from s$ starting at character p&.

PRINT MID$("Fun Sun Run",5,3)

Sun

PRINT MID$("Fun Sun Run",5)

Sun Run

*****
MKD$(n)                                                p. 36

In: a floating point number.
Out: an 8 character string.

Used to convert a floating point number to an 8 character string.

*****
MKF$(n)                                                p. 36

In: a floating point number.
Out: a 6 character string.

Used to convert a floating point number to a 6 character string.

*****
MKI$(n)                                                p. 36

In: an integer.
Out: a 2 character string.

Used to convert an integer to a 2 character string.

*****
MKL$(n)                                                p. 36

In: an integer.
Out: a 4 character string.

Used to convert an integer to a 4 character string. 

*****
MKS$(n)                                                p. 36

In: a floating point number.
Out: a 4 character string.

Used to convert a floating point number to a 4 character string.

*****
MOUSE x&,y&,p&                                         p. 183

Out: x& - mouse X position.
     y& - mouse Y position.
     p& - mouse button pressed.

Result: Returns the mouse X, Y positions in pixels, and
        the mouse button pressed.

 0 - no mouse buttons pressed.
 1 - left mouse button pressed.
 2 - right mouse button pressed.
 3 - both mouse buttons pressed.

*****
MOUSEK                                                 p. 183

Out: the mouse button pressed.

 Returns a number (0-3)
 0 - a mouse button was not pressed.
 1 - the left mouse button was pressed.
 2 - the right mouse button was pressed.
 3 - both mouse buttons were pressed.

n&=MOUSEK

*****
MOUSEX                                                 p. 183

Out: mouse position, horizontal.

Result: Returns the mouse position in pixels, horizontal.


n&=MOUSEY

*****
MOUSEY                                                 p. 183

Out: mouse position, vertical.

Result: Returns the mouse position in pixels, vertical.


n&=MOUSEY

*****
OCT$(n%,l&)                                            p. 34

In: n% - an integer.
    l& - length of string returned.

Out: a string  

Converts the number n% to octal and returns it as a string.

PRINT OCT$(8)

10

n%=8
s$=OCT$(n%,5)
PRINT s$

00010

*****
OPTION BASE


OPTION BASE 0
DIM n&(20)           the first element of n&() is n&(0)


OPTION BASE 1
DIM n1&(20)          the first element of n1&() is n1&(1)

*****
PEEK(n)                                                p. 40

In: RAM memory address.
Out: one byte from RAM

*****
POKE a,n                                               p. 40

In: a - RAM address.
    n - a 1 byte number.

Result: writes n to RAM at address a.

*****
PRED(s$)                                               p.116

In: a string, an integer.
Out: the ASCII character before the first character in s$.
     the integer - 1.

PRINT PRED("cows")

b

PRINT PRED(5)

4

*****
RIGHT$(s$,n&)                                          p. 114

In: s$ - a string.
    n& - the number of characters to return.

Out: the last n& characters of s$.

PRINT RIGHT$("12345",3)

345

PRINT RIGHT$("abcd")

d

*****
SETMOUSE x&,y&,p&                                      p. 185

IN: x& - pixels, horizontal.
    y& - pixels, vertical.
    p& - the mouse button press.

Result:  Positions the mouse at pixel x&,y& and can be 
         used to simulate a mouse button press.

*****
SHOWM                                                  p. 186

 Turns the mouse on.

*****
SPC(n&)                                                p. 120

In: n& - a number.

Result: Puts n& spaces in a print statement.

PRINT "Hi";SPC(2);"there"

HI  there

*****
STR$(n,l&,r&)                                          p. 33

In: n  - a number.
    l& - length of returned string.
    r& - number of decimal places rounded to.

Out: a string.
    
Converts the number n& to a string of length l&, and rounded to
         r& decimal places.


PRINT STR$(456.234501)

456.234501

PRINT STR$(456.234501,8,2)

  456.23

*****
STRING$(n&,s$)                                         p. 120
STRING$(n&,c&)

In: n& - length of string returned.
    s$ - the character to be propagated.
    c& - the ASCII code of the character to propagate. 

Out: a string.

Result: Creates a string n& characters long. The character in s$
        in used to fill the created string.

PRINT STRING$(3,"c")
ccc

PRINT STRING$(3,99)
ccc

*****
SUCC(s$)                                               p. 116

In: a string, an integer.
Out: the ASCII character after the first character in s$.
     the number + 1.

PRINT SUCC("dogs")

e

PRINT SUCC(5)

6

*****
SWAP a&,b&                                             p. 50
SWAP a$(),b$()

In: two variables or arrays of the same type.

Result: Swaps the values in a& and b&.

a&=20
b&=1
SWAP a&,b&
PRINT a&'b&

20 1             

*****
TRIM$(s$)                                              p. 117

In: a string.

Out: a string. 

Result: Trims spaces from the ends of a string.

PRINT TRIM$("  Go  ")+"slow"

Goslow

*****
UPPER$(s$)                                             p. 121

In: a string.

Out: a string.

Result: Changes lower case letters in s$ to upper case.

PRINT UPPER$("Fun !!")

FUN !!

*****
VAL(s$)                                                p. 35

In: a string.

Out: a number.

     Converts a string into a number

s$="123sd34"
n&=VAL(s$)
PRINT n&

123                

*****
VAL?(s$)                                               p. 35

In: a string.

Out: a number.

     Returns the number of characters that can be converted
         into a number.

s$="123er44"
PRINT VAL?(s$)

3                      ! the first 3 characters can be
                       ' converted into a string.

*****
CLEAR                                                  p. 48

Result: initializes all arrays and variables.

DIM s$(1)
s$(0)="Hi Mom"
s$(1)="Hi Dad"
n=2.54
'
CLEAR
'
PRINT s$(0)'s$(1)'n

  0

*****
CLR n,s$                                               p.48

In: a list of variables.

Result: the variables in the list are initialized.

n=2.75
s$="Cows are big"
'
CLR n,s$
'
PRINT n's$

0

*****
ERASE n(),s$()                                         p.48

In: a list of arrays

Result: the arrays in the list are nuked.

DIM s$(10)
DIM n(20)
'
ERASE n(),s$()
'
PRINT n(0)           ! this line produces an error 
                     ' n() does not exist.

*****
INSERT n(p&)=n                                         p.54

In: n() - an array.
    p&    - an index to the array.
    n     - a value to be inserted in the array.

Result: n(p&)   is moved to n(p&+1)
        n(p&+1) is moved to n(p&+2)
        ect.

The value in the last element of the array is throw away.
The new value n is inserted at n(p&)

*****
DELETE n(p&)                                           p.54

In: n() - an array.
    p&  - an index to the array.

Result: n(p&+1) is moved to n(p&)
        n(p&+2) is moved to n(p&+1)
        ect.

The value in the last element of the array is initialized.

*****
DATE$                                                  p.57

Result: reads/sets the computer date.

MODE 1
PRINT DATE$

03/28/1992         ' month/day/year

MODE 0
DATE$="28.03.1992" ' day/month/year

*****
TIME$                                                  p.57

Result: reads/sets the computer time.

PRINT TIME$

18:34:20            ' hours:minutes:seconds

TIME$="18:34:20"

*****
SETTIME t$,d$                                          p.57

Result: sets the time and date.

PRINT "Please update the time ";
t$=TIME$
FORM INPUT 20 AS t$
PRINT "Please update the date ";
d$=DATE$
FORM INPUT 20 AS d$
'
SETTIME t$,d$

*****
TIMER                                                  p.57

Out: returns the length of time since the computer 
     was turned on in 1/200 of a second.

This is great for timing whatever.

begin_time=TIMER
'
' some task
'
end_time=TIMER
PRINT (end_time-begin_time)/200 

*****
FRE(0)                                                 p.61

Result: a "Garbage Collection" is executed, then the amount
        of free RAM is returned.

PRINT FRE(0)

62333               ' free ram in bytes

*****
ABS(n)                                                 p.88

In: a number.
Out: the absolute value (distance from zero) of n.

PRINT ABS(-21.7)

21.7

n=23.454
PRINT ABS(n)

23.454

*****
SGN(n)                                                 p.88

In: a number.
Out: if n < 0     return -1
     if n = 0     return  0
     if n > 0     return  1

n=0
IF SGN(n)=-1 THEN
  PRINT "n is a negative number"
ELSE IF SGN(n)=0
  PRINT "n is equal to zero"
ELSE
  PRINT "n is a positive number"
ENDIF

n is equal to zero

*****
ODD(n)                                                 p.89

In: a number.
Out: if n = an odd number     return True
     if n = an even number    return False 
     if n = 0                 return False

n=20
IF ODD(n)
  PRINT "The number is odd"
ELSE
  PRINT "The number is even or zero"
ENDIF

The number is even or zero

*****
EVEN(n)                                                 p.89

In: a number.
Out: if n = an even number    return True
     if n = an odd number     return False 
     if n = 0                 return True

n=20
IF EVEN(n)
  PRINT "The number is odd"
ELSE
  PRINT "The number is even or zero"
ENDIF

The number is even or zero

*****
INT(n)                                                 p. 90

In: a number.
Out: an integer.
     if n = an integer then return n
     if n = a real number then round n down to an integer.

PRINT INT(-2.005)
-3

PRINT INT(2.99)
2

*****
TRUNC(n)                                               p. 90

In: a number.
Out: an integer.

Result: any digits to the right of the decimal place are
         chopped off.

PRINT TRUNC(12)
12

PRINT TRUNC(-12.99)
-12

*****
FIX(n)                                                 p. 90

In: a number.
Out: an integer.

Result: any digits to the right of the decimal place are
         chopped off.

PRINT FIX(12)
12

PRINT FIX(-12.99)
-12

*****
FRAC(n)                                                p. 90

In: a number.
Out: a number.

Result: returns the digits to the right of the decimal.

PRINT FRAC(12.123)
0.123

PRINT FRAC(-12.123)
-0.123

*****
ROUND(n,dp&)                                           p. 91

In: n   - a number.
    dp& - an integer, number of decimal places.

Out: a number, n rounded to dp& decimal places.

PRINT ROUND(-12.49)
-12

PRINT ROUND(12.5)
13

PRINT ROUND(12.4919,3)
12.492

PRINT ROUND(112.4919,-2)
100

*****
MIN(a&,b&,c&)                                          p. 92

In: a list of numbers or strings.
Out: a number or string, the smallest in the list.

PRINT MIN(2,3,5,1,7)
1

PRINT MIN("a","A") 
A

*****
MAX(a$,s$,n$)                                          p. 92

In: a list of numbers or strings.
Out: a number or string, the largest in the list.

PRINT MIN(2,3,5,1,7)
7

PRINT MIN("a","A") 
a

*****
SQR(n)                                                 p. 93

In: a non negative number.
Out: a number, the square root of n.

PRINT SQR(25)
5

PRINT SQR(0)
0

PRINT SQR(-1)
ERROR MESSAGE

*****
EXP(n&)                                                p. 94

In: a number.
Out: a number, e to the power of n&

PRINT EXP(1)
2.718281828459

PRINT EXP(0)
1

*****
LOG(n)                                                 p. 94

In: a number greater than 0.
Out: a number.

PRINT LOG(0)
ERROR MESSAGE

PRINT LOG(2)
0.6931471805599

*****
LOG10(n)                                               p.94

In: a number greater than 0.
Out: a number.

PRINT LOG10(0)
ERROR MESSAGE

PRINT LOG10(100)
2

*****
SIN(n)                                                 p. 95

In: a number, unit - radians
Out: a number, the SIN of n

PRINT SIN(PI/2))
1

PRINT SIN(PI)
0

*****
COS(n)                                                 p. 95

In: a number, unit - radians
Out: a number, the COS of n

PRINT COS(PI/2)
-1

PRINT COS(PI)
0

*****
TAN(n)                                                 p. 95

In: a number, unit - radians
Out: a number, the TAN of n

PRINT TAN(0)
0

PRINT TAN(RAD(90))
ERROR MESSAGE

Note: RAD(n) - converts degrees to radians.

*****
ASIN(n)                                                p. 95

In: a number
Out: a number, the ASIN of n, unit - radians.

PRINT DEG(ASIN(1))
90

PRINT DEG(ASIN(-1))
-90

Note: DEG(n) - converts radians to degrees.

*****
ACOS(n)                                                p. 95

In: a number
Out: a number, the ACOS of n, unit - radians.

PRINT DEG(ACOS(1))
0

PRINT DEG(ACOS(-1))
180

Note: DEG(n) - converts radians to degrees.

*****
ATAN(n)                                                p. 95

In: a number
Out: a number, the ATAN of n, unit - radians.

PRINT DEG(ATN(1))
45

PRINT DEG(ATN(-1))
-45

Note: DEG(n) - converts radians to degrees.

*****
DEG(n)                                                 p. 95

In: a number, unit - radians
Out: a number, unit - degrees

Converts radians to degrees.

PRINT DEG(PI)
180

PRINT DEG(PI/2)
90

*****
RAD(n)                                                 p. 95

In: a number, unit - degrees
Out: a number, unit - radians

Converts degrees to radians.

*****
SINQ(n)                                                p. 95

In: a number, unit - degrees
Out: a number, the approximate SIN of n

PRINT SINQ(-90)
-1

PRINT SINQ(270)
-1

*****
COSQ(n)                                                p. 95

In: a number, unit - degrees
Out: a number, the approximate COS of n

PRINT COSQ(180)
-1

PRINT COSQ(-180)
-1

*****
RND                                                    p. 97

Out: a random number, 0 =< RND < 1

*****
RANDOM(n)                                              p. 97

In: a number.
Out: a random integer, 0 =< RANDOM(n) < n

*****
RAND(n)                                                p. 97

In: an integer, 0 <= n <= 65535
Out: a random integer, 0 <= RAND(n) < n

*****
RANDOMIZE(n)                                           p. 97

In: a number
Result: the random number generator is initialized 
        with the number n.

*****
DEC n                                                  p. 100

In: a numeric variable
Result: n = n - 1

n&=20
DEC n&
PRINT n&

19

*****
INC n                                                  p. 100

In: a numeric variable
Result: n = n + 1

n&=20
INC n&
PRINT n&

21

*****
ADD n,a                                                p. 101

In: n - a numeric variable
    a - a number

Result: n = n + a

n&=30
a&=7
ADD n&,a&
PRINT n&

37

***** 
SUB n,a                                                p. 101

In: n - a numeric variable
    a - a number

Result: n = n - a

n&=30
a&=7
SUB n&,a&
PRINT n&

23

*****
MUL n,a                                                p. 101

In: n - a numeric variable
    a - a number

Result: n = n * a

n&=20
a&=5
MUL n&,a&
PRINT n&

100

*****
DIV n,a                                                p. 101

In: n - a numeric variable
    a - a number

Result: n = n / a

n&=20
a&=5
DIV n&,a&
PRINT n&

4

*****
ADD(n&,a&)                                             p. 103

In: n& - an integer numeric variable
    a& - an integer

Result: n& = n& + a&

n&=20
ADD(n&,3)
PRINT n&

23

*****
SUB(n&,a&)                                             p. 103

In: n& - an integer numeric variable
    a& - an integer

Result: n& = n& - a&

n&=20
SUB(n&,3)
PRINT n&

17

*****
MUL(n&,a&)                                             p. 103

In: n& - an integer numeric variable
    a& - an integer

Result: n& = n& * a&

n&=20
MUL(n&,3)
PRINT n&

60

*****
DIV(n&,a&)                                             p. 103

In: n& - an integer numeric variable
    a& - an integer

Result: n& = n& / a&

n&=21
DIV(n&,3)
PRINT n&

7

*****
MOD(n&,a&)                                             p. 103

In: n& - an integer numeric variable
    a& - an integer

Result: n& = n& MOD a&

n&=21
MOD(n&,10)
PRINT n&

1

*****
INSTR(string$,search_string$,pos&)                     p. 118

Note: the search is from left to right.

In: string$ - the string to search.
    search_string$ - the string search for.
    pos& - start the search at this character.

Out: if the search string is not found 
        return - 0
     else 
        return - the position where the search string was found

PRINT INSTR("abc123","23",3)
5

PRINT INSTR("abc123","23",6)
0

*****
RINSTR(string$,search_string$,pos&)                     p. 119

Note: the search is from right to left.

In: string$ - the string to search.
    search_string$ - the string search for.
    pos& - start the search at this character.

Out: if the search string is not found 
        return - 0
     else 
        return - the position where the search string was found

PRINT RINSTR("abc123","23",3)
0

PRINT RINSTR("abc123","23",6)
5

*****
SPACE$(n&)                                             p. 120

In: an integer.

Out: a string.

Result: a string n& characters long is returned.
        all the characters are spaces.

s$=SPACE$(3)+"Hi Mom"
PRINT s$
   Hi Mom

*****
SPC$(n&)                                               p. 120

In: an integer.

Out: a n& spaces.

Result: n& spaces to use with PRINT

PRINT SPC(3);"Hi Mom"
   Hi Mom

*****
LSET s$=string$                                        p. 122

In: s$ - a string of specific length.
    string$ - the string to left justify.

Result: string$ is placed in s$, the length of s$
        remains the same, spaces are added to the right
        if the length of string$ is less then the length
        of string$.

s$=SPACE$(4)
string$="12"
LSET s$=string$
PRINT s$;"..."
PRINT string$;"..."

12  ...
12...

***** 
RSET s$=string$                                        p. 122

In: s$ - a string of specific length.
    string$ - the string to left justify.

Result: string$ is placed in s$, the length of s$
        remains the same, spaces are added to the left
        if the length of string$ is less then the length
        of string$.

s$=SPACE$(4)
string$="12"
RSET s$=string$
PRINT s$;"..."
PRINT string$;"..."

  12...
12...

***** 
INKEY$                                                 p. 126

Result: reads a key press from the keyboard.

REPEAT
  key_press$=INKEY$
  IF key_press$<>""        ! Only characters "0" - "9"
    IF key_press$>="0"     ! can be PRINTed to the 
      IF key_press$<="9"   ! screen.  All others are  
        PRINT key_press$   ! filtered out.
      ENDIF                
    ENDIF
  ENDIF
UNTIL key_press$=CHR$(27)  ! <Esc> exits the loop 

*****
INPUT s$,n&                                            p. 127

In: s$ - text or a string.
    n& - a variable.

Result: User input from the keyboard.

INPUT "Enter your name: ",name$

INPUT "Enter your age: ",age&

prompt$="Enter your shoe size: "
INPUT prompt$,shoe

*****
LINE INPUT s$,string$                                  p. 129

In: s$ - text or a string.
    string$ - a string variable.

LINE INPUT "Enter last, first name: ",name$

Note: Allows the user to enter commas in the
      string entered.

      Only string variables can be used.

*****
FORM INPUT n&,s$                                       p. 130

In: n& - maximum length of s$.
    s$ - string the user inputs.

PRINT "Enter a 5 letter word: ";
FORM INPUT 5,word$               ! The user can enter only 
                                 ! five characters. 

*****
FORM INPUT n& AS s$                                    p. 130

In: n& - maximum length of s$.
    s$ - string the user inputs/edits.

PRINT "Enter a 5 letter word: ";
FORM INPUT 5,word$               ! The user can enter only 
'                                ! five characters. 
WHILE LEN(TRIM$(word$))<5
  PRINT "This is not a 5 letter word.  ";
  PRINT "Please enter a 5 letter word: ";
  FORM INPUT 5 AS word$ 
WEND

*****
PRINT s$                                               p. 131

In: numeric or string variables.

Result: the value or contents of the variable
        is sent to the screen.

n=1.2
s$="Hi Mom"
s1$="*/*/*/*/"
PRINT n's$
PRINT
PRINT s$;
PRINT s1$

1.2 Hi Mom

Hi Mom*/*/*/*/

*****
LOCATE x&,y&                                           p. 131

In: x& - an integer, range 1 - 80
    y& - an integer, range 1 - 25

Result: the next PRINT instruction will start at
        this screen/window location.

LOCATE 1,1
PRINT "Top Left Corner"


LOCATE 80,1
PRINT "Top Right corner"

*****
WRITE s$                                               p. 131

In: numeric or string variables.

Result: the value or contents of the variable
        is sent to the screen.

n&=21
s$="jkl"
WRITE "abc","def",21;
PRINT "ghi"
WRITE s$

"abc","def",21ghi
"jki"

*****
PRINT USING mask$,s$,n&

In: mask$  - a print templete.
    s$, n& - string or numeric variables.

mask$="Tape: #,###     Title: \           \     Cost: $##.##"
tape&=178
title$="Fishing"
cost=5.9
PRINT USING mask$,tape&,title$,cost

Tape:   178     Title: Fishing           Cost:  $5.90

*****
MODE n&                                                p. 136

In: n& - an integer, range 0 - 3

Result: sets the way PRINT USING formats real numbers.
        Also how the DATE$ is displayed.  

PRINT DATE$
PRINT USING "##,###.##",21230.93
'
MODE 1
PRINT
PRINT DATE$
PRINT USING "##,###.##",21230.93

20.04.1990     ! MODE 0   is the default mode
21,230.93

20/04/1990
21,230.93

*****
CHDRIVE n&                                             p. 152

In: n& - a drive number.
Result: drive n& becomes the current drive.

n&=0  Current drive
n&=1  A:\
n&=3  C:\

CHDRIVE 1     ! A:\ becomes the current drive

*****
CHDRIVE s$                                             p. 152

In: s$ - a drive letter.
Result: drive s$ becomes the current drive.

s$="A"  A:\
s$="C"  C:\

path$="A:\FOLDER"
CHDRIVE LEFT$(path$)     ! A:\ becomes the current drive

*****
CHDIR s$                                               p. 152

In: s$ - a directory path.
Result: directory s$ becomes the current directory.

path$="A:\FOLDER"
CHDRIVE LEFT$(path$)     ! A:\ becomes the current drive
CHDIR path$              ! A:\FOLDER becomes the current directory

*****
DIR$(n&)                                               p. 152

In: n& - a drive number.

Out: a string - returns the current directiory for drive n&.

n&=0  Current drive
n&=1  A:\
n&=3  C:\

path$="A:\FOLDER"
CHDRIVE LEFT$(path$)     ! A:\ becomes the current drive
CHDIR path$              ! A:\FOLDER becomes the current directory

PRINT DIR$(0)            ! print the current directory of the 
                         ! current drive.
A:\FOLDER

*****
MKDIR s$                                               p. 158
                                          
In: a string - the compleate path of a folder.

Result: a new folder is created on disk.

MKDIR "C:\FUN.S"         ! folder FUN.S is created on drive C:\
MKDIR "C:\FUN.S\PETS"    ! folder PETS is created inside folder
                         ! FUN.S

*****
RMDIR s$                                               p. 158
                                          
In: a string - the compleate path of a folder.

Result: a compleatly empty folder is deleted from disk.

MKDIR "C:FUN.S"          ! folder FUN.S is created on drive C:\
RMDIR "C:FUN.S"          ! folder FUN.S is deleted.

*****
EXIST(s$)                                              p. 159

In: a string - a compleate file path. 

Out: true (-1) or false (0)

IF EXIST("C:\ON_LINE.DAT") THEN
  PRINT "The file Exists."
ELSE
  PRINT "Can't find the file."
ENDIF

*****
OPEN s$,#n&,s1$,n1&                                    p. 160

In: s$ - a string - the mode used to open the file.
    n& - a channal number.  Range 0 - 99.
    s1$ - a string - a compleate file path. 
          or just the file name if the file is in the 
          current directory.
    n1& - a number - optional - the length of a on record 
          in a random access file.

Result - a file on disk is opened.

s$ - opening file modes: 

"O" - output to the file      "I" input from the file
"A" - append the file         "U" update the file
"R" - random access

*****
LOF(#N&)                                               p. 162

In: a number - the chanel number of an open file.

Out: a number - the size if the file.

OPEN "U",#1,"C:\A_FILE"      ! the file C:\A_FILE is opened
length%=LOF(#1)              ! get the size of the file
CLOSE #1
PRINT length%                ! print the length/size of the file

*****
LOC(#N&)                                               p. 162

In: a number - the chanel number of an open file.

Out: a number - the location of the file pointer.

OPEN "U",#1,"C:\A_FILE"      ! the file C:\A_FILE is opened
location%=LOC(#1)            ! get the location of the file
'                            ! pointer.
CLOSE #1
PRINT location%              ! print file pointer location

0                            ! when a file just opened the 
                             ! file pointer points to byte 0.
Note: with OPEN "A",#1,"FILE" the file pointer begins at the
      end of the file. 

*****
EOF(#n&)                                               p. 162

In: n& - a number - the chanel number of an open file.

Out: Boolean - true (-1) or false (0)

OPEN "I",#1,"C:\A_FILE"      ! the file C:\A_FILE is opened
WHILE NOT EOF(#1)            ! continue if not at end of file
  LINE INPUT #1,line$        ! get one line from the file
  PRINT line$                ! print the line on the screen
WEND
CLOSE #1

*****
CLOSE #n&                                              p. 162

In: a number - the chanel number of an open file.

Result: file #n& is closed.

OPEN "U",#1,"A_FILE"         ! open a file
TOUCH #1                     ! set the file time and date
'                            !    to the current time and date.
CLOSE #1                     ! close the file

Note: CLOSE  will close all open files.

*****
TOUCH #n&                                              p. 162

In: a number - the chanel number of an open file.

Result: the file time and date of and open file are set to
        the current time and date.

OPEN "U",#1,"A_FILE"         ! open a file
TOUCH #1                     ! set the file time and date
'                            !    to the current time and date.
CLOSE #1                     ! close the file

*****
NAME s$ AS s1$                                         p. 164

In: s$ - a string - an existing file name
    s1$ - a string - a new file name

Result: the file s$ is renamed to s1$.

NAME "FILE.S" AS "COWS.S"   ! the file FILE.S is renamed to
'                           ! COWS.S

NAME "C:\FOLDER\A_FILE.S" AS "C:\A_FILE.S"
'                           ! the file A_FILE.S is moved from
'                           ! directory  C:\FOLDER\  to  C:\

*****
RENAME s$ AS s1$                                       p. 164

In: s$ - a string - an existing file name
    s1$ - a string - a new file name

Result: the file s$ is renamed to s1$.

RENAME "FILE.S" AS "COWS.S" ! the file FILE.S is renamed to
'                           ! COWS.S

RENAME "C:\FOLDER\A_FILE.S" AS "C:\A_FILE.S"
'                           ! the file A_FILE.S is moved from
'                           ! directory  C:\FOLDER\  to  C:\

*****
KILL s$                                                p. 164

In: s$ - a string - an existing file name

Result: a file is deleted from disk

OPEN "O",#99,"FILE_Z"      ! a file is created in the current
'                          !     directory
PRINT #1,"This is file Z"  ! write something to the file
CLOSE #1    
'
KILL "FILE_Z"              ! the file is deleted from disk

*****
BSAVE s$,n%,n&                                         p. 165

In: s$ - a string - the name of a file to be created
    n% - a number - the starting address of memory to save
    n& - a number - the number of bytes to save

Result: a block of memory is saved to disk

SGET screen$               ! an image of the screen is put 
'                          !    in screen$
BSAVE "PIC",V:screen$,LEN(screen$)
'                          ! the image of the screen is saved
'                          !   to disk

*****
BLOAD s$,n%                                            p. 165

In: s$ - a string - the name of an existing file
    n% - a number - the starting address of a memory block

Result: an entire file is loaded to memory begining at
        address n%

SGET screen$               ! an image of the screen is put 
'                          !    in screen$
BSAVE "PIC",V:screen$,LEN(screen$)
'                          ! the image of the screen is saved
'                          !   to disk
screen$=STRING$(32000,0)   ! reserve a block of memory
BLOAD "PIC",V:screen$      ! read in the saved picture
SPUT screen$               ! send the picture to the screen

*****
BGET #n&,n%,n1&                                        p. 165

In: n& - a number - the chanel number of an open file.
    n% - a number - the starting address of a memory block
    n1& - a number - the number of bytes to read

Result: n1& bytes are read from a file and written to a 
        block of memory starting at address n%

GET 100,100,200,200,screen_section$ ! copy a section of the screen
'                                     to screen_section$
OPEN "O",#1,"PIC"
BPUT #1,V:screen_section$           ! write the screen section 
CLOSE #1                            !   to disk
'
OPEN "I",#1,"PIC"
BGET #1,V:screen_section$           ! read the screen section 
CLOSE #1                            !   from disk

*****
BPUT #n&,n%,n1&                                        p. 165

In: n& - a number - the chanel number of an open file.
    n% - a number - the starting address of a memory block
    n1& - a number - the number of bytes to write

Result: n1& bytes are written to a file from a 
        block of memory starting at address n%

GET 100,100,200,200,screen_section$ ! copy a section of the screen
'                                     to screen_section$
OPEN "O",#1,"PIC"
BPUT #1,V:screen_section$           ! write the screen section 
CLOSE #1                            !   to disk

*****
INPUT$(n&,#n|)                                         p. 168

In: n& - a number - the number of bytes to be read.
    n| - a number - the channel number of an open file.

Result: n& number of bytes are read from an open file or
        the keyboard.

OPEN "I",#0,"A_FILE.DAT"
a_string$=INPUT$(10,#0)     ! the first ten bytes of a file 
CLOSE #0                    ! are read into a_string$

REPEAT
'                             some process
PRINT "Contiue the process ?"
UNTIL UPPER$(INPUT$(1))="Y"

*****
INPUT #n|,s$                                           p. 169

In: n| - a number - the channel number of an open file.
    s$ - a variable

Result: input from a file.

OPEN "O",#99,"A_FILE"
WRITE #99,"one",45,"three"
CLOSE #99

OPEN "I",#99,"A_FILE"
INPUT #99,a$,b&,c$      ! read in three at once
CLOSE #99
     or
OPEN "I",#99,"A_FILE"
INPUT #99,a$
INPUT #99,b&            ! read in one at a time
INPUT #99,c$
CLOSE #99

*****
LINE INPUT #n|,s$                                      p. 169

In: n| - a number - the channel number of an open file.
    s$ - a variable

Result: input from a file. Unlike INPUT #n|,s$  string
        variables may contain commas. 

OPEN "O",#99,"A_FILE"
WRITE #99,"one, two",45,"three"
CLOSE #99

OPEN "I",#99,"A_FILE"
LINE INPUT #99,a$,b&,c$      
CLOSE #99

*****
PRINT #n|,s$                                           p. 170

In: n| - a number - the channel number of an open file.
    s$ - any variable.

Result: Output to a File.

OPEN "O",#1,"A_FILE"
PRINT #1,"Output Strings and Numbers."
PRINT #1,1234
CLOSE #1

File Output:
Output Strings and Numbers.
1234

*****
PRINT #n|,USING s$,n                                   p. 170

In: n| - a number - the channel number of an open file.
    s$ - a string.
    n  - any variable.

Result: Formated Output to a File.

mask$="Tape: #,###     Title: \           \     Cost: $##.##"
tape&=178
title$="Fishing"
cost=5.9
OPEN "O",#1,"A_FILE"
PRINT #1,USING mask$,tape&,title$,cost
CLOSE #1

File Output:
Tape:   178     Title: Fishing           Cost:  $5.90

*****
WRITE #n|,s$                                           p. 170

In: n| - a number - the channel number of an open file.
    s$ - any variable.

Result: Output to a Disk File.

OPEN "O",#99,"A_FILE"
WRITE #99,"A String",23,"another String"24
CLOSE #99

File Output:
"A String",23,"another String"24

*****
STORE #n|,s$(),n& TO n1&                               p. 172

In: n| - a number - the channel number of an open file.
    s$() - an array of strings.
    n& - a number - begining of range to be saved to disk.
    n1& - a number - end of range to be saved to disk. 

Result: All or part of a string array is saved to disk.

DIM names$(500)
names$(0)="Joe"
names$(1)="Tom
OPEN "O",#0,"A_FILE"
STORE #0,names$(),0 TO 2
CLOSE #1

File Output:
Joe
Tom

*****
RECALL #n|,s$(),n& TO n1&,n%                           p. 172

In: n| - a number - the channel number of an open file.
    s$() - an array of strings.
    n& - a number - begining of array range.
    n1& - a number - end of array range. 

Out: n% - a numeric variable - the number of lines acually
          read from the text file.

Result: A number of lines are read from a text file and 
        put in a string array.

*****
SEEK #n|,n%                                            p. 174

In: n| - a number - the channel number of an open file.
    n% - a positive number - new file pointer position.

Result: The file pointer is repositioned to byte n%
        of the file.

OPEN "O",#99,"A_FILE"
PRINT #99,"111222333444555"
CLOSE #99

OPEN "O",#99,"A_FILE"
SEEK #99,3                 ! position file pointer to byte 3.
PRINT INPUT$(3,#99)        ! read 3 bytes from the file.
CLOSE #99

Screen Output:
222

*****
RELSEEK #n|,n%                                         p. 174

In: n| - a number - the channel number of an open file.
    n% - a number - a reletive adjustment to the file pointer.

Result: The file pointer is repositioned n% bytes forward
        or backwards in the file.

OPEN "O",#99,"A_FILE"
PRINT #99,"111222333444555"
CLOSE #99

OPEN "O",#99,"A_FILE"
RELSEEK #99,3        ! reposition file pointer 3 bytes forward.
PRINT INPUT$(3,#99)  ! read 3 bytes from the file.
CLOSE #99

Screen Output:
222

*****
FIELD #n|,n& AS s$,n1& AT (*n#)                        p. 177

In: n| - a number - the channel number of an open file.
    n& - a number - the set length of a string variable.
    s$ - a string variable.
    n1& - a number - the number of bytes in number variable n#
    n# - a number variable.

Result: a templete for a random access record is set up.

name$="Ted       "
age&=34

OPEN "R",#99,"RECORDS",12          ! 12 bytes / record
FIELD #99,10 AS name$,2 AT(*age&)  ! templete
PUT #99,1                          ! write record to record
CLOSE #99                          ! number 1 of the file.

*****
PUT #n|,n&                                             p. 178

In: n| - a number - the channel number of an open file.
    n& - a number - a record number in the file.

Result: a record is written to random access file.

name$="Ted       "
age&=34

OPEN "R",#99,"RECORDS",12          ! 12 bytes / record
FIELD #99,10 AS name$,2 AT(*age&)  ! templete
PUT #99,1                          ! write record to record
CLOSE #99                          ! number 1 of the file.

*****
GET #n|,n&                                             p. 178

In: n| - a number - the channel number of an open file.
    n& - a number - a record number in the file.

Result: a record is read from a random access file.

name$="          "
age&=0

OPEN "R",#99,"RECORDS",12          ! 12 bytes / record
FIELD #99,10 AS name$,2 AT(*age&)  ! templete
GET #99,1                          ! read record number 1
CLOSE #99                          ! of the file.

*****
RECORD #n|,n&                                          p. 178

In: n| - a number - the channel number of an open file.
    n& - a number - a record number in the file.

Result: the record index is set.

name$="Ted       "
age&=34

OPEN "R",#99,"RECORDS",12          ! 12 bytes / record
FIELD #99,10 AS name$,2 AT(*age&)  ! templete
RECORD #99,1                       ! set record index to 1.
PUT #99                            ! write record to record
CLOSE #99                          ! number 1 of the file.

***** 
