Hacker News new | ask | show | jobs
by LorenPechtel 22 days ago
Turbo Pascal, the CRT module upon initialization ran a loop for one clock tick in order to find out how many times it had to spin the loop to produce 1 millisecond of delay. At about 200 Mhz CPU speed this got too big and caused a divide underflow error which got reported at a division by zero. Solutions were not using the CRT module, editing the binary code in the module (which would either clobber or miscalibrate the whole Delay calculation--since you were limited to overwriting existing bytes there wasn't space to fix it properly), or monkey patching by means of a module that loaded earlier in the chain (which was not limited to being no bigger than the original and thus could allow Delay to function correctly.)
1 comments

Ah yes, now you mention it something like this does ring a bell. I don't think I ever hit it though!