Why did Turbo Pascal apps fail with a division-by-zero on faster systems?
retrocomputing.stackexchange.com
retrocomputing.stackexchange.com
That was a trippy job, Borland supported the CP/M platform as well as MS-DOS and PC-DOS - That is where I got much of my experience on a wide scale of computers (DEC Rainbow, Eagle, Apricot, Heath, Apollo, Northstar, etc.).
And 8" floppy discs made the best frisbees... If we were really good at it, we could get them all the way over onto San Thomas Expressway from Wyatt Drive. Quite a few up on the roof, as I recall.
Thanks for the memories...
But yes, the discs as you would put into the computer made greate frisbee's, if you took them out of the protective jacket, they lacked the rigidness (least the ones I played with). I never did a test with a 8" and a 5.25" disc in the open, but from vauge memory recolation, the 8" discs could make about twice the distance.
My personal favorite was punched cards made into simple paper plane with bent over nose to allow it to be catapulted via elestic bands. Add a paper clip or two and they traveled very far and with great force that with two paper clips at 3 meters, you could go thru the side of a coke can. Never made one that made it all the way thru and you also needed somebody prepared to hold the coke can (though had no accidents - lucky). But was pretty dangerous. Though did recall a nice cut above the eye from a 5.25" frisbee net in the office as the corners of discs at speed are not conducive towards human flesh.
These days, none of these things happen as much as they used to on the grounds of HR and health and safety being more vigilant and prominent. Though 3.5" floppy discs proved safe, as any impact upon a hardish surface often saw the disc fall foul more than the target.
1. http://i.ebayimg.com/00/s/MzYxWDUwMA==/z/iEEAAOxy4YdTWJrr/$_...
A quick fix, with no software or patching needed, was to hit the return key and then the pause key at almost the same time after typing "program.exe". About 25% of the time, the pause would trigger an interrupt right in the delay calibration loop, and then pressing any key would resume the calibration loop with enough RTC time passing to avoid the division by zero.
Before working for Borland he ran his own company where he created PolyPascal which essentially was the product Borland acquired and turned into Turbo Pascal.
PolyPascal allowed me to write software in what felt like a proper programming language. I had previously learned to code using Basic and Comal 80 but they felt like toy languages compared to Pascal.
Sometimes I like to fire up some of the stuff I wrote back then or even just look over the code. Brings back memories of the thrill of getting some of those ideas working for the first time.
Probably the most complete project I did was a resource manager for Quake - it allowed you to export and import textures, sounds, vertex defs, etc.
Whether this should be public is another question altogether. Some of my code comments and readme files make me cringe today!
Fortunately these days everything is in version control and my editor doesn't clutter the current directory with backups anymore
Sure you want to delete /folder with 382 files? (Y/N)
This would at least give you a chance to spot that it was asking about the wrong file.
http://www.logicprobe.org/~octo/history-code.shtml
What's actually more amazing is thinking back to the time distortion of being a kid. Stuff that really only took place over the course of a year or two, feels like 5+ years in terms of my perceptual memory of the era.
Why not use the PC's timer interrupt for the delay function itself?
This bug was just laziness on Borland's part; there were no excuses for it. There were any number of ways to do it correctly. Fortunately they fixed it pretty quickly, too. While I remember running into it, it wasn't a huge issue.
The original Turbo Pascal ran on PCs of the day, running at 4.77MHz, and with 64 kilobytes of RAM.
Even if one foresaw computers running at 200MHz, I don’t think that, at the time, it was clear that a single architecture would stay around long enough for that to be a problem. The Pentium Pro peaked at 200MHz in 1995-8 or so, 12 to 15 years after the first release of Turbo Pascal (https://en.wikipedia.org/wiki/Pentium_Pro)
Earlier versions do not have this particular bug, it was introduced in version 7. However they have another bug which causes Delay to simply not work properly (it finishes quicker than requested) and most likely the changes in ver7 were made in an attempt to fix that one.
(Aside: all things staying the same, that should have increased the limit by a factor of 55. It seems the processor got more efficient running these idle loops by a factor of about five (about 2½ if there’s a sign bit in the result of the division)
So yes, you could call this a different bug. I don’t think having that bug in the code is inexcusable, though.
TP7 is from March 1993 (http://progopedia.com/version/turbo-pascal-7.0), and it seems the first 200Mhz PC CPU was from November 1995 (https://en.wikipedia.org/wiki/Timeline_of_computing_1990–199...)
⇒ I don’t think they could have found this in testing. So, is it inexcusable that this went through code review? I don’t think so. Not only would one have to realize that that new limit now came into play, one also would have realized the higher efficiency of the 200MHz processor(s) would bring the number down further.
That's really helped me on programming in say python and intuitively avoiding type fu.ck ups.
As another result of that experiment, I thought about giving Turbo Pascal a try next time I'm in DOSBox, just for nostalgia reasons. Hopefully the issue highlighted here wouldn't be too awful to deal with.
I had to TPPATCH it: http://www.ipnet6.org/tppatch.html
(In looking up the clock speeds since it's been that long, I also learned that some 386 chips had bodgy 32-bit multiply logic and were sold as "16 bit", and due to the weird way humans assign value, apparently these are now valuable collectibles! Source: https://en.wikipedia.org/wiki/Intel_80386#Early_problems)
If you were unlucky, underclocking was the only option to get the speed just right. Not fun in the era when clock speed was set with mainboard jumpers...
Of course there were also TSR [0] utilities to slow down old games.
I remember twiddling with all that to get some early XT era games working properly. Computers were getting faster so quickly that you'd literally see a new faster model for sale in as little as 1-2 months later. Slowing down things just right amount was an art form in the mid to late nineties.
[0]: TSR: https://en.wikipedia.org/wiki/Terminate_and_stay_resident_pr...
It was crazy. If you didn't buy a new CPU just about every year you were woefully behind.
The last two CPU generations I bought made it almost 5 years, and frankly there wasn't much difference from upgrading.
Because of that i always run any games that are more than 5-6 years old with a frame capping tool.
A software situation where Moores law plateau helps...
And what you’re saying is of course impossible.. determining if the function is called by static analysis is not possible.
If input = 1 then delay end is impossible to analyze statically.
If you meant reference to delay, that is a bit more tractable. But then when do you actually initialize, you will see that program initialization is about the only practical place to do it. Which is exactly what is done.