Launch your Pascal. It will run inside an MS-DOS window. Right click the title bar, select properties, to set a more legible font size.
Once your Pascal is running, and you are in the edit window, enter the following:
program first; uses crt; begin clrscr; writeln('Hi'); end.
Invoke a save, either with alt-F S, or with F2. There is no "Save As", as such, in Turbo Pascal, but the first time you save something, you are given a chance to designate a name for the file. (The equivalent of "Save As" is on the file menu, as "Write to".) You could just enter "My Program" in the file name box and click "ok", but I'm going to suggest a slight improvement.
You may be in the folder (directory) into which you installed TP. Or someplace else... TP may be saving where you are from invocation to invocation. I would suggest making a separate folder for the files you create. This isn't as easy in TP as one would hope. Use your tool of choice- I like Windows Explorer- to create, outside of TP, any folders you want to use. It may pay you to stay near the top of the folder "tree", i.e. near the root directory of your drive, and to use MS-DOS folder names. (Start with a letter, use only letters and digits, and a maximum of 8.)
Once the folder is created, to move into that folder. Navigating the tree of folders is a little strange at first, but you can do it! The first strange thing is that you can't move around the directory during a "Save As" or "Load", or you can use File | Change Directory to get to where you want to save/ load something, and then do Save. The next strange thing is that, if you want to make a new folder for saving something, you have to close the Save dialog, make the folder using some tool (I like Windows Explorer) outside of TP, and then re-start the Save. Tedious, but manageable. Big help: The "file" called "..\" is a link to the parent folder of whatever folder you are in. Assign a name for the file, I'd suggest "First", or "PLT1aft". (PascaL Tutorial 1aft, which is the name of the web page you are reading.) Click "Save".
Once you've started something from scratch, i.e. by using File|New, and saved it once, then from that point on, if you use File|Save (or press F2), your work is simply saved where ever, and under whatever name you specified during the first save. The previous version of your work is over-written. Also, when you load something pre-existing, then doing File|Save will again simply replace the previous version. If you have been working on something, and you don't want to destroy the previous version, then use "File|Write to...", to change the name used for saving what you have.
Keyboard shortcuts, like F2 for save, are always nice, but in the TP environment, you really need to master the ones for your common tasks, unless you've got your mouse working for you. Several common Windows keyboard shortcuts, notably ctrl-C / ctrl-X and ctrl-V don't do the same thing in TP as they do in Windows.
So... you've typed in the little program I gave you. You've saved your typing.
Now invoke "Run" on the menu (Alt-R), and "Run" again (R) from the sub-menu (or just press ctrl-F9, the equivalent... as you can see from the right-hand column of the sub-menu.) You may well get an error message, in which case you'll get messages, and, probably the words "Compile Failed". Your Pascal will even tell you where it got confused... but that isn't always where the problem lies. If you can't see a fault where your Pascal says to look, check preceding lines. One favorite trick of new Pascal programmers: Leaving out a semicolon. (Although, in rare cases (which you'll learn to be aware of), a superfluous semicolon may be the problem!) The error message even tells you which line of your program holds the place Pascal got confused.
When there's a message on the screen, you tell it "Okay, got that, now go away" by clicking on the little square in the upper left of the message's box.
The interface used with TP comes from the days before Windows. (Yes, there was such a time... When I was a boy... (Don't let me get started!!))
TP does work in a "windowed" environment, but you could be forgiven for not liking it. However the concepts of maximized and "restored" windows are present. (I'm not sure how to mimic a minimize.) You can... really... even re-size the windows. It's just all less intuitive than modern Windows. (I strongly suspect that the "windows" environment created for TP, which can create applications using the same "windows", heavily influenced the development of Mr. Gate's "Windows". Of course the people who created the Mac interface lso deserve a lot of the credit.)
If you had an error, find it, re-save, and try to run the program again.
Don't be alarmed if it seems that nothing has happened.
When you finally (or if you are a careful copier, the first time you...) ran the program and got no "complaints", you may have noticed the screen flash, and you might even have seen the "Hi" you've accomplished. But it didn't stay. Your sourcecode ("program first; begin...") came back. Use the menus: Alt-R (To get the "Run" menu, then U for "user screen". That SHOULD bring you to a screen with "Hi" on it... someplace. There may be other "stuff" there, too. I must confess that I had a little trouble with this, so just keep at it... you'll get that User Screen thing eventually! It's been a while since I used TP, and I am a very new user of FPC. I have every confidence that both are usable... it just takes a little struggling to get fluent. I hope these pages are, at least, saving you some of the struggle? Use the menu to access the User Screen (the menu SAYS the key combination "Alt-F" should do it... but it wouldn't for me, on my XP machine.) And use the escape key to go back to the sourcecode.
Whew! It gets easier. I promise.
Just one last little flourish to finish off this first tutorial. You won't finish a real program in one go. Part of learning to program is learning to build something up by degrees. Add a second writeln line, specifically writeln('Bye'); Compile and run the program again; see your new masterpiece in action (or fix the typos!) and cheer... you're a programmer!
Oh yes... I said I'd take you through the program....Every Pascal program begins with the word "program". After that, you supply a name; I chose "First" in this case. (PLT1a would have been better, but might have confused you at that stage.) And then the line is finished with a semicolon. You get a lot of semicolons in Pascal. More on them another time.
Next in our simple first program came "uses crt;" This tells the compiler to use some stuff that is available to it in an always present unit called "crt". We needed this for clrscr to work.
Next in our simple first program came the word "begin". For every "begin" there is an "end". You can have many begin/ end blocks, and they always nest. Leaving out the rest, a complex program might look like.....
begin begin begin end; end; begin begin begin end; begin end; end; end; end.
Did I scare you? I hope not... I wanted you to look forward to the excitement of a really sophisticated project! Anyway. Begins are always paired with ends, as I said. You do NOT put a semicolon after the begin (unusual), but you do put one after the end... usually. (I'll discuss the exceptions another time.) After the final end in a program, you put a period (full stop) instead of the semi-colon.
"Clrscr" cleared the screen.write and writeln are words built into all the Pascals we've been discussing. (A rough equivalent for Delphi, by the way, is "showmessage", e.g. showmessage('Hi');).
Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org
....... P a g e . . . E n d s .....