home *** CD-ROM | disk | FTP | other *** search
- /*
- pctextin.c
-
- % PC text info routines
-
- 5/16/88 by Ted.
-
- OWL 1.1
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 1/18/89 Ted Made mode 3 detect # of rows & cols if current mode.
- 2/25/89 ted Made mode 3 ignore the bios # of rows if it's not supported.
- 6/28/89 ted removed dispid and changed mmwidth/height to x/ypixperm
- 8/22/89 ted Added fontdesc_struct elements to def_font initialization.
- */
-
- #include "pcpriv.h"
- /* -------------------------------------------------------------------------- */
-
- static dispinfo_struct textinfo = {
- {0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0}, /* devname */
- 0x07, /* mode */
- 0, 0, /* xpixperm, ypixperm */
- &pcdatastruc.dmspace, /* dispmap */
- VID_MONOADDR, /* dispaddr */
- 160, /* bytewidth */
- 0, /* ileave */
- 0, /* ilsize */
- 1, /* nplanes */
- 16, /* pixbits */
-
- 2L, /* ncolors */
- DTYPE_MONOCHROME, /* colortype */
- NULL, /* defcolmap */
-
- TRUE, /* hardcursor */
- BO_LSBYTFIRST, /* byteorder */
- { /* def_font */
- 0, /* fontid */
- { 1, 1, 0, 0,0,0, 0 }, /* real: width, height, style, etc. */
- { 1, 1, 0, 0,0,0, 0 } /* req: width, height, style, etc. */
- }
- };
- /* -------------------------------------------------------------------------- */
-
- boolean DIGPRIV text_setinfo(mode)
- int mode;
- {
- byte rows, cols;
-
- /* Set up the device info structure */
- memmove(&pcdata->info, &textinfo, sizeof(dispinfo_struct));
- pc_initdispmap(80, 25);
-
- pcdata->info.mode = mode;
- /* Pre-set default values */
- pchdata->xmouscale = 8;
- pchdata->ymouscale = 8;
- cols = 80;
- rows = 25;
-
- if (mode == 0x07) {
- pcdata->info.dispaddr = VID_MONOADDR;
- pcdata->info.colortype = DTYPE_MONOCHROME;
- pcdata->info.ncolors = 2;
-
- strncpy(pcdata->info.devname, "IBM PC MDA TEXT", DEVNAMELEN-1);
- }
- else {
- pcdata->info.dispaddr = VID_CGAADDR;
- pcdata->info.colortype = DTYPE_MAPCOLOR;
- pcdata->info.ncolors = 16;
-
- switch (mode) {
- case 0x00:
- case 0x01:
- pchdata->xmouscale = 16;
- cols = 40;
- strncpy(pcdata->info.devname, "IBM PC 40 COL TEXT", DEVNAMELEN-1);
- break;
- case PCMODE_EGA43:
- rows = 43;
- strncpy(pcdata->info.devname, "IBM PC EGA 43 LINE", DEVNAMELEN-1);
- break;
- case PCMODE_VGA50:
- rows = 50;
- strncpy(pcdata->info.devname, "IBM PC VGA 50 LINE", DEVNAMELEN-1);
- break;
- default:
- strncpy(pcdata->info.devname, "IBM PC CGA TEXT", DEVNAMELEN-1);
- }
- }
- pcdata->info.devname[DEVNAMELEN-1] = '\0';
-
- /* If staying in mode, override with width & height from BIOS data area */
- if (mode == pcdata->oldmode) {
- ram_segtomem(0x40, 0x84, &cols, 1); /* Get Rows from BIOS data area */
- cols++;
- /* using cols as a temp. variable to preserve rows for now */
- /* Old PC's and some clones don't support the rows var in the BIOS, */
- /* so we only use it if it's a plausible number */
- if (cols > 25) rows = cols;
-
- ram_segtomem(0x40, 0x4A, &cols, 1); /* Get Cols from BIOS data area */
- }
- pcdata->info.bytewidth = 2 * cols;
- pcdata->info.dispmap->width = cols;
- pcdata->info.dispmap->height = rows;
-
- pcdata->fontlines = (mode == 0x07) ? 14 : 8;
-
- return(TRUE);
- }
- /* -------------------------------------------------------------------------- */
-
- boolean pc_GetRetrace()
- {
- return(pc_retrace());
- }
- /* -------------------------------------------------------------------------- */
-