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 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> </DIV>
<DIV><FONT face=3DArial size=3D2>heres some of the code...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </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> </DIV>
<DIV><FONT face=3DArial size=3D2> // not sure if =
the next=20
three lines are needed, but 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> video_ds =3D=20
__dpmi_allocate_ldt_descriptors(1);<BR> =20
__dpmi_set_segment_base_address(video_ds,0xA000+__djgpp_conventional_base=
);<BR> =20
__dpmi_set_segment_limit(video_ds,2000000);</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2> info.size=3D(unsigned=20
long)vesainfo.TotalMemory<<16;<BR> printf("Mapping %d bytes =
for=20
Linear Frame Buffer\n",info.size);<BR> =20
info.address=3DModeList[index].PhysBasePtr;<BR> printf("Pointer to =
LFB =3D=20
%u\n",ModeList[index].PhysBasePtr);<BR></FONT></DIV>
<DIV><FONT face=3DCourier size=3D2> =20
if(__dpmi_physical_address_mapping(&info)!=3D0)<BR> =
=20
{<BR> printf("Can't map Linear =
Frame=20
Buffer!\n");<BR> }</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> __dpmi_free_ldt_descriptor(video_ds);<BR> video_ds =
=3D=20
__dpmi_allocate_ldt_descriptors(1);<BR> =20
__dpmi_set_segment_base_address(video_ds,info.address);<BR> =20
__dpmi_set_segment_limit(video_ds,info.size-1);</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2> 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> </DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2>void SetVesaMode(short=20
index)<BR>{<BR> __dpmi_regs r;<BR> =20
memset(&r,0,sizeof(__dpmi_regs));<BR> =20
r.x.ax=3D0x4F02;<BR> r.x.bx=3DModes[index];<BR> =
if=20
(ModeList[index].ModeAttributes & 0x80)</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2> =20
{r.x.bx+=3D0x4000;<BR> =20
}<BR> //r.x.bx+=3D0x8000;</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2> =20
__dpmi_int(0x10,&r);<BR> if(r.x.ax =
!=3D0x004f) =20
// Set Linear Buffer Mode<BR> =
{<BR> =20
printf("Couldn't set mode");<BR> =20
exit(1);<BR> }<BR> CurrentVideoMode =3D=20
index;</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DCourier> =20
if(ModeList[index].ModeAttributes & 0x80)<BR> =20
{MapLFB(index);<BR> }<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> </DIV>
<DIV><FONT face=3DArial size=3D2>I hope someone can help... =
cheers.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Nat Saiger.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> </DIV></FONT></BODY></HTML>
------=_NextPart_000_0012_01C04122.A5B88240--
- Raw text -