File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / event / bio.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (6 years, 11 months ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b


#include "definitions"

/*	I/O ROUTINES TO CPU2 CONSOLE 	*/

#define MAXC		1000		/* MAX 1000 chars per line */
#define OUTADR		0x20000		/* Address of output buffer */
#define INADR		0x20100		/* Address of input buffer  */

long ocnt = 0;				/* Next location in output buffer */
long icnt = 0;				/* Next location in input buffer */
extern long savvec7;

writec(c)		/* VERSION to run on the simmulator */
char c;
{
	putchar(c);
}

readc(c)
char *c;
{	char *cptr;

	asm("mfpr $MME,_savvec7");	
	savvec7 = savvec7 & 0x1;
	asm("mtpr $0,$MME");		/* Disable MME */
	cptr = (char *)(INADR+ icnt++);
	*c = *cptr;
	asm("mtpr _savvec7,$MME");	/* Restore MME */
}

writes(s)
char *s;
{
	putstr(s);
}

/*	This function read a string of characters.
	calling sequence : nochar = reads(s);
	input argument   : char *s;
	return value     : no. of char read; excluding NULL or CR.
*/
reads(s)
char *s;
{	char *str;
	int ix;

	str = s;
	for(ix=0;ix<ALINE;ix++)
	{
		readc(str);
		if ((*str==NULL)||(*str==CR)) 
			{ *str = NULL;
			  break;
			}
		     else str++;
	}
	icnt = 0;		/* For simulator only */

	return(ix);
}
/*	This function read a string of HEX digit and
	convert it to integer value.
	calling sequence : stat = readh(ix);
	input parameter  : long *ix;
	return value     : (stat < 0) if error else (stat = 0);
*/

/*
readh(ix)	
long *ix;
{	char line[ALINE], *getnum(), *del;
	int nochar;

	if ( (nochar = reads(line)) > 8 ) return(-1);
	if ( (del = getnum(line,ix,del,HEX)) < 0 ) return(-1);
		else return(0);
}

*/



writeh(ix)	/* 32 bits HEX */
long ix;
{	long iy, temp, mask;
	int count;
	char c;

	iy=1; count = 28;
	mask = 0xf0000000;
	while (mask)
	{
		c = ( (ix&mask) >> count )&0xf;
		count -= 4;
		mask = mask >> 4;
		if (iy) 
			{ mask = 0xf000000; 
			  iy=0;
			}
		if ((c>=0)&&(c<=9)) c=c+'0';
			else c=c+'7';
		writec(c);
	}
}

/*	This function read a string of DEC digit and
	convert it to integer value.
	calling sequence : stat = readd(ix);
	input parameter  : long *ix;
	return value     : (stat < 0) if error else (stat = 0);
*/

/*
readd(ix)	
long *ix;
{	char line[ALINE], *getnum(), *del;
	int nochar;

	if ( (nochar = reads(line)) > 11 ) return(-1);
	if ( (del = getnum(line,ix,del,DEC)) < 0 ) return(-1);
		else return(0);
}
*/


writed(ix)	/* 32 bits DECIMAL */
long ix;
{	char c;
	long div;
	float divi;
	int lead0;

/*
	if (ix<0) 
		{  writes("********");
		   return(0);        }
	lead0 = 1;
	divi = 1000000000;
	div = divi;
	while (div)
	{
		c = (ix/div)+'0';
		ix = ix%div;
		divi = divi/10;
		div = divi;
		if ((c=='0')&&(lead0)) c=SPACE;
			else lead0 = 0;
		writec(c);
	}
*/

}


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.