Imagine that you're running for President against Calvin Coolidge. To win, you must pass Cal in the polls.
You must pass Cal. ``Pass Cal'' is the correct way to pronounce ``PASCAL'', the name of the computer language that programmers are falling in love with.
PASCAL is harder to learn than BASIC. But once you've learned PASCAL, you have amazing power: you can write fancy programs more easily in PASCAL than in BASIC because PASCAL helps organize your thinking; and your programs will run faster, too!
American teachers require kids to master LOGO in elementary school, BASIC in high school, and PASCAL in college. Gifted kids are given the opportunity to start BASIC and PASCAL even sooner ___ and so are kids in progressive schools.
Many high-school seniors take a PASCAL test given by the College Board. Seniors who pass can get ``advanced placement'' college credit and skip the college's first year of computer courses.
The nicest kinds of PASCAL are Quick PASCAL (published by Microsoft) and Turbo PASCAL (published by Borland). They're easy to understand, run quickly, and cost little.
Quick PASCAL runs on the IBM PC and lists for just $99. Discount dealers sell it for just $42.
Turbo PASCAL is available for the IBM PC, Mac, and computers using the CP/M operating system. The newest version of Turbo PASCAL for the IBM PC is Turbo PASCAL 7, which discount dealers sell for $99.
If you're on a tight budget, which should you buy ___ Quick PASCAL or Turbo PASCAL? Since they're very similar to each other, you'll probably buy Quick PASCAL because it costs less. Another advantage of Quick PASCAL is that it lets you edit your programs more easily than Turbo PASCAL. On the other hand, Turbo PASCAL runs your programs faster, consumes less RAM and disk space, comes with instruction manuals that are larger and more thorough, provides on-screen tutorials that are easier to use, understands better commands for advanced programming, and is the standard against which all other versions are judged. (Quick PASCAL was invented just to imitate Turbo PASCAL more cheaply.)
This chapter explains how to use Quick PASCAL and the most common versions of Turbo PASCAL (versions 4, 5.5, and 6).
If you have Turbo PASCAL 7, follow the instructions for Turbo PASCAL 6, which is similar. If you have Turbo PASCAL version 5, follow the instructions for version 5.5.
I'll comment on how other versions of PASCAL differ. Copy to the hard disk
Quick PASCAL and Turbo PASCAL come on a pile of floppy disks. You should copy those disks to your hard disk. Here's how.
Quick PASCAL Turn on the computer without any floppy in drive A.
The original version of Quick PASCAL comes on five 5¬-inch floppy disks. When you see the C prompt, put the Quick PASCAL Setup/Utilities Disk in drive A and type ``a:''. The computer will display an A prompt. Type ``setup''. The computer will say ``Microsoft Quick Pascal Setup Program''.
Press ENTER twice. The computer will say ``Easy Setup Menu''. Type the letter I. Press ENTER four times.
Put the Quick PASCAL Program Disk in drive A, and press ENTER. Put the Quick PASCAL Advisor Disk in drive A, and press ENTER. Put the Quick PASCAL Libraries Disk in drive A, and press ENTER. Put the Quick PASCAL Express Disk in drive A; press ENTER twice.
Press R, so that the computer says ``Setup Main Menu''. Press X, so that you exit to DOS. You'll see an A prompt.
Turn off the computer, so you can start fresh.
Turbo PASCAL 4 Turn on the computer without any floppy in drive A.
After the C prompt, type ``md turbo'' (so you're making a subdirectory called TURBO). After the next C prompt, type ``cd turbo'' (so you're changing to the TURBO subdirectory).
Turbo PASCAL 4 comes on three floppy disks. Put one of those disks in drive A, and type ``copy a:*.*'' (which copies all the floppy's files onto the hard disk); follow the same procedure for the other two disks.
Turn off the computer, so you can start fresh.
Turbo PASCAL 5.5 and 6 Turn on the computer without any floppy in drive A.
Your Turbo PASCAL comes on four 5¬-inch floppy disks. When you see the C prompt, put the Install/Compiler disk in drive A, and type ``a:install''. The computer will say ``Turbo PASCAL Installation Utility''.
Press ENTER four times. You'll see ``C:\TP''. Press the BACKSPACE key, then type URBO so you see ``C:\TURBO''. At the end of the URBO, press ENTER.
Press the F9 key.
If you're using version 6, put the Turbo Vision/Tour disk in drive A, press ENTER, put the Help disk in drive A, press ENTER, put the BGI/Utilities disk in drive A, and press ENTER twice. (If you're using version 5.5, put the Tour/Online Help disk in drive A, press ENTER, put the OOP/Demos/BGI/Doc disk in drive A, press ENTER, put the Utilities/Misc disk in drive A, and press ENTER twice.)
You'll see an A prompt. Turn off the computer, so you can start fresh. Start PASCAL
To start using PASCAL, turn on the computer without any floppy in drive A.
If you've put the DO.BAT file onto your hard disk (as I recommended in the MS-DOS chapter), your life is easy! Just type ``do qp'' to do Quick PASCAL; type ``do turbo'' to do Turbo PASCAL.
If you have not put DO.BAT onto your hard disk, your life is harder! You must type ``cd qp'' and then ``qp'' to do Quick PASCAL; you must type ``cd turbo'' and then ``turbo'' to do Turbo PASCAL.
Press the CAPS LOCK key, so the computer will automatically capitalize everything you type (and your typing will look like the examples in this chapter).
Here's what to do next.
Quick PASCAL You don't have to do anything!
Turbo PASCAL 4 Press the E key (which means ``Edit''). Make sure the cursor is at a blank part of the screen. (If it's not, press the DELETE key several times.)
Turbo PASCAL 5.5 Press the F6 key (so the cursor moves to the bottom of the screen). Then press the F6 key while holding down the Alt key (so the bottom of the screen says ``Output''). Then tap the F6 key without the Alt key (so the cursor moves to the top part of the screen).
Turbo PASCAL 6 Press F10 then W then the letter O (so the cursor moves to the bottom of the screen). Press F10 again then W then T. Press F6.
How to program
For example, type this PASCAL program:
BEGIN;
WRITELN('I WOULD LIKE TO KISS');
WRITELN('YOUR BOTTLE OF WINE');
END.
The program begins with the word BEGIN and ends with the word END. Every line ends with a semicolon, except that the bottom line ends with a period. The middle lines say WRITELN, which tells the computer to WRITE a LiNe.
Naming the program If you wish, you can put an extra line at the top of the program, to give the program a name. The name can be up to 8 letters long. For example, if you want to name the program WINE, you can begin the program by saying PROGRAM WINE, like this:
PROGRAM WINE;
BEGIN;
WRITELN('I WOULD LIKE TO KISS');
WRITELN('YOUR BOTTLE OF WINE');
END.
Colors If your screen can display colors, here's what you see. In Turbo PASCAL, the program is yellow. In Quick PASCAL, most of the program is white, but the keywords (PROGRAM, BEGIN, and END) turn purple and the strings (`I WOULD LIKE TO KISS' and `YOUR BOTTLE OF WINE') turn light blue. Run the program When you finish typing the program, tell the computer to run it. Here's how. For Turbo PASCAL 4, press F10 then R. For Turbo PASCAL 5.5 & 6, press F10 then type RR. For Quick PASCAL, press F5; and if the computer asks ``Rebuild?'', press ENTER.
If you typed the program correctly, the computer will write:
I WOULD LIKE TO KISS
YOUR BOTTLE OF WINE
If you typed the program incorrectly, the computer will say:
Error
(If you're using Quick PASCAL, then press ENTER.) The computer will put the cursor near your error. Correct the error (by using the arrow keys, DELETE key, and other word-processing keys), then tell the computer to run the program again.
After a good run After the computer has run the program successfully, do the following: for Quick PASCAL, press ENTER; for Turbo PASC