home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name scmode -- Return the screen video mode
- *
- * Synopsis adapter = scmode(pmode,pcolumns,papage);
- *
- * int adapter Returned adapter status.
- * 1 is returned for the Color/Graphics
- * Adapter (or if the Enhanced Graphics
- * Adapter or the Professional Graphics
- * Controller is emulating the CGA),
- * or 0 for the Monochrome Adapter (or if
- * the Enhanced Graphics Adapter is
- * emulating the Monochrome Adapter).
- * int *pmode Returned screen mode.
- * int *pcolumns Returned number of columns on screen.
- * int *papage Returned active page.
- *
- * Description SCMODE returns the current video setting of the screen
- * display. The functional value indicates which adapter
- * is used. The integer pointers are used to store values
- * describing the screen.
- *
- * See the list of possible modes in SCNEWDEV.C.
- *
- * This function also sets the global variable b_device
- * (declared in BSCREEN.H) to COLOR (1) or MONO (0)
- * depending on which device is in use.
- *
- * Returns adapter Adapter used
- * b_device Adapter used
- * *pmode Screen mode
- * *pcolumns Number of columns on screen
- * *papage Active display page
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1983, 1984, 1986
- *
- * Version 3.02 March 24, 1987
- * Changed to ignore bit 7 of mode (which is set on EGA
- * when resetting the mode without clearing the screen).
- *
- **/
-
- #include <bscreen.h>
-
- #define VIDEO_FIELD 0x0030 /* The bits to be examined in */
- /* the BIOS equipment flag. */
- #define MONO_FLAG 0x0030
- #define COLOR_80 0x0020
- #define COLOR_40 0x0010
-
- int scmode(pmode,pcolumns,papage)
- int *pmode,*pcolumns,*papage;
- {
- int ax,bx,cx,dx,flags; /* Registers for BIOS call */
-
- ax = utbyword(15,0);
- bios(16,&ax,&bx,&cx,&dx,&flags);
- *pmode = (ax & 0x7f); /* Discard bit 7 (sign bit) of */
- /* mode. */
- *pcolumns = uthibyte(ax);
- *papage = uthibyte(bx);
-
- bios(17,&ax,&bx,&cx,&dx,&flags); /* Equipment setting determines */
- /* which adapter is used. */
-
- switch (ax & VIDEO_FIELD)
- {
- case MONO_FLAG:
- b_device = MONO;
- break;
- case COLOR_80:
- case COLOR_40:
- default: /* Impossible bit settings. */
- b_device = COLOR;
- break;
- }
-
- return b_device;
- }