Mastering Pascal
Preface
Pascal is one of the most widely used PC-based programming languages.
It is also one of the best programming languages to teach good software
development techniques.

Author:
Dr W.Buchanan,
Napier University,
Edinburgh.
Downloads:
Complete
code
Port
statement
Using
Writeln/readln
Reviews:
Review

|
 |
Introduction
to Pascal and Delphi.
This book provides an introduction to programming with Pascal
and extends this to show how Borland Delphi, which uses Pascal,
is used to develop Microsoft Windows programs. |
 |
Why use Pascal/Delphi?
After many years of teaching software development to undergraduates
I have found that C and C++ suffer from several pitfalls, especially
in parame-ter passing, pointers and the lack of strong data
type checking. These areas may provide flexibility for experienced
programmers, but for novices they add to the complexity of the
program. I have also been involved with extensive consultancy
work and book writ-ing over the years and I have used C, C++
(Borland C++ and Visual C++), HTML/JavaScript, Java, Visual
Basic, Turbo Pascal and Borland Delphi. From this, I can say,
without doubt, that Delphi is the easiest and most power-ful
development system I have found. It provides a great deal of
flexibility in that it doesn't try to write all the code for
the programmer, and basically it provides a framework for the
user to add code to |
 |
Real-life Applications.
The best way to learn a programming language is to write real
applications. For this reason the book includes many real-life
applications. Chapters 13 to 20 cover some practical applications,
such as: software interrupts, hardware interrupts, graphics,
date and time, system commands, RS-232 and parallel ports. The
book thus covers three main areas:
Pascal programming
(Chapters 1 to 12).
Pascal applications
(Chapters 13 to 20).
Delphi programming
(Chapters 21 to 26).
|
| |
|
WinCRT32
Note: WinCRT32
isn't support in the standard form of Delphi 2 and 3. To use the WinCrt32
unit go the Zielglersoft
page and download it from there. There is also an excellent convertor
for Turbo Pascal to Delphi. If in doubt, email me
|
The PORT command has disappeared
from Delphi 3. This a real shame, but here is code which does
the equivalent. The two routines are ReadPort() and WritePort().
unit
DPort;
interface
function
ReadPort(port:word):byte;
procedure
WritePort(data:byte; Port:word);
implementation
function
ReadPort(port:word):byte;
begin
asm
mov dx,
port
cli
in al,
dx {read}
out dx,
al {..rewrite since some ports reset on 'reads'}
sti
mov Result,al
end;
end;
procedure
WritePort(data:byte; Port:word);
begin
asm
mov dx,
port
cli
mov al,
data
out dx,
al {..write}
sti
end;
end;
end.
Dport.PAS
Dport.DCU
Delphi 2 and later |
In order to use a console window (to
use writeln and readln), the Generate console application
checkbox on the Linker page of the Project|Options dialog
must be checked. |
Delphi 1 |
Programs which use writeln/readln require that the WinCrt unit is added in the uses list. |
|
|
| |
|
Material
| Sample (TOC) |
Presentation (PowerPoint 97/PDF) |
1.
Introduction
2. Input/Output
3. If Statement
4. Case Statement
5. For statement
6. While/Repeat Loops
7. Functions
8. Procedures
9. Arrays
10. Strings
11. File I/O
12. Records
13. Graphics
14. Software Interrupts
15. Interfacing
16. RS-232
17. Parallel Port
18. Hardware Interrupts
19. Data and Time
20. System Commands
21. Introduction to Delphi
22. Delphi I/O
23. Delphi Forms
24. Delphi Menus and Dialogs
25. Delphi Events
26. Delphi Graphics
A. Turbo Pascal Reference
B. ASCII
C. Bits, bytes and Operators
D. Delphi Reference |
1.
Introduction
2. Input/Output
3. If Statement
4. Case Statement
5. For statement
6. While/Repeat Loops
7. Functions
8. Procedures
9. Arrays
10. Strings
11. File I/O
12. Records
13. Graphics
14. Software Interrupts
15. Interfacing
16. RS-232
17. Parallel Port
18. Hardware Interrupts
19. Data and Time
20. System Commands
21. Introduction to Delphi
22. Delphi I/O
23. Delphi Forms
24. Delphi Menus and Dialogs
25. Delphi Events
26. Delphi Graphics
A. Turbo Pascal Reference
B. ASCII
C. Bits, bytes and Operators
D. Delphi Reference |
|