delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/23/14:33:59

From: strider7 AT unm DOT edu
Newsgroups: comp.os.msdos.djgpp
Subject: Help with Vesa video mode list pointer
Date: Sun, 20 Jul 1997 11:42:04 -0600
Organization: University of New Mexico, Albuquerque
Lines: 73
Message-ID: <33D24DEC.76E6@unm.edu>
NNTP-Posting-Host: ppp-058.unm.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello, I can't seem to get the video mode list from the Info Block.  I
know its a real mode pointer and I can get the OEM String successfully,
but the video mode list isn't right, heres the code:

#pragma pack(1)
static struct _InfoBlock {

    // VBE 1.2 items

    char		Signature[4];      // VBE Signature
    unsigned short	Version;           // VBE Version
    char*               OEMStringPtr;      // Pointer to OEM String
    unsigned char	Capabilities[4];   // Features of graphics environment
    unsigned short*     VideoModeListPtr;  // Pointer to Video Mode List
    unsigned short	NumMemoryBlocks;   // Number of 64k memory blocks

    // VBE 2.0 items

    unsigned short	OEMSoftwareRevision;
    char*	 	OEMVendorNamePtr;
    char*		OEMProductNamePtr;
    char*		OEMProductRevisionPtr;

    unsigned char	Reserved[222];     // VBE 2.0 scratch area
    unsigned char 	OEMData[256];      // OEMData area

} InfoBlock; 
#pragma pack()

void VBE::BuildVideoModeList() {

    // Extract the video modes from real-mode in the InfoBlock,
    // validate them, and place them into the VideoModeList.

    int segment = (int(InfoBlock.VideoModeListPtr) & 0xffff0000) >> 16;
    int offset  = (int(InfoBlock.VideoModeListPtr) & 0x0000ffff);
    
    unsigned short mode = _farpeekw(_dos_ds, segment * 16 + offset);

    // 0xffff terminates the list.

    while(mode != 0xffff) {

        printf("%#x\n", mode);		// debug

        if(GetVideoModeInfo(mode)) {

            VideoModeList[NumberOfVideoModes] =
                new VideoModeNode(mode,
                                  ModeInfo.XResolution,
                                  ModeInfo.YResolution,
                                  ModeInfo.BitsPerPixel);
            assert(VideoModeList[NumberOfVideoModes]);

            NumberOfVideoModes++;

        }

        offset += 2;                            // a short is 2 bytes
        mode = _farpeekw(_dos_ds, segment * 16 + offset);

    }

    printf("%#x\n", mode);		// debug
    
}

Any help is appreciated.

-- 
Jeremiah Zanin
Email: strider7 AT unm DOT edu
Webpage: http://www.unm.edu/~strider7

- Raw text -


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