delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/19/19:06:31

From: strider7 AT unm DOT edu
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problem with linear video memory
Date: Fri, 15 Aug 1997 21:21:06 -0600
Organization: University of New Mexico, Albuquerque
Lines: 48
Message-ID: <33F51CA2.27AB@unm.edu>
References: <5svlb3$auf AT news DOT xgw DOT fi>
Reply-To: strider7 AT unm DOT edu
NNTP-Posting-Host: ppp-051.unm.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Sampo Niskanen wrote:
> 
> How can I make a selector to access the memory of a linear framebuffer
> (VESA VBE 2.0, __dpmi_set_selector doesn't work) and how can I write in
> it? When I try to write to it (with a selector which can access all 4GB
> of memory), it always segfaults. Is there something else to do than
> just to set a (vesa) videomode with bit 14 set and to check the position
> of the framebuffer to get a linear framebuffer?
> 
> --
>   __________________________________________________
>  /____\    Sampo Niskanen <=> sampo AT compart DOT fi      \
>        \         http://www.compart.fi/~sampo        \
>         \     ________________________________________\___
>          \___/___________________________________________/


<begin code-dump>

        // User linear frame buffering.

        __dpmi_meminfo memInfo;

        memInfo.address = (int)ModeInfo.PhysBasePtr;
        memInfo.size    = (ModeInfo.XResolution * ModeInfo.YResolution *
                           ModeInfo.BitsPerPixel) / 8;

        if(__dpmi_physical_address_mapping(&memInfo)) return false;

        VideoSelector = __dpmi_allocate_ldt_descriptors(1);

        if(VideoSelector == -1) return false;

        __dpmi_set_segment_base_address(VideoSelector, memInfo.address);
        __dpmi_set_segment_limit(VideoSelector, memInfo.size | 0xfff);

	...

	// write a pixel using the new selector in the upper-left corner

	_farpokeb(VideoSelector, 0, color);

<end code-dump>

-- 
Jeremiah Zanin
Email: strider7 AT unm DOT edu
Webpage: http://www.unm.edu/~strider7

- Raw text -


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