From: gpt20 AT thor DOT cam DOT ac DOT uk (G.P. Tootell) Newsgroups: comp.os.msdos.djgpp Subject: boo hoo i can't make this work :( (vesa stuff) Date: 21 Nov 1996 18:50:45 GMT Organization: University of Cambridge, England Lines: 64 Sender: gpt20 AT hammer DOT thor DOT cam DOT ac DOT uk (G.P. Tootell) Message-ID: <5728a5$sgq@lyra.csx.cam.ac.uk> NNTP-Posting-Host: hammer.thor.cam.ac.uk Keywords: vesa To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp ok, i read chapter 18 of the faq, i downloaded tutorials and stuff, i compiled them, i understood most of em even :) *but* i'm stuck with this... i'm trying to get the info about modes supported by a video card, now under real mode there was no problem, i just followed the pointer, but despite various (sometimes random) attempts at getting this to work under djgpp i can't do it :( could someone please just tell me where i've gone wrong. (the code should return the first supported screen mode into 'value', eventually i want to return all the supported screen modes and find one that matches the specs i supply.) thanks muchly, nik ps. yes i know the seg and off calculations are really screwy, this is like the 454365436th rewrite of this code and i was clutching at straws by this time :) it is true to say the pointer returned can be cast as a long in this way tho right? at least under standard dos it was.. and the calculation for farpeek i got from chapter 18 of the faq :( #define PACKED __attribute__ ((packed)) #pragma pack(1) /* SuperVGA information block */ typedef struct { char VESASignature[4] PACKED; /* 'VESA' 4 byte signature */ short VESAVersion PACKED; /* VBE version number */ char *OEMStringPtr PACKED; /* Pointer to OEM string */ long Capabilities PACKED; /* Capabilities of video card */ short *VideoModePtr PACKED; /* Pointer to supported modes */ short TotalMemory PACKED; /* Number of 64kb memory blocks */ char reserved[236] PACKED; /* Pad to 256 byte block size */ } VBE_VgaInfo; #pragma pack() void VBE_detect(VBE_VgaInfo *vbeinfo) { __dpmi_regs regs; short value,seg,off; assert(sizeof(*vbeinfo)<_go32_info_block.size_of_transfer_buffer); regs.x.ax=0x4F00; regs.x.di=__tb & 0x0F; regs.x.es=(__tb>>4) & 0xFFFF; dosmemput(vbeinfo,sizeof(*vbeinfo),__tb); __dpmi_int(0x10, ®s); dosmemget(__tb,sizeof(*vbeinfo),vbeinfo); if (strncmp(vbeinfo->VESASignature,"VESA",4)!=0) { printf("vesa not supported.\n"); exit(0); } else { seg=(unsigned long)vbeinfo->VideoModePtr>>16; off=(unsigned long)vbeinfo->VideoModePtr & 0xffff; value=_farpeekw(_dos_ds,seg*16+off); printf("%d ",value); } } -- * the iq of a user is inversely proportional to the length of their sig file *