drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / payloads / libpayload / curses / PDCurses / dos / pdcgetsc.c
blob290db5a3c71ee4347e87cf7d3bc125ef8175bdd9
1 /* Public Domain Curses */
3 #include "pdcdos.h"
5 RCSID("$Id: pdcgetsc.c,v 1.42 2008/07/13 16:08:17 wmcbrine Exp $")
7 #include <stdlib.h>
9 /* return width of screen/viewport */
11 int PDC_get_columns(void)
13 PDCREGS regs;
14 int cols;
15 const char *env_cols;
17 PDC_LOG(("PDC_get_columns() - called\n"));
19 /* use the value from COLS environment variable, if set. MH 10-Jun-92 */
20 /* and use the minimum of COLS and return from int10h MH 18-Jun-92 */
22 regs.h.ah = 0x0f;
23 PDCINT(0x10, regs);
24 cols = (int)regs.h.ah;
26 env_cols = getenv("COLS");
28 if (env_cols)
29 cols = min(atoi(env_cols), cols);
31 PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols));
33 return cols;
36 /* get the cursor size/shape */
38 int PDC_get_cursor_mode(void)
40 PDC_LOG(("PDC_get_cursor_mode() - called\n"));
42 return getdosmemword(0x460);
45 /* return number of screen rows */
47 int PDC_get_rows(void)
49 const char *env_rows;
50 int rows;
52 PDC_LOG(("PDC_get_rows() - called\n"));
54 /* use the value from LINES environment variable, if set. MH 10-Jun-92 */
55 /* and use the minimum of LINES and *ROWS. MH 18-Jun-92 */
57 rows = getdosmembyte(0x484) + 1;
58 env_rows = getenv("LINES");
60 if (env_rows)
61 rows = min(atoi(env_rows), rows);
63 if (rows == 1 && pdc_adapter == _MDS_GENIUS)
64 rows = 66;
65 if (rows == 1 && pdc_adapter == _MDA)
66 rows = 25;
68 if (rows == 1)
70 rows = 25;
71 pdc_direct_video = FALSE;
74 switch (pdc_adapter)
76 case _EGACOLOR:
77 case _EGAMONO:
78 switch (rows)
80 case 25:
81 case 43:
82 break;
83 default:
84 rows = 25;
86 break;
88 case _VGACOLOR:
89 case _VGAMONO:
90 break;
92 default:
93 rows = 25;
94 break;
97 PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows));
99 return rows;