136
votes
Accepted
Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?
Turbo Pascal programs start by calibrating a delay loop (so that the Delay function knows how much to spin to achieve a certain delay). The calibration counts the number of times a certain loop is run ...
39
votes
How can I play QBasic Nibbles on a modern machine?
The problem is simple. At initialisation, Nibbles measures the time it takes to perform 1000 empty iterations of a FOR loop with a DOUBLE counter in order to determine how many such iterations are ...
35
votes
How can I play QBasic Nibbles on a modern machine?
DOSBox, with the default CPU speed of 3000 cycles on this Linux box, runs nibbles.bas without problems.
6
votes
Delay loop in BASIC
40 for t=t0+t*60 to t
... will repeat at least once and then for as long as t0+t*60 (i.e. start time + duration) does not equal t.
So this:
captures t0+t*60 (the desired end time) such that t can be ...
5
votes
Accepted
Delay loop in BASIC
TL;DR:
FOR T=<target value> TO T uses T as a temporary variable to store the target value inside the FOR stack frame, where it is used later to compare with the actual value of T after an ...
2
votes
Delay loop in BASIC
Commodore BASIC has a quirk that it will run a FOR loop at least once. This is what allows your t variable to update at least once, allowing the loop to be valid.
Raffzahn's explained how it works, ...
1
vote
How can I play QBasic Nibbles on a modern machine?
On the modern CPU the FOR loop executes so quickly that the difference in the TIMER before and after is zero. Hence the line:
speed = speed * .5 / (stopTime# - startTime#)
gives a divide by zero ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
delay-loop × 3basic × 2
commodore-64 × 1
ms-dos × 1
ibm-pc × 1
gaming × 1
bugs × 1
pascal × 1
borland × 1