From: "nat saiger" Newsgroups: comp.os.msdos.djgpp Subject: Prob. using linear frame buffer. Lines: 189 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0012_01C04122.A5B88240" 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
Hi, ive just returned to djgpp after a = couple of=20 years of not using it and am used to bank switching.
Ive made the usual VBE2 handling = routines and=20 everything seems to work fine, i can set video modes and get mode info.=20
The problem in PhysBasePtr is *always* = 0, and any=20 attempt to write to the video mem crashes my system.
 
heres some of the code...
 
void MapLFB(short index)
{ = __dpmi_meminfo=20 info;
 
    // not sure if = the next=20 three lines are needed, but it doesnt make much = difference...

  video_ds =3D=20 __dpmi_allocate_ldt_descriptors(1);
 =20 __dpmi_set_segment_base_address(video_ds,0xA000+__djgpp_conventional_base= );
 =20 __dpmi_set_segment_limit(video_ds,2000000);
 
  info.size=3D(unsigned=20 long)vesainfo.TotalMemory<<16;
  printf("Mapping %d bytes = for=20 Linear Frame Buffer\n",info.size);
 =20 info.address=3DModeList[index].PhysBasePtr;
  printf("Pointer to = LFB =3D=20 %u\n",ModeList[index].PhysBasePtr);
 =20 if(__dpmi_physical_address_mapping(&info)!=3D0)
   = =20 {
        printf("Can't map Linear = Frame=20 Buffer!\n");
    }

  __dpmi_free_ldt_descriptor(video_ds);
  video_ds = =3D=20 __dpmi_allocate_ldt_descriptors(1);
 =20 __dpmi_set_segment_base_address(video_ds,info.address);
 =20 __dpmi_set_segment_limit(video_ds,info.size-1);
 
  vidptr=3D(unsigned char = *)((unsigned=20 long)info.address+__djgpp_conventional_base);
}
 
 
void SetVesaMode(short=20 index)
{
   __dpmi_regs r;
  =20 memset(&r,0,sizeof(__dpmi_regs));
  =20 r.x.ax=3D0x4F02;
   r.x.bx=3DModes[index];
   = if=20 (ModeList[index].ModeAttributes & 0x80)
 
     =20 {r.x.bx+=3D0x4000;
     =20 }
      //r.x.bx+=3D0x8000;
 
  =20 __dpmi_int(0x10,&r);
   if(r.x.ax = !=3D0x004f)   =20 // Set Linear Buffer Mode
   = {
     =20 printf("Couldn't set mode");
     =20 exit(1);
   }
   CurrentVideoMode =3D=20 index;
 
  =20 if(ModeList[index].ModeAttributes & 0x80)
  =20 {MapLFB(index);
   }
}

so, in theory i should be able to use = vidptr and a=20 linear array, and video_ds for other access, but nope.
 
I hope someone can help... = cheers.
 
Nat Saiger.
 
------=_NextPart_000_0012_01C04122.A5B88240--