Mail Archives: djgpp/1997/12/01/20:16:12
>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 -