25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Home   Projects   Up   Sitemap   Search   Blog   Forum+Chat   About Us   Privacy   Terms of Use   Feedback   FAQ   Images   Services   Payments   Humor   Music

Copy the contents of one video RAM color plane to another, DeSmet C for the Heathkit H-100 computer

This program was an experiment at directly fetching and setting the contents of video RAM for two of the three color planes on the H-100 computer. 

It uses two different methods for setting video RAM: one byte at a time, or an entire scan line at a time, which is much faster. 

The methods from this program went into rotplanes() in my graphic function library. It rotates the contents of all three color planes for interesting effects.

/*	planetrf.c		4-16-91
	Copyright (C)1991 Steven Whitney.
	Published under GNU GPL (General Public License) Version 3, with ABSOLUTELY NO WARRANTY.
	Initially published by http://25yearsofprogramming.com.

	MERELY COPIES THE CONTENTS OF ONE COLOR PLANE INTO ANOTHER.
	FOR TESTING MY UNDERSTANDING OF THE COLOR PLANE ADDRESSING.
	SUCCESSFULLY DEMONSTRATES AND COMPARES TWO METHODS FOR SETTING VIDEO MEMORY,
	USING _POKE() AND _LMOVE().

*/

#include "stdio.h"

main()
{
int y, i;
char *offset;

puts("\033z\033x1");

_outb(0x78,0xD8);				/*  enable all planes   */
								/*  "graphics mode"  */

for(y = 0 ; y <= 392 ; y++)		/* make lines in green plane */
{
	if((y % 16) < 9)				/* is this a legal scan line? */
	{							
		for(i = 0 ; i < 80 ; i++)
		{
			offset = (char *)((y * 128) + i);	
			_poke(16,offset,0xE000);		
		}
	}				/*  above section pokes bytes individually */
}					/*  and is rather slow  */



for(y = 0 ; y <= 392 ; y++)			/* now copy green plane to red */
{
	if((y % 16) < 9)				/* is this a legal scan line? */
	{
		offset = (char *)((y * 128));
		_lmove(80,offset,0xE000,offset,0xD000);
	}
}					/* above section is like lightning!  */



exit(0);
}

 


 

Valid HTML 4.01 Transitional Valid CSS
Yahoo! Search
Search the web Search this site
View content labeling at ICRA.