Force screen size when testing embedded DOS app in Windows 7 command window

Posted by tomlogic on Stack Overflow See other posts from Stack Overflow or by tomlogic
Published on 2011-01-10T23:37:01Z Indexed on 2011/01/10 23:53 UTC
Read the original article Hit count: 165

Filed under:
|
|

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, &regs, &regs ); 
}

Any ideas? I can still do my testing at 80x24 (or 80x25), but it doesn't entirely behave like the 24x16 mode.

© Stack Overflow or respective owner

Related posts about c

    Related posts about embedded