1 /****************************************************************************
3 * SciTech OS Portability Manager Library
5 * ========================================================================
7 * The contents of this file are subject to the SciTech MGL Public
8 * License Version 1.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of
10 * the License at http://www.scitechsoft.com/mgl-license.txt
12 * Software distributed under the License is distributed on an
13 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * rights and limitations under the License.
17 * The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
19 * The Initial Developer of the Original Code is SciTech Software, Inc.
20 * All Rights Reserved.
22 * ========================================================================
27 * Description: Test program to check the ability to manipulate the
28 * BIOS data area from protected mode using the PM
29 * library. Compile and link with the appropriate command
30 * line for your DOS extender.
32 * Functions tested: PM_getBIOSSelector()
37 ****************************************************************************/
43 /* Macros to obtain values from the BIOS data area */
45 #define TICKS() PM_getLong(bios+0x6C)
46 #define KB_STAT PM_getByte(bios+0x17)
47 #define KB_HEAD PM_getWord(bios+0x1A)
48 #define KB_TAIL PM_getWord(bios+0x1C)
50 /* Macros for working with the keyboard buffer */
52 #define KB_HIT() (KB_HEAD != KB_TAIL)
53 #define CTRL() (KB_STAT & 4)
54 #define SHIFT() (KB_STAT & 2)
57 /* Selector for BIOS data area */
65 printf("Program running in ");
66 switch (PM_getModeType()) {
68 printf("real mode.\n\n");
71 printf("16 bit protected mode.\n\n");
74 printf("32 bit protected mode.\n\n");
78 bios = PM_getBIOSPointer();
79 printf("Hit any key to test, Ctrl-Shift-Esc to quit\n");
83 if (c == 0) PM_getch();
84 printf("TIME=%-8lX ST=%02X CHAR=%02X ", TICKS(), KB_STAT, c);
86 if ((c == ESC) && SHIFT() && CTRL())/* Ctrl-Shift-Esc */