delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/26/13:37:28

From: "v. straka" <vstraka AT iol DOT cz>
Newsgroups: comp.os.msdos.djgpp
Subject: __dpmi_physical_address_mapping
Date: 26 Feb 1999 18:10:15 GMT
Organization: Nextel
Lines: 46
Message-ID: <01be61b5$4c6ae000$7b7b7b7b@celeron>
NNTP-Posting-Host: as5-29.praha.iol.cz
X-Newsreader: Microsoft Internet News 4.70.1155
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi i have following problem with %subject% :

 #include <dpmi.h>
 #include <go32.h>
 #include <sys/farptr.h>
 #include <sys/nearptr.h>
 #include <conio.h>

 main()
 {
  __dpmi_meminfo VESAmapping,CAMERAmapping;
  int VESASelector,CAMERASelector;

  // physical address of VESA memory
  VESAmapping.address = mode_info.PhysBasePtr;
  VESAmapping.size = vesa_info.TotalMemory << 16;
  /* Why __dpmi_physical_address_mapping change VESAmapping.address ?!!!
     -> I mapped address X and then set selector to address Y */
  if (__dpmi_physical_address_mapping(&VESAmapping) != 0) return -1;

  VESASelector = __dpmi_allocate_ldt_descriptors(1);
  // and now is VESAmapping.address != mode_info.PhysBasePtr
  __dpmi_set_segment_base_address(VESASelector, VESAmapping.address);
  __dpmi_set_segment_limit(VESASelector, VESAmapping.size-1);

  CAMERAmapping.address = 0xDE000000;
  CAMERAmapping.size = 0xFFFFFF;
  if (__dpmi_physical_address_mapping(&CAMERAmapping) != 0) return -1;

  CAMERASelector = __dpmi_allocate_ldt_descriptors(1);
  __dpmi_set_segment_base_address(CAMERASelector, CAMERAmapping.address);
  __dpmi_set_segment_limit(CAMERASelector, CAMERAmapping.size-1);
  long CAMERAoffset = 0;
  /* i feel like: this stuff copy 640*480 byts from
   CAMERAmapping.address+CAMERAoffset to VESAmapping.address and go
   to another 640*480 block, but program always crashes with VIOLATION */
  do {
   movedata(CAMERASelector,CAMERAoffset,VESASelector,0,640*480);
   CAMERAoffset+=640*480;
  } while (CAMERAoffset<0xFFFFFF);
  __dpmi_free_physical_address_mapping(&VESAmapping);
  __dpmi_free_physical_address_mapping(&CAMERAmapping);
  textmode(LASTMODE);
 }

     Please replay to my e-mail not here... THANKS!!!!!

- Raw text -


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