|
|
Fix for "Runtime Error 200 "
bug
of Borland Pascal 7 on fast PCs
Explains the
cause of this bug and sumarizes solutions both for users and developers
(people who do have / don't have pascal source of their programs).
Contents:
Preface
Borland Turbo Pascal
7 is a great Pascal compiler for PC's. Unfortunately it has not been updated
by Borland for many years.
All programs compiled
with Borland Pascal 7 that use the system unit Crt (almost all programs
do that) abort with the error message "Runtime Error 200" on all
fast PCs, for example Pentium II with 233 MHz.
Programs compiled
with Borland Pascal 6 are said to not abort with a runtime error, but
their delay is completely wrong on fast PCs (and the problem starts there
at much lower speeds than the problem of version 7).
This Web page tries
to explain the problem and summarize some existing solutions.
Borland
(aka Inprise) does not offer
a solution for this bug (shame on them!).
Cause
The bug is in the initialization
for the delay procedure that is part of the initialization of the Crt unit.
The delay initialization is called in every program that uses the Crt unit,
not just on those that use the delay procedure. The Crt unit is included
in most programs that are written in Borland Pascal.
The delay initialization
counts how often a tiny do-nothing loop must be called in order to delay
by 55 milliseconds (time measured by reading the Bios Time Counter at
memory address 40:6C that ticks 18.2 times a second, i.e. each 55 milliseconds).
This number is then
divided by 55 to get the number of calls for one millisecond. The result
is written to a word (16 bit) variable. The overflow of this variable
triggers the run time error (the meaning of Runtime Error 200 is division
by zero, but it is caused by an overflow in this case).
Solutions
The following list shows
all solutions that I currently know.
Index of recommended
solutions
- You have only
an EXE file, no Pascal source
- ask the person
who does have the pascal source for a new or recompiled version
- TpPatch
Patch program for existing executable files
(caution: only for programs that no not require correct timing)
- You have Turbo
Pascal 7.01
- T7TplFix
patch program for Run Time Library file (
TURBO.TPL )
- You have Borland
Pascal 7.01
- if you need
only real mode, use T7TplFix
from the section above
- extract the
file CRT.DIF from T7TplFix,
apply the listed changes to CRT.ASM and then recompile the run time
library
- You have Turbo
Pascal or Borland Pascal version 7.0
- Contact Borland
/ Inprise to obtain
version 7.01 because version 7.0 contains several bugs. Lately there
have been reports in usenet that Borland doesn't know about a 7.01
bug fix version, it's still called 7.0, so it may be better to ask
for replacement disks for version 7.0 (will come as one cdrom containing
version 7.01).
- Risk using
one of the other solutions below
Index of other
solutions
- bppatch
Solution
by German computer magazine c't
contains description,
program patch, source patch and copy of patched run time library
problem: rtl is based on version 7.0, thus reintroducing several old
errors while fixing one new one, description and patch are very good
though.
- bp7patch
patch program for all Run Time Library files ( TP 7.x )
problem:
does much more changes than can be easily explained Recommended
by Borland
Recommended
for TP 7
-
Comments
Looking through
the list of files above, most of you will probably come to the conclusion
that no real solution seems to be available.
Programmers
using Turbo Pascal 7.01 can now solve their problem since t7tplfix.zip
is available. Programmers using Borland Pascal 7.01 and still must
search and apply the patch themselves to get a working version of
TPP.TPL (for protected mode). Users without source of their programs
can still not get a real solution if the programs rely on a precise
delay function. Such a solution will probably never exist.
Of the two files
recommended by Borland, one will cause the delay procedure to not
run correct on fast computers, the other can be used only by owners
of the full Borland Pascal package because the file TPP.TPL is required
and it does a lot of suspicions changes to other units as well.
By using any
of the other files, you must send your customers a program that is
patched to patch itself at runtime with even its authors saying that
this is not very nice. Or you can prevent the run time error but must
live with a delay procedure that is known to run at unpredictable
speeds. Or you must persuade your customers to install a TSR program
that you don't know precisely what it does. Or you reintroduce all
the bugs of Borland Pascal 7.0 when replacing a otherwise correct
version 7.01 with a patched version 7.0. Or you can used a patched
run time library that contains a lot of additional changes that nobody
has yet explained.
It is a shame
for Borland that they seem to be unable or unwilling to solve this
bug themselves and offer download of fixed TURBO.TPL and TPP.TPL files
from their web page!
If you feel
like you should say Borland what you think about their support, please
remember they have changed their name to Inprise,
so you may try mailing to
customer-service@inprise.com.
|
|
Programming
Links
|
|
Back
to 1st Page |
Click
this link to back to programming first page |
Download
|
You
can download my program and you can even download the source
code... |
|
|
|