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 allocate real mode
28 * memory and to call real mode interrupt handlers such as
29 * the VESA VBE BIOS from protected mode. Compile and link
30 * with the appropriate command line for your DOS extender.
32 * Functions tested: PM_getVESABuf()
36 ****************************************************************************/
43 /* SuperVGA information block */
48 char VESASignature[4]; /* 'VESA' 4 byte signature */
49 short VESAVersion; /* VBE version number */
50 ulong OEMStringPtr; /* Far pointer to OEM string */
51 ulong Capabilities; /* Capabilities of video card */
52 ulong VideoModePtr; /* Far pointer to supported modes */
53 short TotalMemory; /* Number of 64kb memory blocks */
54 char reserved[236]; /* Pad to 256 byte block size */
67 unsigned r_vgseg,r_vgoff;
69 printf("Program running in ");
70 switch (PM_getModeType()) {
72 printf("real mode.\n\n");
75 printf("16 bit protected mode.\n\n");
78 printf("32 bit protected mode.\n\n");
82 /* Allocate a 256 byte block of real memory for communicating with
85 if ((vgPtr = PM_getVESABuf(&vgLen,&r_vgseg,&r_vgoff)) == NULL) {
86 printf("Unable to allocate VESA memory buffer!\n");
90 /* Call the VESA VBE to see if it is out there */
94 memcpy(vgPtr,"VBE2",4);
95 PM_int86x(0x10, ®s, ®s, &sregs);
96 memcpy(&vgaInfo,vgPtr,sizeof(VgaInfoBlock));
97 if (regs.x.ax == 0x4F && strncmp(vgaInfo.VESASignature,"VESA",4) == 0) {
98 printf("VESA VBE version %d.%d BIOS detected\n\n",
99 vgaInfo.VESAVersion >> 8, vgaInfo.VESAVersion & 0xF);
100 printf("Available video modes:\n");
101 mode = PM_mapRealPointer(vgaInfo.VideoModePtr >> 16, vgaInfo.VideoModePtr & 0xFFFF);
102 while (*mode != 0xFFFF) {
103 printf(" %04hXh (%08X)\n", *mode, (int)mode);
108 printf("VESA VBE not found\n");