delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/05/05:46:41

Newsgroups: comp.os.msdos.djgpp
From: Elliott Oti <oti AT phys DOT uu DOT nl>
Subject: Re: video buffer problem
Sender: usenet AT fys DOT ruu DOT nl (News system Tijgertje)
Message-ID: <Pine.OSF.3.95.980605103740.17998A-100000@ruunf0.fys.ruu.nl>
In-Reply-To: <1998060402035100.WAA17138@ladder03.news.aol.com>
Date: Fri, 5 Jun 1998 08:47:46 GMT
References: <1998060402035100 DOT WAA17138 AT ladder03 DOT news DOT aol DOT com>
Mime-Version: 1.0
Organization: Physics and Astronomy, University of Utrecht, The Netherlands
Lines: 58
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 4 Jun 1998, IPityTheFo wrote:

> It may help to know that I'm using a DOS Pacific C compiler.

Are you *using* the Pacific C compiler, or converting code to djgpp from
it?

> This is the code I use to create a pointer to the video buffer:
>    char far *video_buffer = (char far)0xA0000000L;
> The compiler tells me that you can't convert a pointer to a char far.
> Can someone help me out with that?

Pacific C: check if it has a MK_FP() function  ( Make Far Pointer )
and use that to convert 0xa0000000L into a far pointer

djgpp: The keyword "far" does not exist; either delete all instances of it
from your source code, or put a

#define far

at the beginning of the source file.

 
> Also I use this to fill the screen with a certain color:
>    #define SCREEN_WIDTH unsigned int
>    #define SCREEN_HEIGHT
>    void fill_screen(int value) {
>       _fmemset(video_buffer,(char)value,SCREEN_WIDTH*SCREEN_HEIGHT+1);
>    }
> The compiler tells me that the _fmemset line is so badly of a formed statement
> that it is impossible to compile.  Can someone help me out with that?
> 

Pacific C: The problem is that SCREEN_WIDTH == "unsigned int" and
SCREEN_HEIGHT is undefined, so the compiler resolves that line of code to
   _fmemset(video_buffer,(char)value, unsigned int* +1)
which is nonsense, of course.
The solution is to write

    #define SCREEN_WIDTH 320
    #define SCREEN_HEIGHT 200
    void fill_screen(int value) {
       _fmemset(video_buffer,(char)value,SCREEN_WIDTH*SCREEN_HEIGHT+1);
    }


djgpp: Aside from the problems mentiones above, which will also cause
djgpp to choke, the function _fmemset doesn't exist, and you will have to
use memset in combination with near pointers to get it to work. See the
djgpp FAQ for more details.

HTH,

  Elliott Oti
  kamer 104, tel (030-253) 2516 (RvG)    
  http://www.fys.ruu.nl/~oti


- Raw text -


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