
/********************************************************/
/*							*/
/*	Point-Plotting routines for MX-80 Graphics	*/
/*							*/
/*	Don Brittain		3 January 1983		*/
/*							*/
/********************************************************/

#define HSIZE 320
#define VSIZE 328
#define NO 0
#define YES 1
extern int horsize, versize, flag;
extern short grafbuf[HSIZE][VSIZE/8];


pixplot(h,v)	/* Plots point (in the graphics RAM image) */
		/* having coordinates (h, v).		   */            
int h,v;

{
    int w;

    if((v<versize)&&(h<horsize))	{
	w=(versize-1)/8-v/8;
        grafbuf[h][w]=(grafbuf[h][w]|power(2,v%8));    }
}

unpixplot(h,v)	/* Unplots a point (ie turns pixel off) */

int h,v;

{
    int w;
    
    if((v<versize)&&(h<horsize))	{
	w=(versize-1)/8-v/8;
	grafbuf[h][w]=(grafbuf[h][w]&(0xff^power(2,v%8)));	}
}


power(x,n)	/* computes x^^n for integers. Stolen from Kernigan */
			/* and Plauger */
int x,n;

{
    int p;
    for(p=1; n>0; --n)
	p=p*x;
    return(p);
}

