home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
USCX
/
PASCAL01.ZIP
/
IBMPAS.DOC
< prev
next >
Wrap
Text File
|
1985-01-07
|
31KB
|
646 lines
1: Screen Control From Pascal 10-01-1982 USER UPDATES
A recurring question is: how does a Pascal program determine the
position of the cursor on the screen?
With the way DOS Pascal is implemented on the IBM Personal Computer, you
cannot perform many BIOS functions directly. A program must be written
in assembler language and linked with the Pascal program in order to
perform the desired BIOS functions. Actually, the Assembler program
uses the BIOS video interrupt (Hex 10) to control the screen. If you
desire to follow this approach, it is strongly recommended that you
read the Technical Reference Manual beginning on page A-43, where the
listing for the BIOS video interrupt begins and where register contents
for each available function are documented.
Following are two sample programs that were tested on an IBM Personal
Computer Monochrome Display. They should be assembled, compiled, and
then linked together.
The Assembler program depicts the structure of the variable list passed
to it from Pascal and represents one approach toward assembler coding.
In the Pascal program, notice that, at those points where the Pascal
statement ReadLn is user to pause for input, the cursor is positioned
in the reverse video area of the screen. This is a function of the
ReadLn statement which places the cursor at the beginning of the next
line, then waits for input.
Finally, notice that the assembler INTRPT routine can be used to drive
any BIOS interrupt.
(The programs are available for downloading from the <F>iles section of
this bulletin board.)
The next message is:
2: Correcting False OUT OF MEMORY Errors 06-01-1983 USER UPDATES
<R>ead, <N>ext, or <Q>uit? R
The following procedure is necessary to fix false "OUT OF MEMORY"
errors that occur while the user is compiling Pascal programs on the IBM
PC or IBM PC XT with large memories.
If you are updating your Pascal Compiler for the first time, you'll need
to make copies of your original compiler diskette before debugging. You
can make these copies by using the DISKCOPY program on the DOS diskette
and following the "Copy instructions" below. Follow the "Copy
instructions" for every compiler diskette that has not been updated.
(If you have previously updated all of your Pascal diskettes, proceed to
the "DEBUG instructions".)
COPY instructions
- Insert the DOS diskette in drive A and a blank formatted diskette in
drive B. Type:
DISKCOPY A: B:
- Remove the DOS diskette from drive A and insert the original Pascal
Compiler diskette in drive A. Press any key to begin the DISKCOPY. When
DISKCOPY is completed the program will prompt:
COPY ANOTHER (Y/N)?
- Enter your desired response. In drive B you now have an exact copy of
the original Pascal Compiler diskette. Remove this copied diskette
from drive B and label it with one of the following appropriate labels:
UPDATED MASTER PAS1 DISKETTE
UPDATED MASTER PAS2 DISKETTE
UPDATED MASTER LIBRARY DISKETTE
Any future updates should be made to these diskettes.
Debug Instructions
- Insert the DOS diskette in drive A and the Updated Master PAS1
diskette in drive B. Type:
DEBUG
LDS:100 1 A 1
DDS:12A L1
- The program will display the following:
XXXX:012A 7E
(xxxx is a four-digit hexadecimal address.)
- If this is not displayed, restart the update procedure and return to
DOS by typing
Q
- To continue the update, type:
EDS:12A 76
WDS:100 1 A 1
- Remove the Updated Master PAS1 diskette from drive B and insert the
Updated Master PAS2 diskette in drive B. Type:
LDS:100 1 F 1
DDS:12A L1
- The program will display the following:
XXXX:012A 7E
(xxxx is a four-digit hexadecimal address.)
- If this is not displayed, restart the update procedure and return to
DOS by typing
Q
- To continue the update, type:
EDS:12A 76
WDS:100 1 F 1
- Remove the Updated Master PAS2 diskette from drive B and insert the
Updated Master Library diskette in drive B. Type:
LDS:100 1 9 1
DDS:1BA L1
- The program will display the following:
XXXX:01BA 7E
(xxxx is a four-digit hexadecimal address.)
- If this is not displayed, restart the update procedure and return to
DOS by typing
- To continue the update, type:
EDS:1BA 76
WDS:100 1 9 1
Q
You are now back in DOS. Any future recreations of your working
compiler diskettes should be made from the Updated Master Compiler
diskettes with the DISKCOPY program. Be sure to make a backup of your
updates diskettes for future use.
The next message is:
3: Pascal Compiler Version 2.0 04-05-1984 USER GROUP SUPPORT
<R>ead, <N>ext, or <Q>uit? R
PERSONAL COMPUTER PASCAL COMPILER VERSION 2.0 (6024128)
The Personal Computer Pascal Version 2.0 supports all of the facilities
of the International Standards Organization working draft #6, with the
exception of conforming array parameters, which are instead provided by
the "super array" type. Many additional features are also supported.
This software product provides you with a system development environment
for the creation and execution of Pascal programs. The structured
programming facilities and extensive data structures in Pascal make it a
very useful language for large applications programs.
HIGHLIGHTS
o IBM 8087 Math Co-processor Support
o Ability to build applications that will run either with or
without an IBM 8087 Math Co-processor present
o Double Precision Arithmetic
o 4-Byte Integer Arithmetic
o Single Level Overlays
o Ability to use available memory up to 640KB at runtime
o Path support at runtime when using DOS 2.00 or later
o Library manager for creating user written libraries
o 64KB Data Structures
o ISO Standard plus IBM Pascal extensions
o Super Array Type
o Separate compilation of modules and units
o Varying length strings
o System programming features
o Object modules may be linked with subroutines written in
Personal Computer FORTRAN Version 2.0 or Macro Assembler
o Various additional improvements from Version 1.0
o Improved code generation
o Smaller library requirements
o More efficient use of memory at compile time
RELATIONSHIP TO PRIOR VERSION
The following enhancements are part of Version 2.0 relative to
Version 1.0.
o Support for IBM 8087 Math Co-processor
o Improved arithmetic capabilities
o 32 bit arithmetic
o Improved transcendental function support
o Double precision real numbers
o Support for DOS 2.00 file names
o Support for a long heap (allows 640KB program segment
crossing)
o Addition of Library Manager and Large Linker
Also, the publication has been substantially improved. The
Pascal Version 2.0 compiler does not run with DOS 1.1. The
Version 2.0 Runtime will operate with DOS 1.1 if no DOS 2.0
functions (paths) are used.
PREREQUISITES
The Personal Computer DOS 2.00 or later is needed to provide the
necessary software to prepare, compile and run a Pascal program.
A minimum of 160KB and two single sided diskette drives or one
single sided diskette drive and one fixed disk are required. A
printer and an 80 column display are recommended. An IBM 8087
Math Co-processor is supported but not required.
The next message is:
4: Pascal Compiler Version 2.0 Trade-Up 04-05-1984 USER GROUP SUPPORT
<R>ead, <N>ext, or <Q>uit? R
PASCAL COMPILER VERSION 2.0 TRADE-UP (6361142)
Current users of Pascal Version 1.0 will be offered a trade-up to
Version 2.0. The trade-up includes the same package as the
Version 2 product (manuals and diskettes). The trade-up will be
offered concurrently with the announcement of Version 2.0.
The procedure is the same as that used for the Multiplan 1.0 to
1.1 upgrade. These procedures are as follows:
1. The offer to upgrade Pascal 1.0 to 2.0 is being extended to
Pascal 1.0 licensees.
2. Sales locations will be provided a packet containing a store
display and order forms to be used by the licensee or dealer.
3. The order form contains information pertinent to obtaining
the upgrade product.
4. The order form may be completed by the licensee or the
dealer.
5. Payment for the upgrade product is to be by check or money
order made out to the IBM Corporation. Applicable state and
local taxes are to be paid by the licensee.
6. Dealers requiring the Pascal upgrade product to be delivered
to their store location must forward proof-of-purchase (front
cover of Pascal manual), the order form (signed) and payment
to IBM Corporation, P.O. Box 3160, Wallingford, CT, 06494.
7. Payment made by the dealer is tax exempt, provided applicable
taxes have been collected from the licensee and reported to
state and local governments as appropriate. Dealers are
requested to include on the order form their tax exemption
number.
8. The fulfillment house will mail to the addressee the Pascal
2.0 upgrade product.
9. The upgrade is available beginning March 31, 1984 and expires
September 30, 1984.
The next message is:
5: Organizing Pascal Diskettes 04-05-1984 DAVE CORTESI
<R>ead, <N>ext, or <Q>uit? R
(This message was re-printed from the April issue of EXCHANGE)
Dave Cortesi, Silicon Valley Computer Society
While I have been using IBM Pascal for a month now, others just starting
might be interested in a method I use to organize diskettes for easy
compiling.
I've always split diskettes into two categories: "project" and "work".
A project diskette is a repository for files and only that; it has no
commands and no system files. Project diskettes are normally loaded
into the B drive. For Pascal work, a project diskette contains only
Pascal source and object files and maybe some test data (the EXE files
are too big, usually; they go on disks where they will be used). Pascal
programs get a .PAS extension; modules are .MOD, interfaces are .INF;
and implementations are .IMP. You might have several project diskettes,
each with files related to one "project".
You probably would have only one Pascal "work" diskette. A work
diskette contains the system files, plus command files that you use in
your work: Mode, Chkdsk, Edlin, etc. It also contains the batch files
you use (there is lots of opportunity to use .BAT files when working in
IBM Pascal). The Pascal work diskette has to contain one file from the
compiler distribution: PASKEY. And finally, the work diskette gets all
scratch files and the working copies of all source programs while they
are being worked on. A work diskette is never backed up; the policy is
that there is nothing on it that can't be recreated or retrieved from
somewhere else.
The third diskette in the system is the compiler disk. The following
files just fit on one double-sided diskette:
PAS1.EXE PAS2.EXE PASCAL.LIB LINK.EXE
This diskette can have a write-protect sticker on it. Here's how it
works. The work diskette stays in the A drive all the time. Insert the
relevant project diskette in the B drive and copy the program to be
modified from B to A. Edit it on A. Put the compiler diskette in the B
drive and run a batch file like this one:
B:PAS1 %1,,CON
PAUSE hit enter if "No Errors Found" else Break
B:PAS2
PAUSE hit enter if "No Errors Found" else Break
B:LINK %1,,NUL,B:PASCAL
When the new program works, put the project diskette back in B and copy
the final version of the source and object (but not EXE) from A to B.
If you have only single-sided drives, you will have to use three
compiler disks; your .BAT file can prompt you when to change them.
Frankly, I don't see how users of single-sided drives can compile at
all; the temporary files (PASIBF.*) are terribly big. At the very
least, you will have to erase every possible file from the work diskette
before starting the compile; a batch file can help can help there, too.
The next message is:
6: Review of Pascal Compiler Ver. 2.00 08-27-1984 CARRINGTON DIXON
<R>ead, <N>ext, or <Q>uit? R
(This article was re-printed from the July issue of Exchange)
Carrington Dixon
North Texas
IBM Personal Computer User Group
My upgrade of the IBM Pascal Compiler arrived a few days ago. Most, if not
all, of the bugs in Version 1.00 have been fixed and a number of
significant new capabilities have been added.
The first thing one notices is that the documentation has nearly doubled!
Where the original version required only one binder to hold its four
hundred odd pages, the new version requires two binders: "Pascal Compiler
Fundamentals" and "Pascal Compiler Language Reference". Each is the size
of the original document. The latter supplies an alphabetically arranged
discussion of all the reserved words, functions and metacommands for IBM
Pascal. The former supplies a topical discussion of many features, much as
the original did, and gives instructions for executing the compiler, linker
and the library manager.
New with this version is support for the 8087 chip, double precision
arithmetic and long integers (32 bit). Programs now can address up to
640KB of memory via the long heap management routines. Single level code
overlays are supported as are DOS 2.x pathnames (both at compile time and
at runtime). Data structures now can be as large as 64KB. The internal
floating point format has been changed for reasons of 8087 compatibility.
Because of the many different options that may be required, Pascal no
longer comes with a ready-to-use object library. IBM supplies a SETUP
procedure that makes installing Pascal relatively painless. There are two
choices of DOS interface routines: DOS 1.1 and DOS 2.0. The former will
produce files that can run under DOS 1.1 or DOS 2.x but will not support
pathnames under 2.x. The latter supports pathnames but will not run under
DOS 1.1 at all.
There are three choices of math routines: 8087ONLY, REGMATH, and EMULATOR.
As the names imply, the first choice will produce files that require the
8087 chip for execution; the second will produce results in a precision
that is comparable to the old Pascal; and EMULATOR is for the undecided.
These math routines will use the 8087, if available, and will produce the
largest EXE files of the three choices and run slower than the REGMATH
routines on machines without an 8087 chip (the higher precision costs).
Note that this configuration is made once at installation time and need not
be repeated every time the linker is run. All of this is made possible by
the Library Manager, a program that has been available from Microsoft for
nearly a year but is making its first appearance in an official IBM
version. This utility can create object libraries and update existing
ones. Object modules can be added, deleted or replaced on existing
libraries. A cross-reference listing of a library can be generated, and an
object module can be extracted from the library and placed into its own
.OBJ file. This capability is extremely welcome as it was awkward to build
a program from a number of separately compiled modules without it.
A new version of the linker program, 2.20, is included on the library
diskette. This version supports single level overlays and program sizes of
up to 1 megabyte. There is no new linker directive to support overlays.
Instead object modules to be placed in overlay are pre-processed with the
MKOVL.COM program. The overlay loader PLOADER.OBJ is then included before
the main program in the LINK command line. Each overlay is brought in
explicitly by calls to the LOADER function from the main program. The
Reference Manual has a rather lengthy example of this for those who may
need the capability. This feature works only for programs that run under
DOS 2.x; it will not work under DOS 1.1.
Several bugs and short-comings of the original Pascal Compiler have been
fixed in this release. The bug where the sine function returned incorrect
values for negative angles has been fixed. It is no longer necessary to
run CHKDSK to recover disk space after the compiler has terminated because
of some error in the source code. The compiler and linker now set
ERRORLEVEL so that batch files can check for compile errors. (You can even
set ERRORLEVEL from your Pascal program, if you happen to stumble across
the documentation on how to do it, hint: see page 4-7). The default for
the DEBUG compiler metacommand has been changed from ON to OFF.
I have not had a chance to recompile any major programs, yet. I dug out my
old sine test program (which demonstrated the old SIN error) and ran it
through both compilers. I used the REGMATH library and set DEBUG to OFF in
the source file to produce something like apples-to-apples comparisons.
This program does little more than print out the values for SIN and COS for
every 0.5 radian between -10 and 10 radians. The results are:
Version 1.00 Version 2.00
__________________________
Compile time 40 sec 44 sec
Link time 1 min 4 sec 1 min 24 sec
OBJ size 938 bytes 994 bytes
EXE size 32384 bytes 31046 bytes
Run time 22 sec 7 sec
This is more a measure of the speed of the new math routines than of the
generated code. Still, this kind of speed up is very impressive.
The BYTE 'Sieve of Eratsthenes' test from the January 1983 issue gives a
slightly different picture of the two compilers:
Version 1.0 Version 2.0
__________________________
Compile time 40 sec 44 sec
Link time 50 sec 51 sec
OBJ size 816 bytes 867 bytes
EXE size 32512 bytes 26966 bytes
Run time 17 sec 16 sec
All these times are from the Norton TIMEMARK utility and thus include the
load time from a floppy disk. The difference in the link and run times are
within the variation that one might expect from one run to another; that
is, no measurable speed difference. The significant improvement here is in
the EXE file size.
The new documentation for Pascal is not only larger, it is better; IBM has
added a number of examples. There is even an explanation of how to use the
DOSXQQ function; that was left as an exercise to the user last time. There
are still a few oversights and omissions (like the setting of ERRORLEVEL
mentioned above) but your chances of finding the information you want and
of understanding it once you have found it are very much improved.
Although the compiler can produce code that will execute on any supported
configuration of PC, the compiler itself will only run under DOS 2.x, and
it requires at least 192KB of memory. The manual suggests that object
modules created by the version 1.00 compiler should not be linked with
those created by the new compiler. They include the FILKQQ and FILUQQ
modules. The INC module has been replaced by FINK.INT and FINU.INT; so,
modules that included them will have to be changed before they will
compile. The internal representation of floating point numbers has
changed; so, binary data files that contain floating point numbers cannot
be passed between programs compiled under the different versions.
Documentation on the Unit U function calls and the detailed FCB are no
longer included as IBM recommends that these interfaces not be used.
The list price for the new compiler is $350. For a limited time, owners of
version 1.00 can order the upgrade from IBM for $100; your Authorized
Dealer has the forms for that right now.
[Editor's note: A complete product announcement of the new Pascal version
2.0 appeared in the April issue of Exchange.]
The next message is:
7: Why Pascal? 11-05-1984 MIKE SCHNAPP
<R>ead, <N>ext, or <Q>uit? R
(This message has been re-printed from the September Exchange)
Mike Schnapp
San Francisco IBM PC Users Group
If you are thinking of making the effort to learn a programming language,
you should consider studying Pascal. First-time students of programming
who master this powerful language often have a relatively easy time learn-
ing other languages. Some of the reasons for this are:
1. Pascal is self-documenting, which may be its most important aspect.
Programs written in it can be very clear and concise. They are made up
of English-like sentences that can be arranged so you can virtually
read a finished program as if it were a novel or a cook book.
2. Pascal is an unambiguous, structured computer language that allows
instructions to be grouped into orderly "sections" that are
"self-explanatory," in contrast to an unstructured language such as
BASIC. The programs cane un-decipherable block with line numbers of up
to six digits on one side. However, writing a program in Pascal
doesn't in any way guarantee that it will be readable, but it is easier
to make it so.
3. Pascal can be modularized and it allows you to build definitions
(called PROCEDUREs and FUNCTIONs) which can be used in other defi-
nitions. These customized "modules" can be used again in later
programs.
In my opinion, Pascal may be the most influential contribution to program-
ming made in the past 25 years and is not only a programming language but
is also a statement of programming style. Thus, one major aspect of Pascal
is its impact upon the way programs are conceived and composed. Pascal con-
tains the very best of several well known languages, such as BASIC,
FORTRAN, and COBOL.
The next message is:
8: Parameter Transmission in Pascal 11-05-1984 BRUCE MILLER
<R>ead, <N>ext, or <Q>uit? R
(This message was re-printed from the September Exchange)
Bruce W. Miller
Trumbull PC User Group
INTRODUCTION TO PARAMETERS: A parameter is a variable that is used to pass
information between different sections of a program. The different sec-
tions or "subprograms" of a program are called procedures and functions in
Pascal. They are similar to BASIC subroutines and function definitions. In
some versions of BASIC, information can only be passed by means of "global"
variables, ones which may be used by any section of the program.
Since global variables can be altered by any section of the program, there
is the possibility that a variable's value could change by mistake. For
instance, two sections of the program could use the same name for different
variables, which might cause unwanted and unpredictable interactions
between the two sections. The use of global variables also makes it diffi-
cult to write independent modules. In modular programming, each procedure
or function should have only one path for data to enter, and one path for
data to leave.
Parameters help control the flow of information into and out of
subprograms. Variables defined within the subprogram are termed "local" in
that their value is defined and changed only within the subprogram. It is
more difficult for data to become scrambled or altered by mistake by other
sections of the program. Because parameters standardize the way in which
data enters and leaves a subprogram, it is possible to reuse standard pro-
gram modules over and over in different programs.
An identifier used when a subprogram is called is known as an "actual"
parameter. An identifier used when a subprogram is defined is known as a
"formal" parameter.
Pascal parameters can be input-only; data can flow in to the subprogram but
cannot leave. Here is an example of a procedure declaration with a "pass by
value" parameter declaration; the type "real" refers to the formal parame-
ter "num":
procedure display(num:real);
begin
writeln('Your # is ',num);
end;
When the procedure "display" is called, the value of the actual parameter
(variable or arithmetic expression) is passed to the formal parameter "num"
for use inside the procedure. For example:
display(10.0/5.0);
The value of the expression is 2.0. Parameter "num" will take on this
value.
Incidentally, the parameter "num"'s value can be changed locally inside the
procedure without affecting any variables named "num" outside the
procedure. For this reason "num" is called a "local variable".
Pascal parameters can be "input/output"; data can flow in to or out of the
subprogram. Here is an example of a procedure declaration with a "pass by
reference" parameter declaration (designated by "var"). The type "real"
refers to the formal parameter "doubleme".
procedure twice(var doubleme:real);
begin
doubleme := 2.0 * doubleme;
end;
When the procedure "twice" is called, the formal parameter "doubleme"
stands for the actual parameter. Any modifications to "doubleme" are made
to the formal parameter used when the procedure was called.
For example:
radius := 3.0
twice(radius);
The value of the actual parameter "radius" (3.0) is doubled when the formal
parameter "doubleme" is doubled. This is because the formal parameter
"doubleme" refers to the same place in memory as the actual parameter "ra-
dius". When passing by reference, remember that both the actual and the
formal parameters must be variables.
Strings, reals, characters, integers, arrays, records and user defined
types can all be passed as parameters. In some versions of Pascal even pro-
cedures and functions can be passed as parameters.
Parameters control the way data flows in and out of a subprogram allowing
it to remain a self-contained module. Modular programs are easier to
implement, debug and maintain than non-structured programs.
That's all the messages there are.
[INFO] Press <H>elp <I>ndex <R>ead <S>end <D>elete <C>hange or <Q>uit -->C
[INFO] Enter name of topic: (? for list; Q to quit) C
[INFO] Press <H>elp <I>ndex <R>ead <S>end <D>elete <C>hange or <Q>uit -->R
Please enter message number or date to BEGIN reading
(ENTER for all messages since last logged on, 1 to see all, or Q to quit)
>1
1: Oh say can you 'C' 12-05-1984 GLENN HUFF
(This message was re-printed from the November issue of Exchange)
E. Glenn Huff
Raleigh Personal Computer Club
Historically, C evolved at Bell Laboratories from its predecessor, B,
which evolved from yet an earlier language. C is a language designed by
people who write code, as opposed to people who design languages. On
first look, it is obviously not a language intended for the casual user,
and certainly not for the novice. It is not a language that believes
you should be protected from yourself.
C is a very terse, powerful and generally fast language, oriented
towards systems and utility programming work. C programs usually waste
very few characters in implementing a function. A classic example is -
strcopy(src,dest) /* copy string src to string dest */
char *src,*dest; /* the parameters are pointers to characters */
while (*dest++=*src++) /* byte by byte copy until null delimiter */
This example illustrates many aspects in just a few lines. It is a
small code fragment or function, which performs one job. Generally,
when the base C language lacks a capability, the capability can be added
by creating a library routine. This keeps the language clean.
The parameter definition illustrates an aspect of the language referred
to as typed pointers. The prefix asterisk indicates that the following
variable is a pointer to the object of type "character". C handles
pointers very efficiently.
The "while" clause illustrates a powerful, and sometimes unsettling,
aspect of the language, that of side effects. Whereas languages like
PASCAL abhor the notion of side effects, C features them. In essence,
the while clause steps the pointers through the source and destination
character strings, assigning the source value to the destination value.
Since the string terminator is null (a byte of all zero bits), the value
of the expression is non-zero as long as there are additional bytes to
copy. Since the value of the expression is determined prior to it being
tested, the terminating null is also copied. One last note is the use
of the "++" operator, which indicates increment after using the
variable.
The null statement, which is the target of the "while", is extraneous;
there's simply nothing left to do since all the function was performed
as a consequence of the test in the while clause. Some of you will
appreciate this terseness as a thing of beauty and a joy forever.
So much for a description of the terse and powerful nature of C. I
think you see why C will never replace BASIC for the novice.
"But how would I ever get a C program to run?" you might ask. Frankly,
it is sometimes a bit of a challenge, what with all those powerful side
effects. Historically, I've used a "self-built" trace, using I/O calls
to display variable values at critical points of the program. That's
crude, but it beats DEBUG at the generated code level. What it doesn't
even approach, though, is a source level debug tool, which can show var-
iables by name and step through the program a SOURCE line at a time,
optionally skipping the code in lower level functions at our whim.
With the source level DEBUG tool, instead of wondering what happened
when your latest marvel didn't run the first time, you can step through
it one source statement at a time. You can examine the variables by
name, arrays and structures by name and subscript, and try expressions
to see their result.
That's the type of tool that makes it easier to see C. Not only does it
make programming much more productive, it is also a valuable learning
aid.
Being able to see the variables and arrays/structures by name is
helpful. If you use C and can get a source level debugger with your
compiler, by all means take a look at it. You will be greatly rewarded.
That's all the messages there are.
[INFO] Press <H>elp <I>ndex <R>ead <S>end <D>elete <C>hange or <Q>uit -->Q