Jump to content

Turbo Pascal

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 75.211.48.114 (talk) at 02:17, 18 November 2006 (Minor edits of early history). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Turbo Pascal 3.0 manual front page

Turbo Pascal is a complete development system that includes a compiler and an Integrated Development Environment (IDE) for the Pascal programming language running mainly on MS-DOS, developed by Borland under Philippe Kahn's lewadership. The name Borland Pascal was generally reserved for the high end packages (with more libraries and standard library source code) whilst the original cheap and widely known version was sold as Turbo Pascal. The name Borland Pascal is also used more generically for Borland's dialect of Pascal. Philippe Kahn studied in Zurich at the ETH underNiklaus Wirth and worked on the first Pascal Compiler and on editing Wirth's landmark treatise: "Algorithms + Data Structures = Programs".

Borland has released three versions of Turbo Pascal for free: versions 1.0, 3.02 and 5.5.

History

The Turbo Pascal compiler is based on the "Tiny Pascal Compiler" provided with source code in Wirth's Algorithms + Data Structures = Programs. Tiny Pascal is a recurrent descent compiler for a subset of Pascal. It does not have an IDE. was based on the Blue Label Pascal compiler originally produced for the NasSys cassette-based operating system of the Nascom microcomputer in 1981 by Anders Hejlsberg. This was first rewritten as the Compas Pascal compiler for the CP/M operating system and then as the Turbo Pascal compiler for DOS and CP/M. A version of Turbo Pascal was available for the Apple Macintosh from about 1986 but was eventually discontinued around 1992. Another version was available for the DEC Rainbow through several releases.

Version 1.0

File:Turbo Pascal 60 screenshot.gif
Debugging a program using the Turbo Pascal 6.0 IDE

See also Antique Software: Turbo Pascal v1.0. Borland licensed the PolyPascal compiler core, written by Anders Hejlsberg (Poly Data was the name of his company in Denmark), and added the user interface and editor. Anders joined the company as an employee and was the architect for all versions of the Turbo Pascal compiler and the first three versions of Borland Delphi.

Turbo Pascal 1.0 was seen as amazing for its time; other microcomputer-based Pascal compilers of that era were considered slow. For example, the Microsoft Pascal system consisted of two compiler passes and a final linking pass. You had to run a text editor to edit the program, then save the file. Then you had to run pass 1 of the compiler, then pass2 (a separate .exe file), then the linker. The whole process could take many minutes, especially on floppy disks.

By comparison Turbo Pascal 1.0 was just one .COM file, about 38 kilobytes long. In those few bytes it included the editor, the compiler, the linker, and all of the library routines. The whole edit/compile/run cycle was many many times faster and easier using Turbo Pascal.

When the first version of Turbo Pascal appeared on November 20 1983, the type of IDE it used was relatively new. On its debut in the American market, Turbo Pascal retailed for USD$49.99. The integrated Pascal compiler also was of very good quality compared to other Pascal products and was affordable above all. The "Turbo" name alluded to its compilation speed as well as the speed of the executables it produced. The speed of these "com" executable files was a revelation for developers whose only previous experience programming the PC was with Microsoft's BASIC.

The IDE was incredible for its day. It was simple and intuitive, and it had a menu system that was well organized. Early versions used the WordStar control key layout. Later versions of the IDE had the ability to instantly look up the definitions of the keywords of the language just by putting the cursor over a keyword and hitting the help button. The definitions also frequently included example code that used the keyword. This enabled the inexperienced programmer to learn Pascal simply by using the IDE, without actually requiring help from a book.

Later versions

Later versions had the ability to easily integrate assembly language within Pascal. The addition of in-line assembly was desirable because assembly provides the lowest human-readable interface to the machine, and allowed a talented assembly programmer to replace the built-in Pascal functions with code that was smaller or faster (or both). The user could single step through a program quite easily, and when they got to an assembler block, they could single step through that too. The user could add 'watches' on variables and registers in an IDE window. Programs using IBM PC graphics mode could flip between graphics and text mode automatically or manually.

On top of all of the previous features, the IDE included a code profiler that could report on which parts of the program were using the most time. The books included with Borland Pascal had detailed descriptions of the Intel assembler language, going so far as to provide the clock cycles required of each instruction. Overall this system, as a whole, made for a relatively pleasant experience when trying to optimize code; the user never had to leave the IDE. This all worked 'out of the box' and was put together so simply that a high school student could use it.

