The Basic Language
Translator
How
To Start The Basic Language Translator
It is sometimes convenient to have a copy of the BASIC language translator on the same floppy disk where the application programs will be stored. Then when the BASIC translator is activated, the default drive for saving and loading a program will already be established.
1. Launch a DOS prompt. The Widows screen will probably show:
C:\WINDOWS>
2. Type in an A: and hit the Enter Key
C:\WINDOWS>A: <Enter Key>
3. The prompt should now show:
A:\>
4. Type in "BASICAC" (without the quotes) and hit the Enter Key
A:>BASICAC <Enter Key>
The BASIC Language translator should now be on the screen, and you are now ready to enter line numbers and BASIC instructions.
How
To Exit The Basic Language Translator
When you have finished working with BASIC for this session and you are ready to return to the operating system then type:
SYSTEM <Enter Key>
At the A: prompt, type:
A:EXIT <Enter Key>
You should now be back at the Windows screen.
Working
In The Basic Language Screen
The translator screen is both an editor and an interpreter. This allows you to enter instructions, make corrections right on the screen, and display the results of running your program. The output will be on the screen.
To
Start Creating a BASIC Language Program
Start by typing in the number of the first line in your program followed by at least one space, and then type in your first instruction. Hit the Enter Key. This will send this line of code to the computer's memory. The instructions are stored in the computer's memory in line number order. The cursor can be anywhere on the line when you hit the <Enter Key>.
100
LET X =
100 <Enter Key> 110 PRINT "The value of X is = "; X <Enter Key>
How
To Save a BASIC Language Program
Computer programming takes a great deal of thought before you take any computer action. When you invoke the SAVE command, you must be prepared to give your program a legitimate name. All BASIC program names are made up off a maximum of eight characters followed by a dot followed by a maximum three-character extension. The name must start with a letter of the alphabet, followed by other letters or numbers. No blanks are allowed. The names must not be longer than eight total characters. The language translator always adds ".BAS" as the extension to the name of your program when the program is saved. It is good practice to use the lab number and your initials in the name.
Examples of File
Names Valid
Names: SAVE"LAB3_WAJ.BAS" SAVE"LAB15A_BL.BAS" Invalid
Names: SAVE"LAB 15 - JONES.BAS" no spaces allowed SAVE " 22.A -
LARSON.BEN" must start with
a letter
What
Happens When The Program is Saved?
As you type each BASIC instruction on the screen and hit the <Enter Key>, a copy of the instruction is sent to the memory of the computer. This makes two copies: One on the screen and one in memory. After you execute a SAVE"program.name" command then another copy goes from the computer's memory to a magnetic disk. Now you have three copies: One on the screen, one in memory and one on the disk. If changes are made to a program, care must be taken to make the changes to all three copies.
The BASIC Language system commands are used to control the BASIC language translator. These commands are typed in without line numbers and are executed immediately after the Enter Key is hit. Some of the commands can be used within a regular program but care must be taken when doing this. How to do this will be discussed later.
Programming languages have two general components: Commands that control the operation of the language translator and instructions that provide the sequence of actions for application program written in the specific language. This section describes the Commands that control the operations of the language translator.
The main function that distinguishes Commands from Instructions is the timing of when the command gets executed. When the programmer issues a command, it is done immediately, whereas program instructions are not executed until the entire program has been written, loaded into memory, and a systems command has been given to start its execution.
Key
Basic Language System Commands
BASICAC (or some variation of this spelling)
Executed from a command line. Transfers control from the Windows operating system to the BASIC language translator software.
A:\BASICAC <Enter Key>
SAVE"programname.BAS" (or Function Key 4)
Transfers to the disk a copy of the program stored in memory, giving it the name typed between the quotation marks". The name must begin with an alphabetic character followed by other characters or numbers. A name may have a maximum of eight characters not counting the ".BAS". Don't add your own extension as the BASIC translator automatically adds the ".BAS". No blanks are allowed.
SAVE"LAB3_WAJ.BAS"
<Enter Key>
LOAD"programname.BAS" (or Function Key 3)
Copies a program named "program_name.BAS" from a disk to the computer's memory.
LOAD"LAB3_WAJ.BAS" <Enter Key>
RUN (or Function Key 2)
This executes the current program stored in the computer's memory. The command is usually entered as a single word, but may be entered as one word followed by some line number in the program. The program will start executing from this line number. This latter form is rarely used.
RUN 400 Starts execution at line number
400
Examples of the RUN Command
RUN or
LIST (or Function Key 1)
This transfers a copy of one instruction, or several instructions, or all of the instructions from an application program onto the screen or printer. There are several variations of this command.
Examples of the LIST Command LIST lists the entire program onto
the screen. If there are more
instructions than will fit on the screen then the screen will overflow and
only the last screenful of instructions can be viewed. LIST 10 lists just line #10 onto the
screen. LIST 10 - 50
lists line #10 through line #50 onto the screen. LIST 10 - lists line #10 and all the other
instructions following.
NEW
Erases the entire contents of the computer's memory. Be sure you have saved your program first or else it will be gone forever.
NEW <Enter Key>
RENUM
Allows the programmer to change the line numbers on some or all of the program instructions. There are several variations.
Examples of the RENUM Command RENUM renumbers the entire
program starting at line #10 by increments of ten. RENUM 100 starts the
renumbering using line #100 as the first number and using increments of
ten. RENUM 100, 50 starts the new
numbering of 100 at current line #50 RENUM 100, ,5 renumbers the
entire program starting with line #100 by increments of five. RENUM 100, 22 ,5 renumbers the
instructions starting at current line #22 using increments of five. Line #22 becomes line #100, line #23
becomes line #105, line #24 becomes line #110, etc.
SYSTEM
A one word command that is entered from the BASIC language translator screen. It returns control back to the command line of the main operating system software. WARNING: BE SURE TO SAVE YOUR PROGRAM FIRST!
SYSTEM <Enter Key>
EXIT
Returns control back to the Windows screen
A:\EXIT <Enter Key>
FILES
Displays a list all of the file names on the "A:" drive disk.
FILES "A:*.BAS" Note: The
asterisk is called a "wild card."
It represents all the file names ending in ".BAS".
Other
BASIC Language System Commands
AUTO
Automatically creates line numbers (labels) on the screen. This mode must be exited before changes are made anywhere else on the screen. To exit AUTO mode hit Ctrl/Break. A variation to AUTO is to type the command followed by the line number at which you wish to automatically start entering instructions.
Examples of the AUTO Command AUTO starts the line numbers on the screen
at line #10 using increments of ten, the default. AUTO 42 start with line #42 using
increments of ten, the default. AUTO 42,5 starts with
line #42 using increments of five.
CLS
Erases the current contents of the screen and returns
control to the top of the screen. Does
not affect the instructions stored in memory.
CLS <Enter Key>
DELETE [line 1] [- line 2]
WARNING: BE CAREFUL USING THIS COMMAND! If used improperly, it will erase more instructions than you intended.
Examples of the DELETE Command DELETE 40 deletes just line #40 DELETE 40 <dash> deletes ALL
instructions from line #40 to the end of the program. DELETE <dash> 40 deletes ALL
instructions from line #1 through line #40.
EDIT line #
Displays one line number to be edited.
EDIT 450 Displays line # 450
and allows the programmer to fix it. 450 PRINT
"This is an exampppple of using the
EDIT commmmmmand"
An
Easier Way to Make a Correction
The easiest way to edit an instruction is to LIST it by line number. This displays the instruction on the screen. Then the cursor may be positioned anywhere on the instruction and the corrections made. To send the corrected instruction back to memory, just hit the Enter Key. The cursor may be anywhere on the line when the Enter Key is hit.
450 PRINT "This is an example of making
a correction without the EDIT command"
LIST 450 <Enter
Key>
KILL
"file name"
Erases the file on the disk.
KILL
"LAB3_WAJ.BAS"
NAME
"file name 1" AS "file
name 2"
Changes the file name on a disk from "file name1" to "file name 2"
NAME "LAB3_WAJ" AS
"LAB4_XXX"
TRON (or Function Key 7)
This is a "toggle switch" command (Trace On) that displays the sequence of line numbers as the program is executing. It is used for debugging when the program logic must be traced line by line.
TROFF (or Function Key 8)
This is another "toggle switch" (Trace Off) that turns off the TRON (trace on) command.
Creating Output To The Line And Laser Printers
After the program has been completely debugged and the programmer is satisfied with the output as it appears on the screen then both a copy of the output and a listing of the instructions must be printed as the final documentation. Also, the instructor needs these copies for evaluation and grading. There are several ways to accomplish these printouts, but mostly it depends on whether the computer is hooked to a line printer or a laser printer.
Line Printer Output
If the computer is equipped with a dot matrix or ink jet printer then the listing of the program instructions can be accomplished with a simple LLIST systems command, a variation of the LIST command. The first "L" indicates that the program instructions are to be printed on the line printer.
LLIST
<Enter Key>
This causes a copy of the current program instructions that are stored in memory to be printed on the line printer.
To get a copy of the program output, the Control key is held down and the Print Screen key is hit one time. Then the RUN command is typed, and the output automatically goes to the line printer. The Control/Print Screen combination acts as a toggle switch that must be turned "off" when the output is complete. To turn off the switch, the Control key is again held down and the Print Screen key is hit one time.
Laser Printer Output
The laser printer output is more complex, especially if it is connected to a network. After the program is thoroughly tested and the screen output has been verified for correctness then the following steps must be taken:
1. Add one line of code just before the END instruction.

