DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦e0f871750⟧ TextFile

    Length: 959 (0x3bf)
    Types: TextFile
    Notes: UNIX file
    Names: »usave.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦926b8033d⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »u/demo/slide/usave.c« 

TextFile

/*
**	Save an Image off the screen
*/
#include <stdio.h>

#define STARTY 100L
#define ENDY 512L
#define SEG0 ((char *) (0x3a000000L))
#define SEG1 ((char *)( 0x3b000000L))
#define XMAX 1024
#define SIZE 62000L
#define BPB  8
#define XBYTES (XMAX/BPB)
#define MAXBOX 15
main(argc,argv)
char	**argv;
{
	unsigned char *sp;
	unsigned char *p,*q;
	unsigned short n,ct = 0;
	int	d[8];
	for(n=0;n<8;n++)d[n]=atoi(*++argv);
	sp = SEG0;
	printf("");
	if((p = malloc((unsigned short)SIZE)) == NULL) exit();
	q = p;
	while(ct++ < (unsigned short)SIZE) {
		if((*p++ = getchar()) == EOF) break;
	}
	box(d);
	ldir(sp,q,(ct/2));
}
box(d)
int d[];
{
	short dx1,dy1,dx2,dy2;
	short	i;
	dx1 = (d[4]-d[0])/MAXBOX;
	dy1 = (d[5]-d[1])/MAXBOX;
	dx2 = (d[6]-d[2])/MAXBOX;
	dy2 = (d[7]-d[3])/MAXBOX;
	for(i=0; i< MAXBOX; i++) 
		db(d[0]+(i*dx1),d[1]+(i*dy1),d[2]+(i*dx2),d[3]+(i*dy2));
}
db(a,b,c,d)
short	a,b,c,d;
{
	line(a,b,c,b);
	line(c,b,c,d);
	line(c,d,a,d);
	line(a,d,a,b);
}