www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/23/11:02:30

Message-Id: <01BB611D.C5F60080@gw2-159.pool.dircon.co.uk>
From: David L Clayton <dclayton AT dircon DOT co DOT uk>
To: "'DJGPP mail place'" <djgpp AT delorie DOT com>
Subject: graphics
Date: Sun, 23 Jun 1996 16:04:05 -0000
Mime-Version: 1.0

richard 725 AT denver DOT email DOT com was wondering about mode 13:

Take a butchers at the following code, which sets the mode as 320 by 200 =
with 256 colours, and then uses the screen buffer to plot a pixel:

union REGS r;
char *scrptr;
char ScreenBuffer[64000];  // 320 * 200 =3D 64000, which is the memory =
we must                                        // allocate

void set320x200(void)
{
r.h.ah =3D 0;               // Clears previous values for ah
r.h.al =3D 13;              // Video mode required
int86(0x10, &r, &r);  // Interrupt 10 is the video card. Simple, eh?
}

void drawbufferpixel(long x, long y, char colour)
{
*((char *) Screen Buffer + ((y<<*)+(y<<6))+x)=3Dcolour; // Calculates =
the location                                                             =
                                                                         =
                                                                         =
                         //of the pixel on a 300 by                      =
                                                                         =
                                                            =
memcpy(scrptr,ScreenBuffer,64000);                       //200 screen, =
and sets=20
memset(ScreenBuffer,0,64000);                             //that value =
within the                                                               =
                                                                         =
             =20
                                                                         =
 //screen buffer to the colour                                           =
                                                                         =
                                  //specified
}

----------------------
David L Clayton
----------------------


- Raw text -


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