Thursday, April 24, 2008

Turbo Pascal on DosBox

Do you still remember the time?

There are at least 3 version of Turbo Pascal free for download (version 1, 3 and 5.5), I suggest to download Turbo Pascal 5.5.

Tutorial for Turbo Pascal 5.5.

1. download the software from here.
alternative download from

2. extracted the software, there are two directory DISK1 and DISK2, basically you just need DISK1.

3. run the software
> turbo

Turbo Pascal 5.5
Turbo Pascal running in DosBox for OS X PowerPC.

You can run the program direct from Windows terminal, if you are using Linux you can run it under a simulator. I am using the DosBox simulator.

You can download DosBox from sourceforge.

After running the DosBox, create the C drive by:
> mount C c:\tp55
> mount C /home/user/foo (unix system)
(the second parameter is your Turbo Pascal program path on your real hard disk)

4. Write your first pascal program, File, New.
Program hello(output);
    writeln('hello world!');

File, Save as, hello.pas.

Compile the program shows ok, but if you run the program, you don't see the result. Actually it display the result but it was clear once the program terminate.

5. Make some modification
Program hello(output);
    n: Integer;
    writeln('hello world!');

hello world!
(input anything thing and just press enter)

6. Make it to executable
Alternatively you can make it into executable
a. from IDE
Menu, Compile, Destination (set to Disk)

b. from dos prompt
> tpc hello.pas
> dir hello.exe

Take a look at the executable, how small it is, just about 2k in size.

What's next? May be you can try to compile the Mario clone.

No comments: