Runtime error 200

Runtime error 200 is a standard error message from Borland Pascal programs, standing for Division by zero. Many older computer programs for the MS-DOS operating system fail immediately on loading with this error message. In many cases, they were compiled with an older version of the Borland or Turbo Pascal compiler, which often generated programs that failed if executed on computers with processors faster than about 200 MHz.

Reason

Borland and Turbo Pascal's standard libraries included a procedure called delay(n) (in unit CRT) that halts the execution of the program for a given number of milliseconds. To be able to use this function, every program that includes CRT performs initialization on startup. The problem lies in the internal workings of the initialization routine: the code measures the running time of a busy wait loop and calculates how many times it must be called to have the correct amount of delay. The problem arises when the computer is so fast that the number of loop iterations corresponding to a 1 millisecond delay no longer fits in a 16-bit integer, resulting in an overflow on an integer division operation where the destination register is 16-bit. This overflow gets detected and reported the same as a division by zero would be, hence Runtime error 200.

Solutions

Such programs can be patched to operate correctly, or a Terminate and stay resident (TSR) program can be loaded before running the program in question. See the article on Turbo Pascal.

Various solutions are also discussed in an merlyn.demon.co.uk article by J. R. Stockton.

References

    External links