终止挂起程序并返回 Turbo Pascal 3

发布于 2024-08-29 21:05:43 字数 134 浏览 5 评论 0原文

我在 CP/M 2.2 上运行 Turbo Pascal 3.01A。假设我使用 Turbo Pascal 中的 R 菜单选项运行的 Pascal 程序有一个错误并进入无限循环。是否有特殊的控制字符可以中断我的程序并返回 Turbo Pascal 菜单?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

雨轻弹 2024-09-05 21:05:43

{U+} 指令将导致编译后的代码在每个语句后检查是否按下了某个键。如果是,则将检查击键是否为 ^C;如果不是^C,则击键将被丢弃。虽然这可以有效地允许程序中止,但它会减慢速度,并且还会相当烦人地杀死提前输入的能力。不幸的是,CP/M 不提供任何类型的键盘中断(尽管某些 CP/M 实现可能提供),因此实际上没有更好的选择。如果 Turbo Pascal 可以选择实现自己的键盘缓冲,那就太好了,但我不知道有什么。

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.

意中人 2024-09-05 21:05:43

Turbo Pascal 3 程序的开头(在 Program 语句下)是编译器指令 {$U+}。这应该允许您执行 CTRL + C。始终仅在调试程序时使用此选项,因为它会降低程序的执行速度。如果运行正常,请将其删除,然后编译您的程序。

通常在 Turbo Pascal 3 中,编译器有一组默认编译器指令。默认情况下,“U - 用户中断”通常处于关闭状态。

我最近在 Turbo Pascal 程序中发现的另一件事是,我在调试程序时使用了它,但由于某种原因它无法工作。不知道发生了什么,发现我真的必须按住这个组合键才能退出程序。不确定这是否与程序的执行速度有关,或者是否是使用嵌套循环导致了这种情况的发生。

At the start of your Turbo Pascal 3 program (under the Program statement) is Compiler Directive {$U+}. This should allow you to do a CTRL + C. Always use this only while you're debugging your program as it slows down the execution speed of your program. If it runs okay, remove it and then compile your program.

Typically in Turbo Pascal 3 the compiler has a set of Default Compiler Directives. The "U - User Interrupt" is typically off by default.

The other thing I found in my Turbo Pascal program just recently was I was using this while debugging my program and for some reason it wasn't working. Not sure what was going on there and found I really had to hold down this combination to get the program to exit. Unsure if it had something to do with the execution speed of the program or if it was the use of a nested loop which led to this occurring.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文