Pascal Error 200 Patch
Contents |
MSS03USA 2006South Africa 2008 Last updated: July 18th, 1999(Uploaded May 17th, 1998) Runtime Error 200 running a Pascal program on fast systems (PII 266+) Contents of this document General information Programmers information Programmers Option 1: Enhancing the Delay-routine Programmers Option 2: Removing the Delay-routine Optional replacement delayloop Users Patch-program tp7p5fix General information The Runtime Error 200 (Division by zero) bug is not part of
Dos Runtime Error 200
the Pentium Errors. It's a mistake Borland made. The initialization part of the CRT unit has a calibration loop for the
Freedos Runtime Error 200
procedure DELAY. The resulting value of a counter depends on the speed of the cpu. This counter has an overflow on high speed cpu's, including Pentium II 266 Mhz and faster. Actually it is
Patchcrt
the same bug that on earlier processors caused Delay to be inaccurate, that now causes programs to fail with a runtime error if they use the CRT unit! Some (earlier?) compiler versions mysteriously seem to go free of this bug - Delphi doesn't have them, for instance, and Turbo Pascal 6 seems to work too. Please note: I take no responsibility for the potential damage people may do to their dosbox runtime error 200 RTL's, working programs or vital data while using the instructions in this document. Keep backups of the appropriate files! (and then some...) Programmers As a programmer you have several different options. First of all you can disable the delay-routine completely. If you need a delay routine you can use the one found in this document, you can create your own, or you can find another one somewhere on the web. Another solution is to change the Delay-routine so it will work on todays fast systems. This solution found in this document should push the problem about 10 years into the future if we assume that Moores Law is correct. If you're having Borland Pascal, you also have the sources of the runtime library. Just make the following changes and recompile the complete runtime library. A MAKEFILE is included with the sources. If you have Turbo Pascal only, it's a bit more complicated. You'll need the sources of unit CRT. At least the files CRT.PAS, CRT.ASM and SE.ASM. They are the same in 7.0 and 7.01. Unfortunately copyright laws prevent me from letting you download the patched CRT.TPU file from this server, so please change it yourself (it is pretty easy): Implement the changes, and assemble (TASM 3.2 preferr
games running before you start asking questions. Topic locked 3 posts • Page 1 of 1 Fix "Error 200" (Divide by zero) - by Snover and Stiletto, with thanks to edelbeb by Snover » 2002-7-26 @ 00:40 If you're trying to play an old game and it was written in Turbo Pascal, chances are, on any machine over 200MHz, you will get an Error 200 (Divide by zero error). This program corrects the problem by patching your executable. From the readme... ctbppat v1.2 © Andreas Stiller [April 2000]ctbppat fixes programs coded in Borland Pascal that cause runtime error 200 on systems with clock speeds of over 200MHz. http://mtech.dk/thomsen/program/pasbug.php This error occurs due to incorrect initialisation of the DELAY counter.ctbppat is also a universal EXE scanner, monitor, and patcher. It supports the usual EXE formats -- MZ for DOS; NE for OS/2, DPMI, and Windows 3.11; and PE for 32-bit environments -- and can detect the language with which the file was created. Running "bppatch *.* /s [/p]" will list all file formats in the current directory.If you use the switches /NE, http://www.vogons.org/viewtopic.php?t=93 /MZ, or /PE, ctbppat will be restricted to the respective EXE format. This will increase the speed with which it can analyse files. Running in pure DOS mode with SmartDrive (if possible) will also increase analysation speed.If ctbppat finds an executable made with Borland Pascal 7.0, it will examine the file further to determine if it uses an original or changed CRT unit, whether this unit is already patched, and whether the DELAY function is called at all. (If it is not, patching is unnecessary.)Depending on the result of this examination, ctbppat may offer to patch the file. If the DELAY function is used, it can be fixed by using a different delay routine that should function properly up to ~4GHz.To do this, the BREAK routine in the CRT unit is shortened and the delay code patched into the free space.If DELAY is not used, the divisor is simply increased to 65535. This will prevent DELAY from operating; however, this will ensure that the program is able to run (theorhetically) on a 300GHz CPU.If the CRT unit has been changed, but contains the same incorrect initialisation, ctbppat will modify the faulty divisor (255 => 1).ctbppat only analyses original CRT units -- routines with similar incorrect code in Tool Boxes remain unchanged. However, by running "ctbppat [filename.ext] /
the delay factor to the maximum possible value. Note: this program speaks only German, but English docs are included. http://pedrowa.weba.sk/docs/Delphi/Pascal/Fixes%2520for%2520Pascal%2520'Run%2520Time%2520Error%2520200'/download.html Note: This program is recommended by Borland. Use: if your program is program.exe , enter the command tppatchprogram.exe Warning: This patch will cause delay to run http://www.johndaileysoftware.com/support/knowledgebase/220-0001.asp too fast on computers that are significantly faster than Pentium II with about 233MHz. Some programs require correct timing, for those this patch may do more harm than error 200 help! Other programs should work fine with this. Technical details: A patched program will test if the computer is too fast. If no it proceeds with calculating the delay factor as usual. If yes the factor is instead set to the maximum possible value. Program makes room for the required additional code by rewriting two variable assignments runtime error 200 directly before the patched region with shorter code that is functionally equivalent. (If you don't see that it's equivalent after looking at the assembler code, note the registers that are used!). t7TplFix.zip patch program for Run Time Library file of Turbo Pascal 7.01 Program patches the file TURBO.TPL, the run time library file of Turbo Pascal version 7.01. Use: replace your file TURBO.TPL with the one generated by this program, then recompile your pascal sources. Technical Details: applies the same patches as in bp7patch (c't magazine), but uses the bugfixed Pascal version 7.01. No other files are changed, no other undocumented modifications are done to the CRT unit (unlike in the other distributed RTL files, see some of the other solutions below). NewDelay.pas unit with delay replacement and error trap (maybe newer version available here) This unit comes as pascal source. It contains two things: a new delay procedure that prevents the overrun by using a 32 bit delay factor instead of only 16 bit. a trap procedu
When attempting to run a program from within Windows or at the DOS prompt, the program crashes immediately and returns a runtime error #200. More Information/Solution: This is a problem for any program written in Borland (Inprise) Turbo Pascal that is ran on a very fast computer (i.e. Pentium based processor). The cause of this error is a timing loop that occurs as part of the initialization of the software. This timing loop counts how many clock ticks occur within the loop and then that number is divided by 55. The result of this division is a value that is too large to fit into an integer value. The 'Divide by 0' error message is the catch-all error that is displayed when this overflow occurs. To fix this problem, three options are currently available: Patch (fix) the affected software using a third-party application such as TPPatch (recommended), Run a third-party memory resident program such as TP7P5Fix that catches the bug as it happens in memory, or Run the affected software only on a slower machine (pre-Pentium processor) Two third-party patching methods are available in our download area, or you may download the recommended fix TPPATCH.ZIP directly. Instructions for the use of the product is included in the distribution archive. Related Articles: None Article ID:220-0001 Last Reviwed:06/01/2001 share-WEAR!Order your John Dailey Software t-shirt, cap, mug or mousepad online today. Contact John Dailey Software with suggestions, comments or questions. Copyright © 2001 John Dailey. All rights reserved. Legal notices and trademark attributions Site design and development by Scribblefish Media LLC