www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/20/21:53:41

Date: Thu, 20 Jun 96 21:46:26 EDT
From: Mihai Moise <moisemih AT ift DOT ulaval DOT ca>
Message-Id: <9606210146.AA27067@vonneuman.ift.ulaval.ca>
To: djgpp AT delorie DOT com
Subject: Re: Two really stupid questions re: graphics.

> All I need is a routine to set up a graphic display, 
> and a routine to plot a pixel . . . 

These are simple demands.

 > ... and how to set up a VESA 1.2 truecolor video mode?

VESA 1.2 does not allow linear addressing, therefore depending
on the pixel you want to put on the screen, you will have
to send bank-switching codes. I will let some-one else describe how to
do this in dos. . . 

Another simpler solution is to use Linux SVGAlib. Try the following
code fragment:

#include <vga.h>

void main ( void ) {
	vga_init();
	vga_setmode(800x600x64K);
	vga_setlinearaddressing();
	graph_mem = vga_getgraphmem();	// Defined in vga.h
	
	// The following puts a white pixel at 10,10 .
	
	*( ( short int * ) graph_mem ) [ 10 * 800 + 10 ] = 0xffff;
	
	// Delay loop:
	
	for ( int i = 0; i < 100000000 ; i ++ );
	
	vga_setmode ( 0 ); // text
}

I am writing this by heart so verify it all in vga.h, also look at README.vga.

btw, the Scitech UniVBE distribution of VESA 2.0 is kinda nasty after 21 days...

Good Luck!!

Mihai Moise

"If the fool would persist in his folly, he would become wise," William Blake.

- Raw text -


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