delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/08/00:45:39

From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Problem using int 0x10
Date: Tue, 7 Jul 1998 19:29:20 -0300
Organization: University of New Brunswick
Lines: 70
Message-ID: <Pine.SOL.3.96.980707191519.1851D-100000@sol.sun.csd.unb.ca>
NNTP-Posting-Host: sol-alt1.unb.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I tried to write some code to query an svga graphics card.  I've done this
in Borland C++ v3.1 (DOS) and it worked fine.  This just calls interrupt
0x10 with AX=0x4F00 and ES:DI pointing to a 256 byte buffer to hold the
data.  I used __tb for this, only nothing happens during the interrupt.  I
ran it through the debugger, and none of the values at __tb changed.  Am I
doing something wrong?
	The value returned in AX was 73??  And the info. I has clames that
if it is not 0x4F in AH, then the function is not supported, but I know
the function is supported, I have an ATI 3D Xpression+ card with VESA2
support AND I've tried it in a real-mode compiler on this exact system
configuration and it worked.  The code appears below.  If someone could
tell me what I'm doing wrong, or try compiling it on your machine and see
if it gives proper output, that'd be great.  The SIG should read "VESA",
if you have a VESA supporting card.
	I know that this program wouldn't print the correct version even
if it did work, I'll fix that when it works.

	Endlisnis
[I have a pyramid of wingyness]
---------------------------------------------------------------------
#include<iostream.h>
#include <dpmi.h>
#include <string.h>
#include <go32.h>

#define pack __attribute__((packed))

typedef unsigned char byte;
typedef unsigned short int word;
typedef unsigned int lword;

typedef unsigned short int pword pack;
typedef unsigned int plword pack;


struct VGAInfoBlock
{
 char Sig[4];
 pword Version;
 char *OEM pack;
 char Capabilities[4];
 short *VideoModes pack;
 pword VRAM;
 char Reserved[236];
 };

void GetInfoBlock(VGAInfoBlock &Fred)
{
 __dpmi_regs regs;

 memset(&regs, 0, sizeof regs);
 regs.x.ax = 0x4F00;
 regs.x.di = __tb & 0x0f;
 regs.x.es = (__tb >> 4) & 0xffff;
 __dpmi_int(0x10, &regs);
 memcpy(&Fred, (void*)__tb, sizeof(VGAInfoBlock));
 }

void main()
{
 VGAInfoBlock VGA;
 GetInfoBlock(VGA);
 cout << "Sig = \"" << VGA.Sig[0] << VGA.Sig[1] << VGA.Sig[2] 
      << VGA.Sig[3]
      << "\".\nVersion = " << VGA.Version
      << ".\nCapabilities = " << VGA.Capabilities[0] 
      << VGA.Capabilities[1]  << VGA.Capabilities[2] 
      << VGA.Capabilities[3]  << ".\nVRAM = " << VGA.VRAM;
 }

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019