www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/17/20:59:26

Message-ID: <328FCC0E.6778@gbrmpa.gov.au>
Date: Mon, 18 Nov 1996 11:36:43 +0800
From: Leath Muller <leathm AT gbrmpa DOT gov DOT au>
Reply-To: leathm AT gbrmpa DOT gov DOT au
Organization: Great Barrier Reef Marine Park Authority
MIME-Version: 1.0
To: Jaroslav Kamenik <stone AT atrey DOT karlin DOT mff DOT cuni DOT cz>
CC: djgpp AT delorie DOT com
Subject: Re: DPMI + VESA problem
References: <56hksh$d4e$1 AT ns DOT felk DOT cvut DOT cz>

You would probably be better off making some changes:

> void GetVESAInfo()
> {
>   __dpmi_regs   r;
>   int           BufDosSeg;
>   int           BufSel;
> 
>   BufDosSeg = __dpmi_allocate_dos_memory(33,&BufSel);
>   r.x.ax = 0x4f00;
>   r.x.es = BufDosSeg;
>   r.x.di = 0x0000;
>   __dpmi_simulate_real_mode_interrupt(0x10,&r);
>   movedata(BufSel,0,_my_ds(),(unsigned int)(&VIB),sizeof(VESAInfo));
>   __dpmi_free_dos_memory(BufSel);

Just use __dpmi__int(0x10, &r) because you don't have to init anything
other than the registers you use...
 
> void GetModeInfo(unsigned short m)
> {
>   __dpmi_regs   r;
>   int           BufDosSeg;
>   int           BufSel;
 
>   BufDosSeg = __dpmi_allocate_dos_memory(65,&BufSel);

You don't need to do this, use the transfer buffer thats already
assigned
when you run a DJGPP program...
 
>   r.x.ax = 0x4f01;
>   r.x.es = BufDosSeg;
>   r.x.di = 0x0000;
>   r.x.cx = m;

r.x.es = __tb / 16;
r.x.di = 0;

>   __dpmi_simulate_real_mode_interrupt(0x10,&r);

__dpmi_int(0x10; &r);
 
>   movedata(BufSel,0,_my_ds(),(unsigned int)(&MIB),sizeof(ModeInfo));

>   __dpmi_free_dos_memory(BufSel);

When you use the transfer buffer, you dont have to play with dos memory
at all...
 
> }
> 
> void main()
> {
>   unsigned short i;
> 
>   GetVESAInfo();
>   for (i=0x100;i<0x1ff;i++)
>   {
>     GetModeInfo(i);
>     printf("%d %d %d\n",MIB.XResolution,MIB.YResolution,MIB.BitsPerPixel);
>   }
> }
> 
>   After printing last mode info, it blew some black lines and hungs.

You really shouldn't do the loop you have done. You should move your way
through the video mode list. The Vesa docs say you should only call the
GetModeInfo routine with a mode number that is defined in the video mode
list. Undefined behaviour results otherwise...

Leathal.

- Raw text -


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