2022 Developer Survey is open! Take survey.
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 ...
user avatar
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 ...
user avatar
  • 16.4k
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.
user avatar
  • 17.1k
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 ...
user avatar
  • 32.2k
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 ...
user avatar
  • 166k
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, ...
user avatar
  • 17.1k
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 ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible