Borland Turbo Pascal: A free pre-Windows treasure

How to install...

The advice here was tested on an XP machine. If you have a Windows 98 (or earlier) machine that you can use, that would be fine... maybe even better.

Turbo Pascal 5.5:

Long ago in the dim dark distant days before Windows, one of the most important programming environments for PCs was Borland's Turbo Pascal.

Version 5.5 of that classic is now available free, online. You can use this excellent Pascal for reasonable purposes (see the fine print if in doubt). Being from before Windows, the download is, by today's standards, small (just under 1 megabyte... it would fit on a floppy! Remember those?). Don't let the efficiency of the code fool you... it can do many, many things.

You can download Borland's Turbo Pascal 5.5 from:


... which should put the file "tp55.zip" on your hard disc. (Elect "Save to disc", not "open" or "run".) (Borland was called "Inprise" for a moment, and now some of their products are available from "Codegear". Codegear's page says it was "created by Borland's decision to separate its developer tools group...")

(You can get the download page directly with the link above, or go there via pages with introductions, etc, from...


...scroll down to article "Antique Software: Turbo Pascal v5.5",

click to open it...)

I'm cautious: I download things to an archive area, and then work with a copy. In this case, I put the copy in C:\tmp. That's not a place I normally work, but in this case there's a reason to break the rule. You will eventually delete this, so don't worry too much.

While unzipping the contents of tp55.zip, I got all tangled up, but that was just my fault. Eventually, you should have two folders, "Disk1" and "Disk2", in C:\tmp. Neither has sub- folders.

I then went down a blind alley which I can save you exploring. Ignore whatever you may have noticed in the install instructions about keeping things in the folders created by the zip/unzip processes. Move everything from the "Disk2" folder into the "Disk1" folder. (There are no name duplications.)

Go into "Disk1", double-click on "Install.exe" (which may show on your system as "Install".) The window that opens is rather crude. Don't be alarmed. (If you have problems doing the install, just press escape (perhaps several times) to back out. Be advised: All of the little things we've come to take for granted in Windows are not "givens" when you're working with an old application... for instance I couldn't use Crtl-C to copy the path the system suggested.) Also note that the sorts of things that you see during the install process, and while using Turbo Pascal, can be included in programs written with Turbo Pascal. While it didn't offer quite the ease of use of Windows, it has features that were not unlike some of the Windows interface that was yet to come, when Turbo Pascal was one of the best environments available. Back to work. Back to how to set it up and use it on your machine.

Press "Enter" to continue past the welcome screen. Specify "C" (probably... and if not, you should know!) as the "Source Drive".

On my machine, the system cleverly noticed that my source path would be "\tmp\disk1". If yours does too, all well and good. Even thought the path information seems to be "selected", just press enter. (If your machine did not pick up the right path, and assuming you followed my advice, tell your machine that the source path is "\tmp\disk1".)

Select "Install Turbo Pascal on a Hard Drive"

Now... we come to a choice.

