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

⟦3fd674d77⟧ TextFile

    Length: 1996 (0x7cc)
    Types: TextFile
    Notes: UNIX file
    Names: »fuse.c«

Derivation

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

TextFile

	short a0[] = {
	4,-10,4,0,-18,5,2,-3,8,-5,10,-15,-9,16,1,14
};
	short a1[] = {
	-18,-4,-7,17,-18,9,10,15,-14,8,18,16,16,-12,18,1
};
	short a2[] = {
	-15,11,8,1,7,-9,-9,-19,-12,2,-9,16,11,1,-16,16
};
	short a3[] = {
	17,-10,-16,13,-4,6,15,-2,15,-3,2,-1,-10,1,1,16
};
	short a4[] = {
	2,13,9,2,-6,-14,3,-18,10,1,1,18,-6,-17,-18,-9
};
	short a5[] = {
	6,2,18,-9,4,20,2,13,-3,0,-5,7,-12,2,-19,-14
};
	short a6[] = {
	18,-9,10,-16,13,12,12,6,-2,-13,1,12,15,-2,-1,-10
};
	short a7[] = {
	1,13,-14,11,1,-3,7,15,-16,-11,-6,13,-9,-5,18,18
};
	short	*ap[] = {a0,a1,a2,a3,a4,a5,a6,a7};
short jp = 0;
short	lsx,lsy;
fline(x1,y1,x2,y2)
{
	short	x,y;
	short	lx,ly;
	short	pm,i;
	long	dxdy,dydx,lx1,lx2,ly1,ly2;
	long	n,dx,dy,sx,sy,sgn(),labs();
	lx1 = (long)x1<<(long)10;
	ly1 = (long)y1<<(long)10;
	lx2 = (long)x2<<(long)10;
	ly2 = (long)y2<<(long)10;

	dx = lx2-lx1;
	dy = ly2-ly1;

	x = (short)(lx1>>(long)10);
	y = (short)(ly1>>(long)10);
	pm = 0;
	/*sp(x,y,1);*/
	point(x,y);
	spark(x,y);

	sx = sgn(dx); sy = sgn(dy);

	if(labs(dx) > labs(dy)) {
		dydx = labs((dy<<(long)10)/dx);
		lx1>>=(long)10;
		n = labs(dx)>>(long)10;
		dydx *= sy;
		while(--n) {
			x = (short)(lx1 += sx);
			y = (short)((ly1 += dydx)>>(long)10);
			point(x,y);
			/*sp(x,y,0);*/
			if((++pm)%2 == 0) spark(x,y);
		}
	}
	else {
		dxdy = labs((dx<<(long)10)/dy);
		n = labs(dy)>>(long)10;
		ly1 >>= (long)10;
		dxdy *= sx;
		while(--n>=0) {
			x = (short)((lx1 += dxdy)>>(long)10);
			y = (short)(ly1 += sy);
			point(x,y);
			/*sp(x,y,0);*/
			if((++pm)%2 == 0) spark(x,y);
		}
	}
}
fspark(x,y)
short x,y;
{
	onspark(x,y,0);
	jp = 0;
	lsx = x;
	lsy = y;
}
onspark(x,y,of)
short x,y,of;
{
	short i;
	short	*sp = ap[of];
	for(i = 0; i<8; i++) {
		line(x,y,x+*sp, y+*(sp+1));
		sp += 2;
	}
}	
offspark()
{
	onspark(lsx,lsy,jp);
}
spark(x,y)
short	x,y;
{
	onspark(x,y,(jp+1)%8);
	onspark(lsx,lsy,jp);
	lsx = x; lsy = y;
	jp = (jp+1)%8;
}
long sgn(x)
long x;
{
	return((x>0) ? 1:-1);
}
long labs(x)
long x;
{
	return((x>0) ? x:-x);
}