Index: iolib/dofmt.c
===================================================================
--- iolib/dofmt.c	(revision 05806159f2593192d6ed2fca28358480a2383c67)
+++ iolib/dofmt.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -27,5 +27,5 @@
 
 #define	MAXDIGS	11
-#define	HIBITL	(1L << ( (8 * sizeof(long)) - 1))
+#define	HIBITL	(1L << ( (8 * sizeof(int32_t)) - 1))
 
 #define	LONGHMSK	0x0FFFFFFFL
@@ -38,18 +38,18 @@
 
 #if	CRUFTY
-extern	long	uldiv(long divid, long divis);
-extern	long	uldivr;
+extern	int32_t	uldiv(int32_t divid, int32_t divis);
+extern	int32_t	uldivr;
 #endif
 
-long dofmt_(int (*putsub)(), char *format, va_list args)
+int32_t dofmt_(int16_t (*putsub)(), int8_t *format, va_list args)
 {
-	register int fcode;
-
-	long	k,
+	register int16_t fcode;
+
+	int32_t	k,
 		n,
 		lzero,
 		count;
 
-	int	hradix,
+	int16_t	hradix,
 		lowbit,
 		length,
@@ -62,11 +62,11 @@
 		prec;
 
-	register char *bp, *p;
-
-	char	*prefix,
+	register int8_t *bp, *p;
+
+	int8_t	*prefix,
 		*tab,
 		buf[MAXDIGS];
 
-	long	val;
+	int32_t	val;
 
 /* 
@@ -83,5 +83,5 @@
 			;
 
-		if (n = (long)format - (long)bp) {
+		if (n = (int32_t)format - (int32_t)bp) {
 
 			count += n;
@@ -126,5 +126,5 @@
 		if (fcode EQ '*') {
 
-			width = va_arg(args, int);
+			width = va_arg(args, int16_t);
 
 			if (width < 0) {
@@ -149,5 +149,5 @@
 		else if (*++format EQ '*') {
 
-			prec = va_arg(args, int);
+			prec = va_arg(args, int16_t);
 			format++;
 		} else
@@ -193,9 +193,9 @@
 
 			if (length)
-				val = va_arg(args, long);
+				val = va_arg(args, int32_t);
 			else if (fcode EQ 'd')
-				val = va_arg(args, int);
+				val = va_arg(args, int16_t);
 			else
-				val = va_arg(args, unsigned);
+				val = va_arg(args, uint16_t);
 
 			if (fcode EQ 'd') {
@@ -265,5 +265,5 @@
 			}
 
-			lzero = (long)bp - (long)p + (long)prec;
+			lzero = (int32_t)bp - (int32_t)p + (int32_t)prec;
 
 			if (fsharp AND bp NE p)
@@ -291,5 +291,5 @@
 
 		case 'c':
-			buf[0] = va_arg(args, int);
+			buf[0] = va_arg(args, int16_t);
 
 		c_merge:
@@ -299,5 +299,5 @@
 
 		case 's':
-			p = bp = va_arg(args, char *);
+			p = bp = va_arg(args, int8_t *);
 
 			if (prec < 0)
@@ -322,5 +322,5 @@
 			lzero = 0;
 
-		k = (n = (long)p - (long)bp) + (long)(lzero +
+		k = (n = (int32_t)p - (int32_t)bp) + (int32_t)(lzero +
 			(prefix[0] EQ '\0' ? 0 : (prefix[1] EQ '\0' ? 1 : 2)));
 
Index: iolib/mdump.c
===================================================================
--- iolib/mdump.c	(revision 05806159f2593192d6ed2fca28358480a2383c67)
+++ iolib/mdump.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -39,7 +39,7 @@
 */
 
-static void pipc(char chars[], int length)
+static void pipc(int8_t chars[], int16_t length)
 {
-	int	i;
+	int16_t	i;
 
 	for (i = 0; i < length; i++)
@@ -60,9 +60,9 @@
 */
 
-void mdump(char *begin, char *end, long start)
+void mdump(int8_t *begin, int8_t *end, int32_t start)
 {
-	long	i, ii;
-	int	j, jj, k;
-	char	c, chars[PERLINE];
+	int32_t	i, ii;
+	int16_t	j, jj, k;
+	int8_t	c, chars[PERLINE];
 
 	i = 0L;
Index: iolib/pause.c
===================================================================
--- iolib/pause.c	(revision 05806159f2593192d6ed2fca28358480a2383c67)
+++ iolib/pause.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -8,8 +8,8 @@
 #include "biosdefs.h"
 
-extern	int	waitcr(void);
-extern	void	writeln(int unit, char *buf);
+extern	int16_t	waitcr(void);
+extern	void	writeln(int16_t unit, int8_t *buf);
 
-void pause(char *s)
+void pause(int8_t *s)
 {
 	writeln(CON_DEV, s);
Index: iolib/printf.c
===================================================================
--- iolib/printf.c	(revision 05806159f2593192d6ed2fca28358480a2383c67)
+++ iolib/printf.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -17,7 +17,7 @@
 #include "stdarg.h"
 
-extern	long	dofmt_(int (*putsub)(), char *format, va_list args);
+extern	int32_t	dofmt_(int16_t (*putsub)(), int8_t *format, va_list args);
 
-	static int fpsub(int c);
+	static int16_t fpsub(int16_t c);
 
 /*
@@ -27,7 +27,7 @@
 */
 
-long printf(char *fmt, ...)
+int32_t printf(int8_t *fmt, ...)
 {
-	register long count;
+	register int32_t count;
 	va_list aptr;
 
@@ -44,5 +44,5 @@
 */
 
-static int fpsub(int c)
+static int16_t fpsub(int16_t c)
 {
 	/* KLUDGE:  since we aren't Unix(tm) we prepend a CR to LF's */
Index: iolib/rawio.c
===================================================================
--- iolib/rawio.c	(revision 05806159f2593192d6ed2fca28358480a2383c67)
+++ iolib/rawio.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -69,10 +69,10 @@
 
 
-int readln(int unit, int nc, char *ctl, int nb, char *buf)
-{
-	register char *cp;
-	register int i, j;
-	register char *bp;
-	register char c;
+int16_t readln(int16_t unit, int16_t nc, int8_t *ctl, int16_t nb, int8_t *buf)
+{
+	register int8_t *cp;
+	register int16_t i, j;
+	register int8_t *bp;
+	register int8_t c;
 	
 
@@ -93,5 +93,5 @@
 		for (j = 0; j < nc; j++)	/* scan each byte of ctl */
 			if (*ctl++ EQ c )	/* done if we find it */
-				return((int)c);
+				return((int16_t)c);
 
 		BIOS(B_PUTC, unit, c);		/* echo the character */
@@ -104,9 +104,9 @@
  */
 
-int getln(int unit, int nb, char *buf)
-{
-	register char *bp;
-	register char c;
-	register int bc;
+int16_t getln(int16_t unit, int16_t nb, int8_t *buf)
+{
+	register int8_t *bp;
+	register int8_t c;
+	register int16_t bc;
 
 	bc = 0;		/* number of characters currently in buffer */
@@ -144,5 +144,5 @@
 			*bp++ = c;		/* put character in buffer */
 			*bp = '\0';		/* terminate line with null */
-			return((int)c);		/* return -- CR or LF hit */
+			return((int16_t)c);		/* return -- CR or LF hit */
 
 /* 
@@ -152,5 +152,5 @@
 
 			*buf = '\0';		/* clear the buffer */
-			return((int)c);		/* return -- line cancelled */
+			return((int16_t)c);		/* return -- line cancelled */
 
 		default:
@@ -169,9 +169,9 @@
  */
 
-int getrln(int unit, int nb, char *buf)
-{
-	register char *bp;
-	register char c;
-	register int bc;
+int16_t getrln(int16_t unit, int16_t nb, int8_t *buf)
+{
+	register int8_t *bp;
+	register int8_t c;
+	register int16_t bc;
 
 	bc = 0;		/* number of characters currently in buffer */
@@ -191,10 +191,10 @@
 			*bp++ = c;		/* put character in buffer */
 			*bp = '\0';		/* terminate line with null */
-			return((int)c);		/* return -- CR, LF, or ^Z hit */
+			return((int16_t)c);		/* return -- CR, LF, or ^Z hit */
 
 		case CTL('X'):
 
 			*buf = '\0';		/* clear the buffer */
-			return((int)c);		/* return -- line cancelled */
+			return((int16_t)c);		/* return -- line cancelled */
 
 		default:
@@ -212,8 +212,8 @@
  */
 
-void writeln(int unit, char *buf)
-{
-	register char *bp;
-	register char c;
+void writeln(int16_t unit, int8_t *buf)
+{
+	register int8_t *bp;
+	register int8_t c;
 
 	bp = buf;	/* setup buffer pointer */
Index: iolib/sprintf.c
===================================================================
--- iolib/sprintf.c	(revision 05806159f2593192d6ed2fca28358480a2383c67)
+++ iolib/sprintf.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -8,8 +8,8 @@
 #include "stdarg.h"
 
-extern	long	dofmt_(int (*putsub)(), char *format, va_list args);
+extern	int32_t	dofmt_(int16_t (*putsub)(), int8_t *format, va_list args);
 
-static char	*buff;
-	static int spsub(char c);
+static int8_t	*buff;
+	static int16_t spsub(int8_t c);
 
 /*
@@ -19,7 +19,7 @@
 */
 
-long sprintf(char *str, char *fmt, ...)
+int32_t sprintf(int8_t *str, int8_t *fmt, ...)
 {
-	register long count;
+	register int32_t count;
 	va_list aptr;
 
@@ -38,5 +38,5 @@
 */
 
-static int spsub(char c)
+static int16_t spsub(int8_t c)
 {
 	return((*buff++ = c) & 0xFF);
Index: iolib/waitcr.c
===================================================================
--- iolib/waitcr.c	(revision 05806159f2593192d6ed2fca28358480a2383c67)
+++ iolib/waitcr.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -21,7 +21,7 @@
 */
 
-int waitcr(void)
+int16_t waitcr(void)
 {
-	int	c;
+	int16_t	c;
 
 	BIOS(B_PUTC, CON_DEV, '\007');		/* wake up the operator */
@@ -29,5 +29,5 @@
 	/* await a CR, in which case we just exit */
 
-	while ('\r' NE (c = (0x007F & (int)BIOS(B_GETC, CON_DEV))))
+	while ('\r' NE (c = (0x007F & (int16_t)BIOS(B_GETC, CON_DEV))))
 		if (c EQ '\007')	/* ... or a control-G */
 			xtrap15();	/* ... in which case we trap first */
