delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/28/16:17:00

From: "nat saiger" <nat DOT saiger AT ntlworld DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Prob. using linear frame buffer.
Lines: 189
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <5fGK5.24669$h%4.131576@news2-win.server.ntlworld.com>
Date: Sat, 28 Oct 2000 21:04:23 +0100
NNTP-Posting-Host: 213.104.238.33
X-Complaints-To: abuse AT ntlworld DOT com
X-Trace: news2-win.server.ntlworld.com 972763201 213.104.238.33 (Sat, 28 Oct 2000 21:00:01 BST)
NNTP-Posting-Date: Sat, 28 Oct 2000 21:00:01 BST
Organization: ntlworld News Service
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This is a multi-part message in MIME format.

------=_NextPart_000_0012_01C04122.A5B88240
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi, ive just returned to djgpp after a couple of years of not using it =
and am used to bank switching.=20
Ive made the usual VBE2 handling routines and everything seems to work =
fine, i can set video modes and get mode info.=20
The problem in PhysBasePtr is *always* 0, and any attempt to write to =
the video mem crashes my system.

heres some of the code...

void MapLFB(short index)
{ __dpmi_meminfo info;

    // not sure if the next three lines are needed, but it doesnt make =
much difference...

  video_ds =3D __dpmi_allocate_ldt_descriptors(1);
  =
__dpmi_set_segment_base_address(video_ds,0xA000+__djgpp_conventional_base=
);
  __dpmi_set_segment_limit(video_ds,2000000);

  info.size=3D(unsigned long)vesainfo.TotalMemory<<16;
  printf("Mapping %d bytes for Linear Frame Buffer\n",info.size);
  info.address=3DModeList[index].PhysBasePtr;
  printf("Pointer to LFB =3D %u\n",ModeList[index].PhysBasePtr);

  if(__dpmi_physical_address_mapping(&info)!=3D0)
    {
        printf("Can't map Linear Frame Buffer!\n");
    }

  __dpmi_free_ldt_descriptor(video_ds);
  video_ds =3D __dpmi_allocate_ldt_descriptors(1);
  __dpmi_set_segment_base_address(video_ds,info.address);
  __dpmi_set_segment_limit(video_ds,info.size-1);

  vidptr=3D(unsigned char *)((unsigned =
long)info.address+__djgpp_conventional_base);
}


void SetVesaMode(short index)
{
   __dpmi_regs r;
   memset(&r,0,sizeof(__dpmi_regs));
   r.x.ax=3D0x4F02;
   r.x.bx=3DModes[index];
   if (ModeList[index].ModeAttributes & 0x80)

      {r.x.bx+=3D0x4000;
      }
      //r.x.bx+=3D0x8000;

   __dpmi_int(0x10,&r);
   if(r.x.ax !=3D0x004f)    // Set Linear Buffer Mode
   {
      printf("Couldn't set mode");
      exit(1);
   }
   CurrentVideoMode =3D index;

   if(ModeList[index].ModeAttributes & 0x80)
   {MapLFB(index);
   }
}

so, in theory i should be able to use vidptr and a linear array, and =
video_ds for other access, but nope.

I hope someone can help... cheers.

Nat Saiger.


------=_NextPart_000_0012_01C04122.A5B88240
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi, ive just returned to djgpp after a =
couple of=20
years of not using it and am used to bank switching. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Ive made&nbsp;the usual VBE2 handling =
routines and=20
everything seems to work fine, i can set video modes and get mode info.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The problem in PhysBasePtr is *always* =
0, and any=20
attempt to write to the video mem crashes my system.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>heres some of the code...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>void MapLFB(short index)<BR>{ =
__dpmi_meminfo=20
info;</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; // not sure if =
the&nbsp;next=20
three lines are needed, but&nbsp;it doesnt make much =
difference...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT><BR><FONT=20
face=3DCourier size=3D2>&nbsp; video_ds =3D=20
__dpmi_allocate_ldt_descriptors(1);<BR>&nbsp;=20
__dpmi_set_segment_base_address(video_ds,0xA000+__djgpp_conventional_base=
);<BR>&nbsp;=20
__dpmi_set_segment_limit(video_ds,2000000);</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>&nbsp; info.size=3D(unsigned=20
long)vesainfo.TotalMemory&lt;&lt;16;<BR>&nbsp; printf("Mapping %d bytes =
for=20
Linear Frame Buffer\n",info.size);<BR>&nbsp;=20
info.address=3DModeList[index].PhysBasePtr;<BR>&nbsp; printf("Pointer to =
LFB =3D=20
%u\n",ModeList[index].PhysBasePtr);<BR></FONT></DIV>
<DIV><FONT face=3DCourier size=3D2>&nbsp;=20
if(__dpmi_physical_address_mapping(&amp;info)!=3D0)<BR>&nbsp;&nbsp;&nbsp;=
=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Can't map Linear =
Frame=20
Buffer!\n");<BR>&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT><FONT face=3DCourier =
size=3D2></FONT><FONT=20
face=3DCourier size=3D2></FONT><FONT face=3DCourier =
size=3D2></FONT><FONT face=3DCourier=20
size=3D2></FONT><FONT face=3DCourier size=3D2></FONT><BR><FONT =
face=3DCourier=20
size=3D2>&nbsp; __dpmi_free_ldt_descriptor(video_ds);<BR>&nbsp; video_ds =
=3D=20
__dpmi_allocate_ldt_descriptors(1);<BR>&nbsp;=20
__dpmi_set_segment_base_address(video_ds,info.address);<BR>&nbsp;=20
__dpmi_set_segment_limit(video_ds,info.size-1);</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>&nbsp; vidptr=3D(unsigned char =
*)((unsigned=20
long)info.address+__djgpp_conventional_base);</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2>}</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>void SetVesaMode(short=20
index)<BR>{<BR>&nbsp;&nbsp; __dpmi_regs r;<BR>&nbsp;&nbsp;=20
memset(&amp;r,0,sizeof(__dpmi_regs));<BR>&nbsp;&nbsp;=20
r.x.ax=3D0x4F02;<BR>&nbsp;&nbsp; r.x.bx=3DModes[index];<BR>&nbsp;&nbsp; =
if=20
(ModeList[index].ModeAttributes &amp; 0x80)</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
{r.x.bx+=3D0x4000;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //r.x.bx+=3D0x8000;</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>&nbsp;&nbsp;=20
__dpmi_int(0x10,&amp;r);<BR>&nbsp;&nbsp; if(r.x.ax =
!=3D0x004f)&nbsp;&nbsp;&nbsp;=20
// Set Linear Buffer Mode<BR>&nbsp;&nbsp; =
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
printf("Couldn't set mode");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
exit(1);<BR>&nbsp;&nbsp; }<BR>&nbsp;&nbsp; CurrentVideoMode =3D=20
index;</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DCourier>&nbsp;&nbsp;=20
if(ModeList[index].ModeAttributes &amp; 0x80)<BR>&nbsp;&nbsp;=20
{MapLFB(index);<BR>&nbsp;&nbsp; }<BR>}</FONT><BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>so, in theory i should be able to use =
vidptr and a=20
linear array, and video_ds for other access, but nope.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I hope someone can help... =
cheers.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Nat Saiger.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV></FONT></BODY></HTML>

------=_NextPart_000_0012_01C04122.A5B88240--

- Raw text -


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