www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/01/19:49:30

From: Mirko Geffken <mirko AT seitz DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Linear Frame Buffer Programming
Date: Tue, 01 Oct 1996 19:37:49 +0200
Organization: Customer of EUnet Germany; Info: info AT Germany DOT EU DOT net
Lines: 57
Message-ID: <325156ED.47ED@seitz.de>
References: <52oric$hop AT hagar DOT cyberoptics DOT com>
NNTP-Posting-Host: pcmge.seitz.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eric Rudd wrote:
>

<SNIP> 
>    int _crt0_startup_flags = _CRT0_FLAG_NEARPTR | _CRT0_FLAG_NONMOVE_SBRK;
>    .
>    .
>    .
>    info.size = width*height*BytesPerPixel;
>    info.address = (int) PhysBasePtr;
>    if (__dpmi_physical_address_mapping(&info) == -1) {
>       return 2;   /* Physical mapping of address PhysBasePtr failed. */
>    }
>    VideoBase = (void *) info.address;  /* Updated by above call */
>    (char *) VideoBase += __djgpp_conventional_base;
> 
> I then access video memory by references like
> 
>    ((char *) VideoBase)[offset] = GrayValue;
> 
> -Eric Rudd
<SNIP>

Hello

If I do it your way, I get a protection fault.
I can erase that problem by setting the ds segment limit by hand.
__dpmi_set_segment_limit(_my_ds(),info.address+Video_card_memory);
and then accessing the memory your way.

Or do the following.

I allocate as much memory as the Video card supports
my_video=malloc(Video_card_memory+Alignment_buffer);
then aligning the pointer, mapping the PhysBasePtr, like you did it.
info.size = Video_card_memory;
info.address = (int) PhysBasePtr;
if (__dpmi_physical_address_mapping(&info) == -1) {
  return 2;   /* Physical mapping of address PhysBasePtr failed. 

after that my program changes a little (maybe this is stupid, but it
works)
I do a physical mapping with
__djgpp_map_physical_memory(my_video,Video_card_memory,info.address);

after that it is no problem to access my_video like this:
*(my_video+offset)=pixel_value;

I think the advance of my routine is, that it doesn't have to
disable protection (by setting the ds segment limit to 4GB).

If I am wrong and there is any problem with doing it that way (I know
that this will only work with dmpi 1.0) please post it here or mail me.


Greetings
Mirko

- Raw text -


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