在 Windows 7 命令窗口中测试嵌入式 DOS 应用程序时强制屏幕大小
我正在使用 OpenWatcom(针对 16 位 DOS 应用程序的优秀 Windows 托管编译器)进行一些嵌入式 DOS 开发。目标硬件有一个 24x16 字符屏幕(据说在某种程度上模拟 CGA),我试图让 Windows 7 计算机上的 CMD.EXE 窗口保持在固定的 24x16 上,没有任何滚动条。
我已经使用了窗口属性和 MODE CON: COLS=24 LINES=16 来获取我想要的屏幕尺寸,但是一旦我的应用程序使用 INT10 BIOS 调用来清除屏幕,模式跳回 80x24。
这是我用来清除屏幕的方法:
void cls(void)
{
// Clear screen and reset cursor position to (0,0)
union REGS regs;
regs.w.cx = 0; // Upper left
regs.w.dx = 0x1018; // Lower right (of 16x24)
regs.h.bh = 7; // Blank lines attribute (white text on black)
regs.w.ax = 0x0600; // 06 = scroll up, AL=00 to clear
int86( 0x10, ®s, ®s );
}
有什么想法吗?我仍然可以在 80x24(或 80x25)下进行测试,但它的行为并不完全像 24x16 模式。
I'm doing some embedded DOS development with OpenWatcom (great Windows-hosted compiler for targeting 16-bit DOS applications). The target hardware has a 24x16 character screen (that supposedly emulates CGA to some degree), and I'm trying to get the CMD.EXE window on my Windows 7 machine to stay at a fixed 24x16 without any scroll bars.
I've used both the window properties and MODE CON: COLS=24 LINES=16
to get the screen size that I wanted, but as soon as my application uses an INT10 BIOS calls to clear the screen, the mode jumps back to 80x24.
Here's what I'm using to clear the screen:
void cls(void)
{
// Clear screen and reset cursor position to (0,0)
union REGS regs;
regs.w.cx = 0; // Upper left
regs.w.dx = 0x1018; // Lower right (of 16x24)
regs.h.bh = 7; // Blank lines attribute (white text on black)
regs.w.ax = 0x0600; // 06 = scroll up, AL=00 to clear
int86( 0x10, ®s, ®s );
}
Any ideas? I can still do my testing at 80x24 (or 80x25), but it doesn't entirely behave like the 24x16 mode.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道,调用 system() 并不优雅(见下文),但这是一种务实的可能性:
如果您不想使用 system(),您可以在调用中断 0x10 后使用 consoleHandle 将控制台窗口更改回来。以下是更改缓冲区大小和窗口尺寸的函数:
I know, calling system() is not elegant (see below), but this is a pragmatic possiblity:
If you dont want to use system() you can use the consoleHandle to change the console-window back after your call to interrupt 0x10. Here are the functions for changing the buffersize and Window-dimensions: