delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/22/06:30:21

From: "Lequtis" <Live AT BTInternet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Creating a VGA Selector
Date: Sat, 22 Aug 1998 11:05:10 +0100
Organization: BT Internet
Lines: 72
Message-ID: <6rm5ip$b4l$1@plutonium.btinternet.com>
NNTP-Posting-Host: host5-99-54-140.btinternet.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Im having a problem creating a selector for the VGA memory region
 0xA000:0000 ).

Heres the test code I have written...

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

         int   selector;
unsigned long  linear;

void MakeSelector( unsigned long address, unsigned long size ) {

// commented out since 0xA000:0000 is under the 1meg mark and the //  linear
address is the same as the physical one

/*  __dpmi_meminfo mi;

  mi.size    = size;
  mi.address = address;
  __dpmi_physical_address_mapping(&mi);
  linear = mi.address;
  __dpmi_lock_linear_region(&mi);*/

  selector = __dpmi_allocate_ldt_descriptors(1);
  __dpmi_set_segment_base_address(selector, address);
  __dpmi_set_segment_limit(selector, size - 1);

};

void DestroySelector( void ) {

  __dpmi_meminfo mi;

  mi.address = linear;
  __dpmi_free_physical_address_mapping(&mi);

  linear = 0;

  __dpmi_free_ldt_descriptor(selector);

};

int main( void ) {

  MakeSelector(0xA0000UL, 320*200);

  asm ("
    movw $0x13, %%ax\n
    int  $0x10"
    :::"ax");

  getch();

  _farpokeb(selector, 10, 4);

  getch();

  asm ("
    movw $0x03, %%ax\n
    int  $0x10"
    :::"ax");

  DestroySelector();

};


Any ideas?


- Raw text -


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