delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/25/17:26:43

From: "Anthony Graham" <News_Anthony AT Fonzyco DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: A VESA Question
Date: Sat, 25 Mar 2000 19:58:38 -0000
Organization: GXSN
Lines: 145
Message-ID: <8bj6p1$1tp$1@gxsn.com>
NNTP-Posting-Host: 195.147.150.202
X-Trace: 954015329 1NNUCNF1G96CAC393C gxsn.com
X-Complaints-To: abuse AT gxsn DOT com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Is it possible to get Vesa mode info without DMPI or far pointers? I'm
trying not to use these. I went on the dj delorie site and got their vesa
source and tried to convert it (stop using dpmi and use int386/int386x) )
but it simply wont work!! If anyone can fix my code and e-mail me it back
i'd be most grateful, first is the dpmi version then is my attempt:


   typedef struct MODE_INFO
   {
      unsigned short ModeAttributes       __attribute__ ((packed));
      unsigned char  WinAAttributes       __attribute__ ((packed));
      unsigned char  WinBAttributes       __attribute__ ((packed));
      unsigned short WinGranularity       __attribute__ ((packed));
      unsigned short WinSize              __attribute__ ((packed));
      unsigned short WinASegment          __attribute__ ((packed));
      unsigned short WinBSegment          __attribute__ ((packed));
      unsigned long  WinFuncPtr           __attribute__ ((packed));
      unsigned short BytesPerScanLine     __attribute__ ((packed));
      unsigned short XResolution          __attribute__ ((packed));
      unsigned short YResolution          __attribute__ ((packed));
      unsigned char  XCharSize            __attribute__ ((packed));
      unsigned char  YCharSize            __attribute__ ((packed));
      unsigned char  NumberOfPlanes       __attribute__ ((packed));
      unsigned char  BitsPerPixel         __attribute__ ((packed));
      unsigned char  NumberOfBanks        __attribute__ ((packed));
      unsigned char  MemoryModel          __attribute__ ((packed));
      unsigned char  BankSize             __attribute__ ((packed));
      unsigned char  NumberOfImagePages   __attribute__ ((packed));
      unsigned char  Reserved_page        __attribute__ ((packed));
      unsigned char  RedMaskSize          __attribute__ ((packed));
      unsigned char  RedMaskPos           __attribute__ ((packed));
      unsigned char  GreenMaskSize        __attribute__ ((packed));
      unsigned char  GreenMaskPos         __attribute__ ((packed));
      unsigned char  BlueMaskSize         __attribute__ ((packed));
      unsigned char  BlueMaskPos          __attribute__ ((packed));
      unsigned char  ReservedMaskSize     __attribute__ ((packed));
      unsigned char  ReservedMaskPos      __attribute__ ((packed));
      unsigned char  DirectColorModeInfo  __attribute__ ((packed));
      unsigned long  PhysBasePtr          __attribute__ ((packed));
      unsigned long  OffScreenMemOffset   __attribute__ ((packed));
      unsigned short OffScreenMemSize     __attribute__ ((packed));
      unsigned char  Reserved[206]        __attribute__ ((packed));
   } MODE_INFO;


   MODE_INFO mode_info;


   int get_mode_info(int mode)
   {
      __dpmi_regs r;
      long dosbuf;
      int c;

      /* use the conventional memory transfer buffer */
      dosbuf = __tb & 0xFFFFF;

      /* initialize the buffer to zero */
      for (c=0; c<sizeof(MODE_INFO); c++)
  _farpokeb(_dos_ds, dosbuf+c, 0);

      /* call the VESA function */
      r.x.ax = 0x4F01;
      r.x.di = dosbuf & 0xF;
      r.x.es = (dosbuf>>4) & 0xFFFF;
      r.x.cx = mode;
      __dpmi_int(0x10, &r);

      /* quit if there was an error */
      if (r.h.ah)
  return -1;

      /* copy the resulting data into our structure */
      dosmemget(dosbuf, sizeof(MODE_INFO), &mode_info);

      /* it worked! */
      return 0;
   }


///////////////////////////NOW MY ATTEMPT//////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////

    MODE_INFO mode_info;


   int my_get_mode_info(int mode)
   {
      union REGS r, ro;
      struct SREGS sr;
      char *dodo;
      long dosbuf;
      int c;

      /* use the conventional memory transfer buffer */
      dosbuf = __tb & 0xFFFFF;
      dodo=(char *)malloc(256);

      /* initialize the buffer to zero */
      /* call the VESA function */
//      r.x.ax = 0x4F01;
//     r.x.di = dosbuf & 0xF;
//      r.x.es = (dosbuf>>4) & 0xFFFF;
//      r.x.cx = mode;
        r.h.ah=0x4F;
        r.h.al=0x01;
        r.w.di= (long)dodo & 0xF;
        r.w.cx=mode;
        sr.es=((long)dodo>>4) &0xFFFF;
//        int386x(0x10, &r, &ro, &sr);
//      __dpmi_int(0x10, &r);


      /* copy the resulting data into our structure */
      memcpy(&mode_info,dodo, 256);

      /* it worked! */
      return 0;
   }





thanks!

-Anthony

SPAM IS ILLEGAL...
ONCE IT IS KNOWN THAT SPAM IS NOT WANTED
THEY CALL IT UNSOLICITED MAIL
YOU ARE NOT TO SEND ME ANY ADVERTISEMENTS,
SPECIAL OFFERS OR ANYTHING WHICH MY PERMISSION IS NOT
GRANTED
NOW IT IS ILLEGAL
I DO NOT WISH TO RECIEVE E-MAIL WHICH IS NOT IN _DIRECT_ CORRESPONDANCE TO
THIS NEWS POSTING.







- Raw text -


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