Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 10, NO. 7 / JULY 1984 / PAGE 53

Turbo Pascal; the best cost less. (evaluation) George Blank.

For years, programmers have been arguing the relative merits of different computer languages. They often miss the point. The language may not be as important as the implementation. Consider the relative merits of two cars: a Rolls Royce might be a better car than a Ford, but I would prefer a new Ford to a Rolls that just had a head-on collision with a train.

Theoretically, Pascal is a language far superior to Basic. To quote Edsger Dijkstra, "It is nearly impossible to teach programming to anyone with a prior exposure to Basic." Learning Basic as a first language practically guarantees that a programmer will develop bad habits, including spaghetti coding, cut and try programming, inadequate internal documentation, abuse of global variables, and a failure to avoid side effects. Problems With Other Pascals

Until recently, the Basic vs. Pascal controversy was irrelevant to IBM PC users. The computer has a powerful, full featured Basic, while the first three versions of Pascal I obtained for the PC all had serious flaws. Pascal MT.sup.+ at that time worked only under CP/M. UCSD Pascal demanded exorbitant fees from programmers who wanted to sell programs written under the system, which was also slow, clumsy, and not very accurate. IBM or Microsoft Pascal lacked the most fundamental extensions for serious programming: program chaining, cursor control, and screen handling functions. Despite these inadequacies, all three charged $300 and up for their mediocre versions of Pascal.

Of the three, IBM Pascal seemed the best choice. So I spent weeks developing routines for cursor and screen control. I paid $100 for a routine to allow program chaining, only to have the program fail if I tried to use it in a different machine. Even after I developed a batch file to speed up the compilation process and reduce the typing necessary to name 12 intermediate files generated by the compiler, I tolerated four minutes of disk swapping to compile even the smallest program.

The intermediate code was so grossly inefficient that my 360K disk drives were inadequate for moderate size programs. I had to break the programs down into smaller units and compile them separately. After one year of using the system, I still could not produce a reliable turnkey package.

Then I saw an advertisement for Turbo Pascal. The ad promised everything I needed at the ridiculous price of $50. Built-in functions included ClrScr to clear screen and GotoXY to position the cursor. Program chaining was supported, with compiler options allowing the creation of either COM files or chain modules that used less memory. It was even possible, the literature promised, to compile and run a program directly from memory. I sent for the program.

I had so much time, effort, and money tied up in the IBM Pascal version of my programs that I avoided switching over for three weeks. But when I found that a menu chaining routine I wrote for one PC wouldn't work on another PC, I gave up, expecting that I would have to start over from the beginning. Instead, I found that it took me less than 30 minutes to convert a program written in IBM Pascal to Turbo Pascal.

Short programs that had taken four minutes to compile now compiled in 10 seconds. Longer programs that had taken 20 minutes to compile now took less than a minute. And a program that I had to compile in four pieces under IBM Pascal compiled in one piece!

I have been working on a series of 60 programs; under IBM Pascal, the average program took two weeks to write. With Turbo Pascal, the average is now two days. And program chaining, so necessary for turnkey applications, worked the first time I tried it. Limitations

To date, I have found only two significant limitations to Turbo Pascal. First, it creates only COM files, while IBM Pascal creates EXE files. The difference is that COM files always load into the same area of memory, while EXE files are relocatable. It is possible with IBM Pascal to have several programs in memory and switch between them without disk access. Aborting a program called from a menu program returns you automatically to the menu. The same is not true of Turbo Pascal.

The second limitation is that Turbo Pascal limits you to 64K of program and 64K of data in each program, while MS-DOS allows much larger programs if you have either a hard disk or the patience to compile dozens of modules and units.

Turbo Pascal follows the Jensen and Wirth standard for Pascal closely, with only a few justifiable omissions. Mark and Release are used with pointer variables instead of Dispose. Read and Write have been extended to handle all I/O needs, eliminating the need for Get and Put, which are not implemented. Goto statements are limited to the current block, but no self-respecting Pascal programmer uses Goto, anyway. Page, Pack, and Unpack are not implemented; all are minor functions. Enhancements

There are many enhancements to the Pascal standard in Turbo Pascal, including a set of string functions, random file handling, screen control, DOS primitives, random number generation, and memory management functions. The built-in procedure MsDos allows direct access to DOS, with a set of dependent functions and procedures and control over all registers. The procedure InLine allows machine code to be embedded in your program, with other features such as optional absolute addressing and predefined types Addr, Ofs, Seg, CSeg, DSeg, SSeg, Byte, Mem, MemW, Port, PortW, and Word for direct machine control. You can also link to external subprograms.

Turbo Pascal comes with a built-in editor, which is very similar to WordStar, with 38 commands. You can also set up a keyboard translation table, so I changed my keys to match the functions of Perfect Writer, which I use to write programs. I use the built-in editor only for minor changes to programs, since I prefer the dual windows, text movement, and search functions in Perfect Writer. If you compile from memory and encounter an error, either during compilation or at run time, Turbo Pascal automatically locates the line in which the error occurred, and after printing an error message, puts you in the editor at that location.

Usually I program with Perfect Writer in my Seequa Chameleon and Turbo Pascal in my IBM PCjr. The monitor for the PCjr sits on top of the Chameleon. I save the program to a DOS 2.1 disk (one key stroke), put the disk in the jr, and execute it (two more keystrokes). That way I can adjust the graphics or fix bugs while watching the program on one screen and editing it on another.

Turbo Pascal is lacking in graphics functions, probably to keep one manual compatible with various Z80 CP/M, CP/M 86, and MS-DOS machines. I use a set of procedures developed by Richard Koch that add the ability to set graphics modes; set, reset, and test points on the screen; and draw lines and circles on the IBM and compatible computers. (I have Dick's permission to send a printout of the routines to readers of this article for $2 and a self-addressed envelope.) Documentation

Turbo Pascal comes with a 250-page perfect bound instruction book that is of above average readability for a technical manual. (I can recognize English, French, Greek, Hebrew, Italian, Japanese, Thai, Spanish, Latin, Arabic, Coptic, German and Russian, but I still haven't figured out what language IBM uses in their Pascal manual.)

Many explanations are cursory, and examples are too few and too limited, especially for functions unique to Turbo Pascal. The manual also contains several typographical and a few factual errors. I was able to obtain some limited and only partially accurate technical help by calling Borland International. Microsoft's tech support was better; IBM's far worse!

Borland recently eliminated my only other complaint about the package by dropping the $100 license fee it previously charged users of Turbo Pascal for reselling programs written with it. The $50 purchase price now includes unlimited rights to write programs using the compiler and sell those programs in the commercial market.

My only fear for the program is that at $50, it is grossly underpriced, and I worry that people might fail to take it seriously. That would be a shame, for this is a terrific package, whether for learning Pascal or for software development.

Products: Borland Turbo Pascal (Application development software)