cpmturbo-pascal

Terminate hanging program and return to Turbo Pascal 3


I am running Turbo Pascal 3.01A on CP/M 2.2. Suppose my Pascal program, which I run using the R menu option in Turbo Pascal, has a bug and goes into an infinite loop. Is there a special control character that will interrupt my program and return to the Turbo Pascal menu?


Solution

  • The {U+} directive will cause the compiled code to check after each statement whether a key has been hit. If so, the keystroke will be checked for ^C; if not ^C the keystroke will be discarded. While this usefully allows the program to be aborted, it slows things down and also rather annoyingly kills type-ahead ability. Unfortunately, CP/M doesn't provide any sort of keyboard interrupts (though some CP/M implementations might provide one) so there's not really any better alternative. It would be nice if Turbo Pascal had an option to implement its own keyboard buffering, but I don't know of any.