next up previous contents
Next: Command Line Interface Up: Tools for Programming in Previous: Getting Free Pascal   Contents

Your First Program

It is easier to do your homework assignments if you can view the FreePascal or Borland Pascal screen and the browser side-by-side. If you are using Borland Pascal from the lab, it defaults to full screen mode. You can turn it into a window by pressing alt-ENTER. However, the computers at the lab are set up to make it easier for web authoring students (and harder for you). You need to do the following:

  1. turn Borland Pascal to a window by alt-ENTER
  2. click on the upper left ``DOS'' icon
  3. select ``properties''
  4. deselect QuickEdit (uncheck the check box)
  5. press OK
  6. select apply changes to all future invocations
  7. press OK

Furthermore, the screens are defaulted to 800x600. If you have good eyes, you can consider changing the resolution to 1024x768. A higher resolution means effectively smaller fonts, but you can also fit more information on one screen (such as the browser and FreePascal) at once. Another trick is to change the font of your DOS box (with Borland Pascal or FreePascal running in it). This is done by the following steps:

  1. click on the upper left ``DOS'' icon
  2. select ``properties''
  3. click the ``Font'' tab
  4. select a smaller font, I suggest you do not go below 6x8
  5. click OK

You have to do this every time you log in at the lab because those machines reset the defaults after every reboot.

With Free Pascal installed, you can now write your first program. Invoke Free Pascal (use the shortcut set up in the previous section). By default, Free Pascal opens a blank editor screen for you.

Type the following program in the editor. Be sure to observe the punctuations.

begin
  writeln('test!')
end.

You have to save a program before running it. Click the ``File'' menu and select ``Save''. Although the filename is not important, I will make sure it is up to eight characters long with an extension of .PAS.

Now click the ``Run'' menu and select ``Run''. Your screen will flicker a little when the program runs (because it is completed so quickly). To see the output of your program, click the ``Debug'' menu, then select ``Output'', you should see test! in this screen.

You have just written your first Pascal program that did something!

When you are done, click the ``File'' menu and select ``Exit''.


next up previous contents
Next: Command Line Interface Up: Tools for Programming in Previous: Getting Free Pascal   Contents
Tak Auyeung 2003-12-03