Even though it is now mostly regarded as obsolete, Turbo Pascal is still taught at secondary, sixth form level and University level in the island of Malta, as well as being the state-approved educational programming language for all South African secondary schools. Today it continues to be taught in some universities around the world as an introduction to computer programming, usually continuing on with C and/or Java. Some lecturers prefer to use Turbo Pascal 5.5 as it is very simple (in comparison to more modern IDEs like Microsoft Visual Studio or Borland JBuilder), introduces students less familiar with computing to using the keyboard and keyboard shortcuts (TP 5.5 has no mouse support), familiarises students with DOS commands (which are largely the same as Windows NT's Command Prompt) and it is now available for free download so students willing to program on their own PCs can do so freely without possible legal complications. Some argue that it is not worth the time to teach a very deprecated language that may be easier to initially learn than others, as it is inevitable that more contemporary languages will have to be taught afterwards. Others comment that since it is just as inevitable that evolving language standards and changing language fashions will require every programmer to absorb large amounts of new material on a regular basis, it is just as well to start with a well-structured, easily comprehended language that provides a solid foundation for future learning.

Competition with Microsoft Pascal

It is likely that Microsoft Pascal was dropped because of the competition provided by Turbo Pascal's good quality and low price. Another theory is that Borland made an agreement with Microsoft to drop development of Turbo BASIC, a BASIC IDE that stems from Turbo Pascal, if Microsoft would stop developing Microsoft Pascal. For a while, Microsoft produced QuickPascal, which was almost 100% compatible with Turbo Pascal.

Book Licence

Turbo Pascal came with the famous "Book Licence": "you must treat this software just like a book ... may be used by any number of people ... may be freely moved from one computer location to another". Since there was no online help, copy protection was effectively enforced by possession of the Turbo Pascal reference manual (pictured above).

Units, 5.5+ Object Pascal

Over the years, Borland enhanced not only the IDE, but also the programming language. From version 4.0, the language introduced the concept of Units. Units were used as external function libraries, like the object files used in other languages such as C, but a little more high level (the programmer was able to define what will be visible outside the unit and what not). From version 5.5 onwards some object oriented programming features were introduced. Some people call these extensions Object Pascal although that is more commonly used as a name for the language underlying Delphi (which has two totally separate OOP systems). The last version released was version 7. Borland Pascal 7 contained an IDE and compilers for creating DOS, extended DOS and Windows 3.x programs. Turbo Pascal 7 on the other hand could only create standard DOS programs. It also had a graphical API (the Graph unit) which supported multiple external drivers (BGI files - standing for Borland's Graphics Interface) and provided a mechanism to link these drivers with the EXE, but as it was quite slow and caused unpleasant flickering, interchangeable visual pages were used, which caused overfilling the video memory. Some 3rd part drivers, such as SVGA drivers, were made by fans, but they never gained big popularity, since next-generation tools like Borland C++ and Delphi were on their way at that time.

Two versions of Turbo Pascal for Windows 3.x were released, 1.0 (based on Turbo Pascal 6 but released about 2 years later) and 1.5 (released after Turbo Pascal 7). It featured a Windows IDE (also present in Borland Pascal 7, and based on the Borland C++ one), as opposed to the traditional DOS-based IDE in Turbo Pascal. The support for Windows required the use of the ObjectWindows library, similar but different from (the first release of) the Borland C++ sister, radically different from the DOS Turbo Vision environment, and was launched quite late (1992), so it never achieved wide popularity, and was later eclipsed by Delphi.

Mac version

Borland also released a "Turbo Pascal for the Macintosh" in 1985. Much like the PC version, it was written in very tight assembly language and had a very powerful IDE, but not a good debugger. Borland did not support this product very well. They did issue a version 1.1, patched to run on the 32-bit clean Macintosh II. The product was dropped not long after.

Successors

By 1995, Borland had dropped Turbo Pascal and replaced it with the RAD environment Delphi, which included the language Object Pascal. Native 32-bit Delphi versions still support the more portable Pascal enhancements (read: that are not 16-bit centric) of the earlier products including the earlier static object model.

Several Turbo Pascal compatibles also exist. The best-known ones are Free Pascal and Virtual Pascal.

The CRT issue

The CRT unit of Turbo Pascal 7.0 (used by many fullscreen text mode applications) contains code in its initialisation section to determine the CPU speed for calibration of delay loops. Unfortuately this code fails to work properly on processors with a speed greater than about 200 MHz and quits with a Runtime error 200 because it uses 16-bit DIV, the result of which doesn't fit into a 16-bit integer. The issue can be fixed either by patching the executable file or using a Terminate and Stay Resident program loaded before the problem executable (see link below).

See also

Newsgroups