| ryandelaplante.com
[ Home | This BBS's History | What is a BBS? | HOW-TO's | BBS Related Links ]
#### <- Back to HOWTO's # Fixing Runtime Error 200 ### Problem Any BBS SysOp who runs door games will probably notice that some doors crash with "Runtime Error 200" immediately. All programs compiled with Turbo Pascal 7 that use the system unit CRT (almost all of them do) abort with the error message "Runtime Error 200" on faster PCs (e.g., a Pentium 166MHz and up). ### Cause The source of 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 in those that use the delay procedure. The CRT unit is included in most programs that are written in Turbo 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 a runtime error (Runtime Error 200 is a division by zero, which is caused by the overflow condition in this case). ### Solution 1 - Patch the EXE There are many patches availabe that can be applied to EXE's with the runtime error 200 problem. I've read on some websites that you might need different patches depending on your processor speed. I've tried the following patches on both a P166 and a PII 450 and they worked great. I have much faster computers but I'd rather not use them for my BBS. If you try these patches on a faster machine (800MHz, 2GHz, etc...) then please let me know if they work for you or not. I'm interested in knowing. Pentium 2 Delay Bug Fixer - download here TPPatch - download here Some EXE's might be compressed. You can try using UNP executable file expander on the EXE if the patch program complains about the file being compressed. UNP can uncompresses files compressed with DIET, EXEPACK, LZEXE, PKLITE and many other file compression utilities. ### Solution 2 - Run a TSR A fellow SysOp on FidoNet referred me to a program called TP7P5FIX. It's a TSR that runs in memory whenever the computer boots.. well no, more specifically whenever a DOS window is loaded. On NT you have files called autoexec.nt and config.nt in your C:\WINNT\SYSTEM32\ folder. I added a line to the end of my autoexec.nt with this simple one line command: tp7p5fix The TSR loads and now any Turbo Pascal program that has the runtime error 200 will be automatically fixed at runtime in memory and the original EXE will never be touched. One door in particular that required this TSR to run was EZ-ROM. I patched all my other EXE's but EZ-ROM still wouldn't work after trying several different patches. This TSR made EZ-ROM work great. #### <- Back to HOWTO's Last updated January 22 2004

Website design by Ryan de Laplante