delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/07/05:05:45

From: "Michael Stewart" <mike AT reggin DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: accessing the graphical video memory
Date: Mon, 7 Jun 1999 08:52:07 +0100
Organization: (Posted via) Netcom Internet Ltd.
Lines: 73
Message-ID: <7jftm5$gil$1@taliesin.netcom.net.uk>
References: <7jdrj2$i3g$1 AT fe1 DOT cs DOT interbusiness DOT it>
NNTP-Posting-Host: hgty.capgemini.co.uk
X-Trace: taliesin.netcom.net.uk 928741893 16981 194.42.240.2 (7 Jun 1999 07:51:33 GMT)
X-Complaints-To: abuse AT corp DOT netcom DOT net DOT uk
NNTP-Posting-Date: 7 Jun 1999 07:51:33 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Bonifati wrote in message <7jdrj2$i3g$1 AT fe1 DOT cs DOT interbusiness DOT it>...
>i'm trying to convert some graphical demo programs in 320x200-256 written
>for Watcom under DJGPP. Since i need to access video memory directly, i've
>read djgppfaq.
>I copied a snippet of code from 18.4 section to define a selector for text
>video memory:
>
>         int TxtVRAMSetupSelector (void)
>         {
>            static char selectorData[8] = {
>              0xff, 0x7f, 0x00, 0x80,
>              0x0b, 0xf3, 0x40, 0x00
>            };
>            int screenSelector = __dpmi_allocate_ldt_descriptors (1);
>            if (__dpmi_set_descriptor (screenSelector, selectorData) < 0)
>              abort ();
>            return screenSelector;
>         }
>
>and i modified like this:
>
>     #include <dpmi.h>
>
>     short video;
>
>int VideoVRAMSetupSelector (void)
>{
>  static char selectorData[8] = {
>    0xff, 0xf9, 0x00, 0x00,
>    0x0a, 0xf3, 0x40, 0x00
>  };
>  int screenSelector = __dpmi_allocate_ldt_descriptors (1);
>  if (__dpmi_set_descriptor (screenSelector, selectorData) < 0)
>    abort ();
>  return screenSelector;
>}
>
>void Create_Selector (void)
>{
>  video = VideoVRAMSetupSelector();
>  _farsetsel(video);
>}
>
>this code seems to work and i get useful GPFs if my program has bugs and
>tries to work out of the 64000 bytes of video memory (i.e. plotting a pixel
>with too big coordinates). My question (at last!) is:
>
>is this code completely correct?
I can't see any errors but there is a shorter way of doing it. _dos_ds is
already predefined as the selector, eg.

void clear_video (char col) {
   _farsetsel (_dos_ds);

   for (int i = 0; i < 64000; i++)
      _farnspokeb(0xa0000 + i, col);
}


>Another thing: djgppfaq has a link to a tutorial about accessing the linear
>frame buffer, but i can't reach it:
>http://www.rt66.com/~brennan/djgpp/vbe.zip
>this ones are broken, too
>http://brennan.home.ml.org/djgpp/
>http://brennan.home.ml.org/djgpp/djgpp-asm.html
>
>where can i find some example,tutorial... especially about inline assembly
>optimizations i need to do? (GCC online docs are too difficult for me...)
Look at the docs page on http://www.delorie.com/djgpp/

Michael Stewart


- Raw text -


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