delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/29/09:01:38

Xref: news2.mv.net comp.os.msdos.djgpp:6529 rec.games.programmer:57528
From: antoine AT stack DOT urc DOT tue DOT nl (Antoine van Wel)
Newsgroups: rec.games.programmer,comp.os.msdos.djgpp
Subject: retrieving VESA mode list
Date: 29 Jul 1996 13:40:34 +0200
Organization: MCGV Stack, Eindhoven University of Technology, the Netherlands.
Lines: 77
Message-ID: <4ti7vj$oq0@toad.stack.urc.tue.nl>
NNTP-Posting-Host: toad.stack.urc.tue.nl
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello ! I got a problem with getting the VESA mode list. If anyone
knows what goes wrong, please let me know. This problem has been
bugging me for a long while now. I cannot retrieve the info from 
the list; this info can be reached via a pointer. I have tried 
different solutions; all of them didn't work. Two of them are in
this listing. 

I'd also like to know how I can put "VBE2" in the header before
calling the interrupt... All this __tb business :-\

// Antoine

----------------------- THE LISTING ! ----------------------

// Based on Sandmann's "VBETEST.C"
// Show Mode List : compile with DJGPP
// Programmed by Antoine van Wel,
//  IRC: ProphecY, EMAIL: antoine AT stack DOT urc DOT tue DOT nl

#include <pc.h>
#include <dpmi.h>
#include <go32.h>
#include <dos.h>
#include <crt0.h>
#include <sys/farptr.h>

#define BYTE unsigned char
#define INT __dpmi_int
#define REGS __dpmi_regs

typedef struct {
  char Signature [4];
  short Version;
  unsigned OemStringPtr;
  BYTE Capabilities [4];
//  short VideoModePtrSeg;
//  short VideoModePtrOff;
  unsigned VideoModePtr;
  short TotalMemory;
  char bogus [236];
} VBEInfoBlock;

int main (void)
{
  VBEInfoBlock VBEInfo;
  REGS reg;
  int i;
  short *p;

  reg.x.ax = 0x4f00;
  reg.x.es = __tb / 16;
  reg.x.di = 0;
  INT (0x10, &reg);

  if (reg.x.ax != 0x004f) {
    printf ("Get VBE info failed.\n");
    exit (1);
  }

  dosmemget (__tb, sizeof(VBEInfoBlock), &VBEInfo);

  for (i=0; i<4; i++) printf("%c",VBEInfo.Signature[i]);
  printf("\n");

//  p = (short *)(16*VBEInfo.VideoModePtrSeg+VBEInfo.VideoModePtrOff);
  p = (short *)VBEInfo.VideoModePtr;

  do {
    printf("0x%x\n",*p);
    p++;
  } while (*p!=-1);

  return 0;
}
-- 
They say what is lost will never be found again ...
Antoine van Wel -- IRC: ProphecY, EMAIL: antoine AT stack DOT urc DOT tue DOT nl

- Raw text -


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