Fix "Error 200" (Divide by zero) - by Snover and Stiletto (updated!)

Files, FAQs, and other things to help you get your games running before you start asking questions.

Fix "Error 200" (Divide by zero) - by Snover and Stiletto, with thanks to edelbeb

Postby 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. 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, /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] /brute", one can force the program to search for the incorrect code but WITHOUT further analysis (which prevents error checking and will then allow the faulty code to be changed). ctbppat will then allow you to patch the code with the new divisor (the default is 255, but by using the "/BRUTE=XXXX" switch, where XXXX is the divisor in HEX, you can enter your own divisor). When a file is patched, a new file (ex$) is created and the original EXE will then be overwritten (if desired).

*** BE SURE TO MAKE BACKUPS OF ALL FILES YOU ARE GOING TO PATCH! ***

Although the patch software proceeds quite carefully, a warranty for perfect functionality cannot be given. Some programs use OVERLAY operations (OVR files), with which patched programs may not work correctly.

All output is in an "international language" in order to make the program somewhat simpler for foreigners.

As a goodie, ctbppat also contains a small file monitor that can dump or disassemble the file content or display the entries and segment lists of the EXE headers (MZ/PE/NE). The disassembler displays file addresses and assigned logical addresses. It supports MMX and 3DNow!.

TO RUN: "ctbppat [filename.ext] /mon"

PROGRAMMERS!
The file ftp://ftp.heise.de/pub/ct/ctsi/bppatch.zip contains a modified version of the CRT unit, which should be good for clock speeds up to 300GHz.

Enjoy!
Andreas Stiller
as@ct.heise.de


Englishized by: COLIN SNOVER

For more information on this and other Borland Pascal 7.0 patches, please visit <http://www.merlyn.demon.co.uk/pas-r200.htm>.
Attachments
ctbppat.zip
(48.41 KiB) Downloaded 3400 times
Last edited by Snover on 2002-9-13 @ 00:22, edited 1 time in total.
Snover
l33t++
 
Posts: 5207
Joined: 2002-6-30 @ 04:47

Re: Fix "Error 200" (Divide by zero) - by Snover and Stiletto (updated!)

Postby eL_PuSHeR » 2005-4-13 @ 20:13

I hope Snover won't get angry at me for reopening his post...

Anyway, I would like to make a minor update.

Here are the two apps I use for patching EXE files that are plagued with the infamous Runtime Error 200 (divide by zero).
Attachments
TPPATCH.ZIP
For Borland's Pascal/Turbo Pascal EXEs
(9.4 KiB) Downloaded 3200 times
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
8 GB GeForce GTX 1070 G1 Gaming (Gigabyte)
User avatar
eL_PuSHeR
Moderator
 
Posts: 6444
Joined: 2003-6-20 @ 16:39

Re: Fix "Error 200" (Divide by zero) - by Snover and Stiletto (updated!)

Postby eL_PuSHeR » 2005-4-13 @ 20:14

And this one is for C/C++
Attachments
MPATCH2.ZIP
Fixes Runtime Error 200 for C/C++ EXEs
(29.19 KiB) Downloaded 2598 times
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
8 GB GeForce GTX 1070 G1 Gaming (Gigabyte)
User avatar
eL_PuSHeR
Moderator
 
Posts: 6444
Joined: 2003-6-20 @ 16:39


Return to Deep Thought

Who is online

Users browsing this forum: No registered users and 1 guest