Article View: comp.os.msdos.programmer
Article #206Re: # of Rows on screen
From: Ping Huang
Date: Tue, 04 Aug 1992 00:48
Date: Tue, 04 Aug 1992 00:48
76 lines
2429 bytes
2429 bytes
In article <eoq.9@vthnw.cvm.msu.edu> eoq@vthnw.cvm.msu.edu (Edward Quillen) writes:
> 1) Determining # of rows for the current console(ie. 25,43,50)
> 2) Switching to different modes
>
> I've looked at INT 10h (AH=11h) but had problems.
> A DOS solution would preferable to BIOS if one exists.
I don't think DOS documents a way to determine these numbers. I needed
to do this recently, and this is what I decided to use (notice the code
gives the highest priority to an end-user specified configuration value,
then to what the video BIOS tells it, then finally falls back to 80x25):
-------- cut here --------
int
pc_gestalt_screen_x_size (void)
{
char* psTemp;
psTemp = getenv("COLUMNS");
if (NULL == psTemp)
{
union REGS rIn;
union REGS rOut;
rIn.h.ah = 0x0F;
rIn.h.al = 0x00;
int86(0x10,&rIn,&rOut);
tty_x_size = rOut.h.ah;
}
else
{
tty_x_size = atoi(psTemp);
if (0 == tty_x_size)
tty_x_size = DEFAULT_TTY_X_SIZE; /* atoi failed, use default */
}
}
int
pc_gestalt_screen_y_size (void)
{
char* psTemp;
psTemp = getenv("LINES");
if (NULL == psTemp)
{
union REGS rIn;
union REGS rOut;
rIn.x.ax = 0x1130;
rIn.h.bh = 0x00;
rIn.h.dl = DEFAULT_TTY_Y_SIZE-1;
int86(0x10,&rIn,&rOut);
tty_y_size = rOut.h.dl + 1;
}
else
{
tty_y_size = atoi(psTemp);
if (0 == tty_y_size)
tty_y_size = DEFAULT_TTY_Y_SIZE; /* atoi failed, use default */
}
}
void bios__set_video_mode(int iModeNumber)
{
union REGS rIn;
union REGS rOut;
rIn.h.ah = 0x00;
rIn.h.al = iModeNumber;
int86(0x10,&rIn,&rOut);
}
--
| Ping Huang (INTERNET: pshuang@martigny.ai.mit.edu) speaking for himself.
| "One Thing to name them all, One Thing to define them,
| One Thing to place them in environments and bind them..."
Technical Details
Message-ID:
<PSHUANG.92Aug3204855@freeside.ai.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!olivea!mintaka.lcs.mit.edu!ai-lab!zurich.ai.mit.edu!pshuangReferences:
<eoq.9@vthnw.cvm.msu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!mintaka.lcs.mit.edu!ai-lab!zurich.ai.mit.edu!pshuang From: pshuang@zurich.ai.mit.edu (Ping Huang) Newsgroups: comp.os.msdos.programmer Subject: Re: # of Rows on screen Message-ID: <PSHUANG.92Aug3204855@freeside.ai.mit.edu> Date: 4 Aug 92 00:48:55 GMT References: <eoq.9@vthnw.cvm.msu.edu> Sender: news@ai.mit.edu Organization: M.I.T. Artificial Intelligence Lab. Lines: 76 In-reply-to: eoq@vthnw.cvm.msu.edu's message of 3 Aug 92 22:26:01 GMT