delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/10/18:30:35

From: "A. Sinan Unur" <sinan DOT unur AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Mode 13h
Date: Sat, 10 Jan 1998 16:50:59 -0500
Organization: Cornell University (http://www.cornell.edu/)
Lines: 64
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <34B7ED43.B7414073@cornell.edu>
References: <19980110205301 DOT PAA10209 AT ladder01 DOT news DOT aol DOT com>
NNTP-Posting-Host: cu-dialup-0094.cit.cornell.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

HackerOC3 wrote:
> 
> I am using mode 13h, and the book I am using has examples to access 
> the video buffer.  This is what it says to do to fill the screen:
> 
> #define SCREEN_WIDTH unsigned int
> #define SCREEN_HEIGHT

huh??? if this really is what the book says, THROW IT OUT.

> 
> unsigned char far *video_buffer =(char far *)0xA0000000L;
> 
> void Fill_Screen(int value)
> {
> 
> _fmemset(video_buffer,(char)value,SCREEN_WIDTH*SCREEN_HEIGHT+1);
> 
> }
> 
> dos.h, conio.h, stdio.h, are #included
> 
> I always get parse errors.  I don't know what to do, and I need to get 
> this done fast.  Please help!

of course, you'll get parse errors. with the macros expanded, the line
above becomes

_fmemset(video_buffer, (char)value, unsigned int* +1)

in any case, this would work only with a particular ms compiler.

for examples of how to switch to mode 0x13 etc, you can take a look at:
http://www.people.cornell.edu/pages/asu1/samples/index.html#Putpixel

once you are in mode 0x13, you can use the following function:
(untested, by the way)

#include <sys/farptr.h>
#include <go32.h>

void FillScrVGA13_1(unsigned color)
{
 int i;
 unsigned c = (color << 24)|(color << 16)|(color << 8)|color;

 _farsetsel(_dos_ds);
 for(i=0; i<64000; i+=4)
   _farnspokel(_dos_ds, 0xa0000+i, c);
 _farsetsel(_my_ds());

 return;
}

compiled with -O2, this should be reasonably fast.

-- 
----------------------------------------------------------------------
A. Sinan Unur
Department of Policy Analysis and Management, College of Human Ecology,
Cornell University, Ithaca, NY 14853, USA

mailto:sinan DOT unur AT cornell DOT edu
http://www.people.cornell.edu/pages/asu1/

- Raw text -


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