
44 |
|
|
|
SOME BASICS | OF BASIC |
| |
4 First steps |
|
|
|
The first things that a beginner learns to do are to list a pro- |
| ||
gram and to print a character string. Certainly these are the |
| ||
easiest operations one can do, but even they may depend on |
| ||
what computer you have. In Microsoft BASIC, we can list all |
| ||
the steps in a program by entering LIST. This lists them on the |
| ||
CRT screen; if we want to print them on a printer, we prefix the |
| ||
command with an L (enter LLIST). |
| ||
The Microsoft | BASIC | command for outputting information is | |
PRINT. Like the LIST command, this displays the information |
| ||
on the CRT screen so we have to add an L | - | ||
want to use the printer. Just put whatever you want to print be- |
| ||
tween quotes and after LPRINT (anything enclosed in quotes is |
| ||
called a character string). For example, we would use LPRINT |
| ||
“Hello!” to output “Hello!” to the printer. We’ll see later how to |
| ||
LPRINT more than just character strings. |
| ||
We started with Microsoft BASIC because it is the most wide- |
| ||
ly used version of BASIC. The programs in this manual are |
| ||
written in Microsoft BASIC so they should run on most com- |
| ||
puters. But if strange things happen when you try to run a pro- |
| ||
gram, check the BASIC manual that came with your computer. |
| ||
Let’s consider Apple II computers for a minute. These |
| ||
popular computers use their own brand of BASIC. To use an |
| ||
Apple II, enter the following - |
| ||
PR#l | PR#l |
|
|
LIST | "Hello!" |
| |
PR#O | PRf10 |
|
|
The PR#l tells the Apple to send everything to the printer, the LIST or PRINT command sends it, and the PR#O returns output to the screen.
Now that we know how to address the printer, let’s try listing a BASIC program. We will load a program into memory ready to program printer operation - just as soon as we learn a little bit about the ASCII codes.