delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/01/20:16:12

From: qball1723 AT aol DOT com (QBall1723)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Mode Z
Date: 1 Dec 1997 21:39:56 GMT
Lines: 51
Message-ID: <19971201213900.QAA26482@ladder02.news.aol.com>
NNTP-Posting-Host: ladder02.news.aol.com
Organization: AOL http://www.aol.com
References: <347A106C DOT 27B1 AT ba DOT ssdn DOT skelleftea DOT se>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>Subject: Mode Z
>From: Andreas Burman <abu1016 AT ba DOT ssdn DOT skelleftea DOT se>
>Date: Mon, Nov 24, 1997 18:40 EST
>Message-id: <347A106C DOT 27B1 AT ba DOT ssdn DOT skelleftea DOT se>
>
>I'm trying to write a mode Z (320x400x256) graphic library, and has 
>encounter an problem. When I try to plot a pixel four pixels appers.
>I think the problem is that I writing to all four planes. Anyone how
>can write me an function (in inline Asm) that plots ONE pixel in 
>mode Z?

here's a function for you....this IS NOT the most efficient way..


void Write_Pixel_Z(int x,int y,int color)
{

// this function will write a pixel to screen in mode Z

// first select the proper color plane to use

   int what_plane;
   int for_shifting;

   what_plane = x & 0x03;
   for_shifting = 0x01;
   for_shifting = for_shifting<<what_plane;

	outportb(SEQUENCER,SEQ_PLANE_ENABLE);
	outportb(SEQUENCER+1,for_shifting);

// write the pixel, offset = (y*80)+(x/4)

video_buffer[(y<<6)+(y<<4)+(x>>2)] = (unsigned char )color;

} // end Write_Pixel_Z

The defines you'll need are here:


#define SEQUENCER	0x3C4	// the sequencer's index port
// ...defines for the SEQUENCER registers of interest

#define SEQ_PLANE_ENABLE	0x02 

Have a good one!


Jim the loiterer (wannabe PC game/graphics developer)
http://members.aol.com/qball1723/index.htm
[please don't hate me because I pay too much for poor internet service!!]

- Raw text -


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