I have no doubt that the system will happily install Turbo Pascal (TP) for you where-ever you want it, i.e. in any folder. But it will be easiest to install it in a folder called TP located in the root of your C: drive. This isn't really the way we do things today, but I'd recommend that you give in to TP's expectations, just for the simple life. That's what I've done in what follows. If you really, really don't want to do that, read the text at the bottom of the installer screen... it has some good news for you. I suspect that if you change the base folder ("directory" in the terminology of TP's day), you will need to use DOS names during the install process.

After you take my advice and accept the defaults, or after you specify different folders, press F9. (There's a message to that effect in the bottom line of the installer's window.)

During the install, you may get messages saying "Cannot Execute UNPACK.COM...". I'm not sure where that comes from... I didn't get it one time, did another. If you get it, you need to cure it. Say "Abort" (by pressing A.)

Still talking about curing "Cannot execute..."...

By now, you should at least have a folder C:\TP Keep it.. but delete everything in it. From C:\Tmp\Disc1, simply copy (don't move... you need a copy of UNPACK in both places) UNPACK.COM to C:\TP Try running INSTALL again. Don't worry... for now... about the message about changing your "Path"....

... now the install should go smoothly. Here ends talking about "Cannot execute...."

Now, you do, probably, have a working installation of Turbo Pascal (TP, hereafter) on your system... but if you have an XP system, it may not seem like it!

The following is clumsy... I'm sure someone can tell us how to do it better, but in the meantime... it works! And it doesn't "do things" to your settings that may have effects on other software which you don't want upset.

By the way, I'm 99% certain that what we've done has made no registry entries. You can "uninstall" TP just by deleting C:\TP and everything below it.

(You will have to take some time to get used to the odd (to us, "modern" folk) interface to TP. It is perfectly productive, just different! (I'll be giving you some help in the following.)

Now for another bit of "preparation"... you don't have to do this, but it will create a place to put the things you write, so that it is easy to have them separate from the TP system files. Not only will that reduce confusion, it will also facilitate backing up your work. You may be tempted to put the folder someplace else... and it could possibly be done.... and I don't like putting it "below" the TP folder... but I did it that way to make life easier. You can name it almost anything you like. My initials ("tkb") don't seem to crop up often in other programmers schemes, so I have called the folder I'm making tkb1proj. That name is easy for me to spot as something I've added, and easy to avoid confusing with things that the system has installed. Either use my initials, i.e. make a folder called C:\TP\TKB1Proj, or just remember that when I say "TKB1PROJ", you have to use whatever name you selected. It is possible, and perhaps wise, to make folders within that folder, one for each project you embark upon... but TP isn't quite as user friendly, in respect of folder (or "directory", as it calls them) navigation as Windows. For now, use good names for your projects, so that they can rub shoulders in one folder without too much hassle. The good news is that when you make an application (program) with TP, typically, you will have just two files... the sourcecode ("MyPrgm.PAS") and the exe file ("MyPrgm.EXE")... so having several projects in one folder is not a big deal.

(On either a Win98 or XP machine, you may need to make the "FILE=" entry in the CONFIG.SYS file say FILES=20... but I doubt that will be necessary in any machine you are likely to be using after 2006. When I find no need to do otherwise, I like to leave my system settings untouched!) (You may be able to do this, as you are able to do the "PATH" manipulations we'll come to in a moment, on a "once in a while/ temporary" basis. For now just hope everything works without the need of a "FILES=" modification! It did on two XP machines I've tried all of this on!)

=== This would be a good point, if you are in any doubt about the state of things, to rename C:\Tmp to C:\TmpOld, save anything you want to, and restart the system. What follows will be the crude way to work with TP from day to day from now on. (As I said, bits of what follows can probably be improved... but they'll "do".)

(Renaming "Tmp" as "TmpOld decreases the chance of your system using something that you don't realize it is using.... It "shouldn't" be using... or need... anything in Tmp (TmpOld) anymore, but... Hmm.)

=== So... you're sitting at a prepared system, all keen to do your first TP program. Here we go. We're going to do things "by hand" for now. In a bit, I'll show you how to automate various chores.

Open an MS-DOS window. (One way is to Click "Start | Run" and enter "cmd".)


(If you decided against my advice of making the TKB1PROJ folder, then enter CD C:\TP

Enter PATH=%PATH%;C:\TP (That may not be necessary, and there are fancier ways to do it... but for now, that "will do", and will have the least chance of affecting other things.) (On a Win98 machine, enter PATH=%PATH%;C:\DOS;C:\TP)

In the MS-DOS window, enter ..\TURBO (it doesn't have to be in upper case, but be sure to include the "dot dot backslash" prefix), and the Turbo Pascal compiler should start up!! You should get some white writing on a blue background, in the MS-DOS window that used to be showing the crude white on black. It took about 5 seconds on one machine I was using... not a problem, but a bit worrying when you are getting started!) (If you decided against my advice of making the TKB1PROJ folder, then simply enter TURBO.

A little word about the ..\ It says "Look for 'TURBO' in the folder which is the parent of the folder you are in at the moment". The reason I've told you to do things this way is that it starts you off in the folder where you want to be for saving and loading your sourcecode files, and saving your .exe files. If you don't do things my way, you have extra things to do when you come to save and load, unless you're prepared just to dump everything, all a muddle, together in the TP folder.

So! Let's play with the new programming environment!....

Press the Enter key to make the copyright window go away.

Before we play (sorry), I'll offer a little help with the TP working environment. See the "menu" across the top? ("File.. Edit.. Run.... ") It looks like a Windows menu bar. It is... sort of. But! You can't, for instance, click on "File" to see the file operations. Either press F10, which will highlight one of the menu options, and then use the arrow keys, or press the letter of the one you want, or press Alt- with the letter of the one you want. Do Alt-C now. Then, without the Alt key, press D to go down to "Destination" (You can also use the arrow keys to get there.) Press the enter key to set the destination to "Disk". Why? We'll come back to that! (You will probably have to do this again and again. Turbo Pascal probably won't remember that you want the destination for compiles to be the disc. That was normal in the "old days". If things did something one way once, they did it that way the next time! (We'll see later how to teach Turbo Pascal bad tricks. You don't have to do it again and again, but fixing that breaks other things!)) (Don't waste time trying to open the "Edit" sub-menu... we'll talk about that in a minute.)

Press F10 again (or Escape), and you should be in the "Edit" window. Enter....

program hi; begin writeln('Hi Sheepdog'); end.

EXACTLY like that :-)

(Don't overlook the period (full stop) at the end of what you need to type.)

Before you do anything else, save what you have....


Read down to "now go back and do it" before doing anything, then go through it a second time, doing it.

In order to save your work, either press F2, or Press Alt-F, then (no "Alt") S. You can use any sensible name, but, assuming you used my subfolder suggestion (and you're on your own from now on if you didn't) use.... C:\TP\TKB1PROJ\demo1sg.pas ... for this bit of sourcecode. the good news? TP will "type" most of that for you. The bad news is that you'll have to get used to slightly different editing techniques than a modern Windows user would be used to. For now, just use the backspace key to delete "NONAME.PAS", enter demo1sg, and press Enter. (TP will put the .PAS back on for you.)

The name demo1sg came from "DEMOnstration program, the 1st, from Sheepdog Guides tutorial").

Your life will probably be simpler if you keep the names of files and folders to no more than 8 characters long, and if you use no spaces in the names. You'll learn that entering filenames and paths isn't as easy as it is with Windows. Until you learn things you can postpone about using Turbo Pascal, you'll have to type the names, not just click on them in lists. (Easy ways to move around the directory tree without doing it all "by hand" do exist. Describing them isn't easy!) You won't be able to select text by dragging across it with the mouse. It is hard to believe that I really worked like this for many years! (Also bear in mind that back in those days Ctrl-Z didn't undo almost any mistake if you realize immediately that you've made one... as I just did while typing this. Nor did applications always hold your hand.... although Turbo Pascal will warn you if you try to quit it without saving your work.)

So! You've written, (and saved) your first TP program... but you haven't yet seen it run!

A quick aside:

If you need "Save As", there's a way... you have to invoke "Write To", include (I think) the full path to where you want the program saved, AND, after "finishing" Write to", do a "save". The save part isn't built into the "write to", nor, I think, does "write to" notice the directory you have set.

In "the good old days", seeing your program run was easier than what follows. (That was one of the delights of TP.) Windows XP gave up (it was time) some of the backward compatibility present in earlier versions of Windows. If you are using TP on a Win98 machine (in 5/07, I still do most of my everyday work on such machines), it will probably work better than this, but for all you XP (and Vista?) users, I'll show you how to work with TP, even on your machines.

Make sure that Compile|Options|Destination is still set to "Disk". (It will be, unless you, say, took a break and restarted TP since we set it to Disk above.)

On a Win98 machine, or if you get it working on an XP machine, or if for some reason you prefer it, you can just invoke TP's "Run". Either use the menu, or the Ctrl-F9 shortcut. But, on an XP machine, unless there are errors in your program, it will seem that nothing has happened. If there are errors, there will be messages which may not yet be 100% clear to you, but with practice you'll learn to read them. For now, just check and re-check what you've typed. When it matches what I told you to type, the program will appear to do nothing when you "run" it! By the way: Sorry... I can find no way to copy/ paste between this page and the TP editor. You'll have to do the old fashioned way!)

To see that your program has been created, and will work, use Windows to start a second MS-Dos window (Start|Run|Cmd, as before)

In that window use CD C:\TP\TKB1PROJ to move to your TP projects folder. ("CD" came from "change directory". (Remember "directory" is the old "folder").

In the new window, after doing the CD I just mentioned, enter "demo1sg". You should, almost immediately, see "Hi Sheepdog" on the screen in the same window. You've done it! Your program works! (Leave the window open for now.)

What's happened is this:

When you did "Run", TP converted your sourcecode into the machine code the computer needs, and saved a file called demo1sg.exe. The conversion is called compiling. Because you set the Compile Destination to Disk, the result of the compiling was saved on the disc. On a pre-Win98 machine, TP then invokes that for you. What I've described above, what you seem to need to do on an XP machine, is to invoke the run of the .exe by hand. No big deal. You can leave the second window open, and switch between it and TP's window as need be.

If you are working thus, you can merely press F9 to re-compile, save a new .exe when you have changed your program. (F9 works on the Win98 machine to, but in either case it merely compiles the code and saves the .exe... use Ctrl-F9 in Win98, so you compile and run the program.) A little MS-DOS trick: In the DOS window where you are testing your program, pressing F3 is as good as re-typing "Demo1SG" the next time you need it. Just to see all of this in action: Make a little change to the text in the "writeln" line, press F9, switch over to the other MS-DOS Window, press F3 to re-invoke tkb1proj, press enter... and you should see the changed text appear.

=== It's been years since I worked with the TP menu interface. Going back to it was a bit strange at first, but I'm rapidly re-discovering how nice it is. For years, I didn't like the Windows menu interface because I'd come from the, in some ways better, TP interface. You can do it! You may even discover that you, too, like it. (I won't defend the TP text editing interface. That is usable, but not better than Windows'. This, perhaps, is the moment to mention that when you are in the TP window, if you press F1, you will get help with things. If your cursor is on something Pascal knows about, e.g. "writeln", and press Ctrl-F1, you are supposed to get help with that... but it isn't working on the XP machine I'm using as I write this. Sorry... that may be another of the "needs to be on a pre-XP machine" thing. But! The good news: Just press F1 TWICE to get into an index that will take you to wherever you need to be.)

Well... there you have it. You don't know all there is about using TP or another Pascal at this point, but you have a machine that runs TP, and you've been shown how to write a program.

As I said at the outset, Turbo Pascal is a tremendously capable programming environment. If you are trying to learn Pascal, you could do a lot worse. It isn't terribly Windows friendly... use Delphi if you want to write for Windows. (I've also written tutorials for Delphi, if you are interested.)

I said TP is powerful; you might disagree. I concede that bigger things are written today... but consider how light the TP footprint is. The whole editor/ compiler is smaller that a modest 2007-era application! For the demands it makes, it is tremendously powerful.

A useful "trick"... Use Notepad or similar to create a small file consisting of...


Save that as something like "StartTP.bat" The first part can be what you like. Be sure that you're not creating somehing like "StartTP.bat.txt", which can happen on a system with "known extensions hidden." You can put it where you like. You can either double click on it directly, or create a shortcut to it. Either will take care up starting up Turbo Pascal for you, dealing with the various chores efficiently.

One last little tip: Once you are happy that you aren't making too many mistakes with settings, you might want to use "Options | Environment | ConfigSave | On" to make TP remember your preferences. But keep in mind that once you have set that, TP will behave like modern Windows applications, and mistakes you made with settings in a prior session will come back to haunt you in future sessions.


   Search this site                 powered by FreeFind
Site Map    What's New    Search

Click here to visit my homepage where you can explore other areas, such as education, programming, investing.

Looking for email, domain registration, or website hosting? If you visit 1&1's site from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service. They offer things for the beginner and the corporation.

Ad from page's editor: Yes.. I do enjoy compiling these things for you. I hope they are helpful. However... this doesn't pay my bills!!! Sheepdog Software (tm) is supposed to help do that, so if you found this stuff useful, (and you run a Windows or MS-DOS PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

How to email or write this page's editor, Tom Boyd

Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org

Why does this page cause a script to run? Because of the Google panels, and the code for the search button. Also, I have my web-traffic monitored for me by eXTReMe tracker. They offer a free tracker. If you want to try one, check out their site. Why do I mention the script? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....