Mail Archives: djgpp/1997/01/06/05:50:35
From: | johne AT parallax DOT co DOT uk (John Eccleston)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Displaying the VESA OEM string
|
Date: | Mon, 06 Jan 97 09:25:44 GMT
|
Organization: | Parallax Solutions Ltd
|
Lines: | 105
|
Message-ID: | <5aqgd9$h4i@red.parallax.co.uk>
|
NNTP-Posting-Host: | parsnip.parallax.co.uk
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi All,
First let me apologise if what I am asking is in the FAQ, I
have looked (honest) but either I am blind or stupid!
I am trying to display the OEM string for the VESA graphics card
in my system. However this always causes the program to
access violate. Could someone please point me in the right
direction. By looking at the FAQ I think I need to use the
_farpeekb (etc) functions but how do I convert the pointer given
in the VESA info structure to the required (segment*16 + offset)
value.
The program is given below and it gives the following error
Exiting due to signal SIGSEGV
General Protection Fault at eip=0000535e
Thanks in advance
John
------> Cut here <-----------
#include <stdio.h>
#include <dpmi.h>
#include <go32.h>
#include <assert.h>
#include <string.h>
#define PACKED __attribute__ ((packed))
#pragma pack(1)
/*
* The following structure is used to retrieve information
* about the VESA capabilities of a systems graphics card
*/
typedef struct VBEInfo
{
char VESASignature[4] PACKED; /* 'VESA' 4 byte signature */
short VESAVersion PACKED; /* VBE version number */
char *OEMStringPtr PACKED; /* Pointer to OEM string */
long Capabilities PACKED; /* Capabilities of video card */
short *VideoModePtr PACKED; /* Pointer to supported modes */
short TotalMemory PACKED; /* Number of 64kb memory blocks */
char reserved[236] PACKED; /* Pad to 256 byte block size */
} VBEInfo;
#define VBE_MajorVersion(x) (((x) >> 8) & 0xFF)
#define VBE_MinorVersion(x) ((x) & 0xFF)
#pragma pack()
int VBE_detect(VBEInfo *vbeinfo)
{
__dpmi_regs
regs;
regs.x.ax = 0x4F00;
regs.x.di = __tb & 0x0F;
regs.x.es = (__tb >> 4) & 0xFFFF;
memset(vbeinfo, 0, sizeof(VBEInfo));
__dpmi_int(0x10, ®s);
dosmemget(__tb, sizeof(VBEInfo), vbeinfo);
if (strncmp(vbeinfo->VESASignature, "VESA", 4) != 0)
{
return 0;
}
else
{
return vbeinfo->VESAVersion;
}
}
main()
{
VBEInfo vesaInfo;
if (VBE_detect(&vesaInfo))
{
printf("VESA compliant video card found\n");
printf("\tVersion : %d.%d\n",
VBE_MajorVersion(vesaInfo.VESAVersion),
VBE_MinorVersion(vesaInfo.VESAVersion));
printf("\tVideo memory : %d K Bytes\n", vesaInfo.TotalMemory * 64);
printf("Manufacturer : %s\n", vesaInfo.OEMStringPtr);
}
else
{
printf("No VESA support!\n");
}
}
------> Cut here <-----------
________________________________________________________________
Parallax Solutions Ltd. Tel.: 01203 514522
Stonecourt, Fax.: 01203 514401
Siskin Drive, Web : http://www.parallax.co.uk/~johne
Coventry CV3 4FJ Mail: johne AT parallax DOT co DOT uk
________________________________________________________________
Good manners cost nothing, bad manners can cost you everything
________________________________________________________________
- Raw text -