• Please review our updated Terms and Rules here

IBM PC PASCAL COMPILER 1981 - program that shows how to use graphics

Old_hitech

Experienced Member
Joined
Dec 30, 2016
Messages
112
Location
Ventura CA
I have a IBM PC RevA with 128K RAM and I would like to learn how to write a Pascal program using graphics. I am using the IBM PC Pascal Compiler from 1981 and reviewed this example program in the Pascal Compiler manual
Program file:
(*$INCLUDE:'GRAPHI*)
PROGRAM PLOTBOX (INPUT, OUTPUT); USES GRAPHICS (MOVE, PLOT);
BEGIN (*GRAPHICS*)
MOVE (0, 0);
PLOT (10, 0); PLOT (10,10); PLOT (0, 10); PLOT (0, 0);
END.

I have entered this program and when I try to compile it I get error
File Access Error in GRAPHI; Code: 1004
Compiler Cannot Continue

Code 1004 error is Error During Opening of Existing File

Appreciate any help with this. If someone has a example Pascal program that uses graphics for the 1981 Pascal Compiler, I would really appreciate that.
-Gil
 
Your program includes a unit named GRAPHI, or GRAPHICS, with the graphics routines, but the compiler cannot find the file. Check if there is a file GRAPHi.* somewhere in the compiler disks and put it in the same directory of the program. The example in the manual includes a sketch of the code of GRAPHI, and a couple of other files with a few lines of code each. None of them resemble a complete graphics library, however. From the description in the manual it looks more an example of the use of UNIT rather than an example on how to use graphics in pascal. So I don't know if it is possible to use graphics in the IBM Pascal Compiler.

Borland's Turbo Pascal includes a graphics "toolbox" since version 3.0 that is well documented and would be a better choice to start: http://www.bitsavers.org/pdf/borland/turbo_pascal/Turbo_Pascal_Graphix_Toolbox_Version_1_1985.pdf

Turbo pascal 3.0 should work with 128k of RAM, later versions may not.
 
"File access error" sounds like it can't read a file, or you asked for a file that doesn't exist. On the line that has INCLUDE:'GRAPHI it looks like you forgot to put a terminating apostrophe.

Looking at the manual, this is the correct text:

Code:
(*$INCLUDE:'GRAPHI'*)
PROGRAM PLOTBOX (INPUT, OUTPUT);
USES GRAPHICS (MOVE, PLOT);
BEGIN (*GRAPHICS*)
  MOVE (0, 0);
  PLOT (10, 0); PLOT (10,10);
  PLOT (0, 10); PLOT (0, 0);
END.
 
Thanks for the replies. I read the manual a few more times and found that I needed to create the GRAPHI file (see attached pics). After reading the second page a few times and looking at the example code I have come to the conclusion that this example code is just meant to show examples of the USES statement. It is not an example of how to use/create graphics using the Pascal compiler. I reviewed the index at the back of the Pascal Compiler manual trying to find references to graphics commands and could not find any. I've concluded that this Pascal Compiler does not support graphics. I did check my source code for the 'GRAPHI' statement and it does have the terminating apostrophe. I just did not copy the source text correctly, but thanks for the help. I am now looking to get a copy of Turbo Pascal 3.0. The system requirements are 64K RAM so I should be able to run it on my 128K IBM PC.
Screen Shot 2020-10-27 at 8.23.34 AM.pngScreen Shot 2020-10-27 at 8.22.27 AM.png
 
Yes, Turbo Pascal 3.0 is an excellent environment (edit/compile/run from the same editor) to develop programs with on a 128KB PC. If you somehow exceed the 64K limit of a single program, it allows you to CHAIN to different sections of code, which is crude overlay system.

To maximize your amount of available memory developing with Turbo Pascal 3, I highly recommend DOS 2.11. DOS 3 and higher offer no benefit for a 128K system without a hard drive, and would only take up more memory.
 
You can download Turbo Pascal 3.02 from here: http://codecentral.embarcadero.com/Item/26016 It is free for personal use, but you have to register to download it.
The file list includes the graphics unit (graph.p and graph.bin) and two examples of graphics program (art.pas and turtle.pas).
The toolbox was sold as a separate product back then, so the graphic library included in the download may not be complete.
 
Back
Top