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

Transform device-dependent bitmap to device-independent bitmap, Heathkit H-100, DeSmet C

I created three bitmap formats for graphic images on the Heathkit H-100 computer. 

Two of them (.ZIC=monochrome, .ZED=color) were fixed-size images and device dependent, saving the contents of video RAM to disk files. One of them, .PIC, could save an image of any size and was device-independent, saving colors as numeric values. 

This program loads a file in one of the DDB formats and creates an equivalent DIB file.

/*	zed2pic.c		9-17-94
	Copyright (C)1994 Steven Whitney.
	Published under GNU GPL (General Public License) Version 3, with ABSOLUTELY NO WARRANTY.
	Initially published by http://25yearsofprogramming.com.

	LOADS .ZIC OR .ZED FORMAT FILE, OUTPUTS TO FILE IN .PIC FORMAT.
	2005: THE .ZIC FORMAT WAS AN EARLY MONOCHROME VERSION OF MY .ZED
	FORMAT, WHICH SAVED ONLY THE GREEN PLANE. YOU SHOULDN'T ENCOUNTER 
	.ZICS ANYWHERE EXCEPT FOR VARIOUS REFERENCES TO THEM THROUGHOUT MY 
	PROGRAMS. IN ANY EVENT, ZEDLOAD() AND ZEDSAVE() CAN HANDLE BOTH
	FORMATS TRANSPARENTLY. 

*/
#include "stdio.h"

main(argc,argv)
int argc;
char **argv;
{
int x, y;
FILE *infile, *outfile;

puts("This program converts a .ZIC or .ZED file to .PIC format.\n");
if(argc < 2)
	abort("Usage:  ZED2PIC filename.ext (extension must be .ZIC or .ZED)");
if(!zedload(argv[1]))
	abort("Input file not found.");

outfile = fopen("screen.pic","w");
fprintf(outfile,"%d,%d\n",640,225);		

_outb(0x78,0xd8);				/* enable all planes */
puts("\033x1");					/* enable line 25 */

for(y = 0 ; y < 225 ; y++)
	for(x = 0 ; x < 640 ; x++)
		if(fputc((char)(pset(x,y,'s',0)),outfile) == ERR)
			abort("File write error.");
if(fclose(outfile) == ERR)
	puts("File write error.\n");
printf("Input file: %s.  Rename output file SCREEN.PIC as desired.\n",argv[1]);
puts("\033z");				/* reset terminal */
exit(0);
}

 

 

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