www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/01/08:31:43

Xref: news2.mv.net comp.os.msdos.djgpp:6663 rec.games.programmer:57810
From: alaric AT abwillms DOT demon DOT co DOT uk (Alaric B. Williams)
Newsgroups: rec.games.programmer,comp.os.msdos.djgpp
Subject: Re: retrieving VESA mode list
Date: Tue, 30 Jul 1996 17:12:03 GMT
Lines: 96
Message-ID: <838746613.16082.10@abwillms.demon.co.uk>
References: <4ti7vj$oq0 AT toad DOT stack DOT urc DOT tue DOT nl>
NNTP-Posting-Host: abwillms.demon.co.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

antoine AT stack DOT urc DOT tue DOT nl (Antoine van Wel) wrote:

>// 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;
>}

Muhahah! You're correctly grabbing the struct from DOS memory, but
don't forget that those pointers point into DOS memory as well!

Use the PtrSeg and PtrOfs variation of the struct, and:

int p = 16*VBEInfo.VideoModePtrSeg+VBEInfo.VideoModePtrOff;

short int temp;

do {
   dosmemget(p,2,&temp);
   if(temp != -1) printf("0x%x\n",temp);
   temp += 2;
} while (temp!=-1)


Untested, of course, purely from the top of my head... but I'm sure
you get the idea.

Regards,


ABW
--
I have become... Comfortably numb...

Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk
<A HREF="http://www.hardcafe.co.uk/Alaric/">http://www.hardcafe.co.uk/Alaric/</A>

- Raw text -


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