TOPS-20 User's Guide
Appendix D Using BASIC
If you want to enter and run a BASIC program using BASIC-PLUS-2, type in your program directly to BASIC; you should not use EDIT. The following sections show how to start BASIC, and then how to enter, save, run, edit, rerun, and list your program. Section D.10 shows you how to leave BASIC.
- Starting BASIC
- Entering your program
- Saving your program
- Running your program
- Editing your program
- Renaming your program
- Rerunning your program
- Listing your program
- Running an existing program
- Leaving BASIC
After you see the @, type BASIC, and press the RETURN
key. BASIC prints READY.
Once BASIC prints READY, you can use any of the BASIC
commands discussed in this section. You must not, however,
use any TOPS-20 command or recognition input.
The example shows a BASIC program as it was originally
entered; the program contains an error that is corrected
later in this section.
After you enter your program into your working area, type
SAVE, and press the RETURN key. When you see READY, it
means that BASIC saved the program you just typed into your
storage area. By saving your program, you can run it at a
later time without having to reenter it into the computer.
(Refer to Section D.9).
To see a list of the files saved in your storage area,
type CATALOG, and press the RETURN key.
To run the program in your working area, type RUN, and
press the RETURN key. You wil see the name of your program,
the time, and the date. When you see READY, your program
has finished running.
To edit the program in your working area:
To rename an existing BASIC program in your storage area:
Now that you have changed your program, run it to make
sure that it works properly.
To get a final copy of your corrected program, type LIST,
and press the RETURN key.
To list a single line of your program, type LIST, type
the line number of the line, and press the RETURN key.
D.1 Starting BASIC
@BASIC
READY
D.2 Entering your program
READY
NEW
New Program Name--
New program name--SQUARE
READY
100!SQUARE.B20 - THIS PROGRAM CALCULATES A SQUAREROOT.
200 PRINT "TYPE A NUMBER."
300 INPUT X
400 Y = SQR(X)
500 PRINT "THE SQUAROOT OF ";X;" IS ";Y
600 STOP
700 END
D.3 Saving your program
SAVE
READY
CATALOG
ADDTWO.FOR.2
FACTOR.B20.1
RANDOM.B20.2
SQRT.ALG.2
SQUARE.B20.1
READY
D.4 Running your program
RUN
SQART.B20
Friday, June 10, 1988 09:13:16
TYPE A NUMBER.
? 45.668
THE SQUAREOOT OF 45.668 IS 6,75781
STOP at line 00600 of MAIN PROGRAM
Compile time: 0.054 secs
Run time: 0.138 secs Elapsed time: 0:00:08
READY
D.5 Editing your program
500 PRINT "THE SQUAREROOT OF ";X;" IS ";Y
D.6 Renaming your program
RENAME SQART
READY
D.7 Rerunning your program
RUN
SQUARE.B20
Friday, June 10, 1988 09:11:44
TYPE A NUMBER.
? 45.668
THE SQUAREROOT OF 45.668 IS 6.75781
STOP at line 00600 of MAIN PROGRAM
Compile time: 0:086 secs
Run time: 0.229 secs Elapsed time: 0:00:10
READY
D.8 Listing your program
LIST
SQART.B20
Tuesday, February 6, 1988 11:03:31
00100!SQUARE.B20 - THIS PROGRAM CALCULATES A SQUAREROOT.
00200 PRINT "TYPE A NUMBER."
00300 INPUT X
00400 Y = SQR(X)
00500 PRINT "THE SQUAREROOT OF ";X;" IS ";Y
00600 STOP
00700 END
READY
LIST 500
SQART.B20
Tuesday, February 6, 1988 11:03:40
00500 PRINT "THE SQUAREROOT OF ";X;" IS ";Y
READY