Subj : Free Pascal Lesson #1
To : Norman King
From : Norman King
Date : Tue May 22 2012 12:35 am
I hope that wasn't too confusing.
For a text editor you don't want a Word Processor because it will mess up the
formatting of your code and save by default in a non-text format.
If you use Notepad or Wordpad you can save in text only format but if you name
it as hello.pas it might save it as hello.pas.txt and then you have to rename
it to hello.pas or run the compiler on hello.pas.txt instead.
You might not want to save source code and binary files in the same directory
as the compiler, I only did that to make it easier to get it to compile.
Compiling with using long path names can be a big pain. It might be easier to
add the compiler into the path in autoexec.bat so you can run it without the
long path name. It requires some knowledge of the OS.
Yeah I know Windows is not DOS, but it runs command line programs and still
uses DOS commands like "dir", "copy", "del", "ren", and uses the autoexec.bat
file. That the 64 bit version did away with the 16 bit sub system. But Free
Pascal compiles into 32 bit or 64 bit executables. While there is no GUI, it is
still text based like a terminal program or BBS.
I know we are starting out just compiling text files and printing to the
console screen, but we have to start somewhere. I figured the basics was just
do a hello world program and then get into variables and then loops and
whatnot.
Free Pascal is good not just because it is free, but because it is cross
platform. If we write a Free Pascal program for Windows, it can be compiled
under Mac OS X, Linux, OS/2, etc. I figure it is good for BBS Games to be
written cross platform. But it is not a RAD language like Delphi, and it does
not have an IDE like Visual Studio, but it is free and open sourced. I am sure
later we can find some libraries to do graphics and make easier to use
programs. I am sure there are IDEs out there and the Lazarus add on to make
easier to use programs. But I want to start out at ground zero and work our way
up one step at a time.
If you get stuck, don't give up, post your source code here and let me look at
it. The FPC gives error messages so I'd need that as well. Usually the first
number is the row and the second number is the column in the text file where
the problem happened. I'll try to get into debugging some how and show you how
to fix typos and other things later.