home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
s
/
snip1292.zip
/
SCRNSIZE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-12-26
|
686b
|
41 lines
/*
** Get screen size (by Bob Jarvis)
*/
#include <dos.h>
#ifndef __TURBOC__
#define far _far
#endif
#ifndef MK_FP
#define MK_FP(seg,offset) \
((void far *)(((unsigned long)(seg)<<16) | (unsigned)(offset)))
#endif
int get_screen_rows(void)
{
char far *bios_crt_rows_ptr = MK_FP(0x0040, 0x0084);
return(1 + *bios_crt_rows_ptr);
}
int get_screen_cols(void)
{
int far *bios_crt_cols_ptr = MK_FP(0x0040, 0x004A);
return(*bios_crt_cols_ptr);
}
#ifdef TEST
#include <stdio.h>
void main(void)
{
printf("rows = %d cols = %d\n",
get_screen_rows(), get_screen_cols());
}
#endif