VOGONS

Common searches


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

Topic actions

  • This topic is locked. You cannot reply or edit posts.

First post, by Snover

User metadata
Rank l33t++
Rank
l33t++

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] […]
Show full quote

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

  • Filename
    ctbppat.zip
    File size
    48.41 KiB
    Downloads
    4389 downloads
    File license
    Fair use/fair dealing exception
Last edited by Snover on 2002-09-13, 00:22. Edited 1 time in total.

Yes, it’s my fault.

Reply 1 of 2, by eL_PuSHeR

User metadata
Rank l33t++
Rank
l33t++

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

  • Filename
    TPPATCH.ZIP
    File size
    9.4 KiB
    Downloads
    4118 downloads
    File comment
    For Borland's Pascal/Turbo Pascal EXEs
    File license
    Fair use/fair dealing exception

Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
8 GB GeForce GTX 1070 G1 Gaming (Gigabyte)

Reply 2 of 2, by eL_PuSHeR

User metadata
Rank l33t++
Rank
l33t++

And this one is for C/C++

Attachments

  • Filename
    MPATCH2.ZIP
    File size
    29.19 KiB
    Downloads
    3406 downloads
    File comment
    Fixes Runtime Error 200 for C/C++ EXEs
    File license
    Fair use/fair dealing exception

Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
8 GB GeForce GTX 1070 G1 Gaming (Gigabyte)