2. SAVE the
program one more time. This is an
imperative step!
3. Type: SYSTEM to return to the A:\> prompt
SYSTEM
<Enter Key>
4. Type (without the square brackets)
A:\>BASICAC [saved basic program name].BAS >
[basic program name].TXT
This command causes the BASICAC language translator to re-launch and to automatically RUN the program. This time, however, all of the output will be redirected (>) to the file name that ends in ".TXT". If the program is interactive then the necessary inputs must be completed as the program calls for them.
Also, the LIST command that was added to the program causes a listing of the program instructions to be sent to the output .TXT file. Now there are copies of both the program output and a listing of the program instructions in the text file. The next step is to print out the text file.
5. Exit the BASIC language translator by typing SYSTEM <Enter Key>
SYSTEM
<Enter Key>
6. Return to Windows by typing at the A: prompt:
A:\>EXIT <Enter
Key> The screen should now
be back at the Windows screen.
1. Open Windows Notepad:
[Click on START, highlight PROGRAMS, highlight ACCESSORIES, highlight and launch NOTEPAD.]
2. In the NOTEPAD
window:
a. Click on the FILE menu and then click OPEN.
b. Pull down the Look In menu. Click on the Floppy (A:)
drive.
c. Highlight the name of the "program name.TXT" file, and click
OPEN.
d.
Select PRINT from the pull-down FILE menu and click. The results of your RUN plus your program
listing should be on the laser printer.