Index: rom/romp.c
===================================================================
--- rom/romp.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ rom/romp.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -42,6 +42,4 @@
 #include "vsddvars.h"
 #endif
-
-typedef	unsigned short	UWORD16;	/* unsigned 16 bit word */
 
 /* 
@@ -122,9 +120,9 @@
 */
 
-extern	unsigned	setipl(unsigned arg);
+extern	uint16_t	setipl(uint16_t arg);
 
 extern	void	rjumpto(void *addr);
 extern	void	halt(void);
-extern	int	getln(int unit, int nb, char *buf);
+extern	int16_t	getln(int16_t unit, int16_t nb, int8_t *buf);
 extern	void	sjumpto(void *addr, void *stack);
 extern	void	trap15(void);
@@ -133,85 +131,85 @@
 #if	ON_B700
 extern	void	hdvini(void);
-extern	short	booter(char *fn, long textadr);
-extern	void	vsndpal(short pp[16][3]);
+extern	int16_t	booter(int8_t *fn, int32_t textadr);
+extern	void	vsndpal(int16_t pp[16][3]);
 #endif
 
 /* external variables */
 
-extern	short	wzcrsh, *crshpc, *crshsp, *crshus, crshst[16];
+extern	int16_t	wzcrsh, *crshpc, *crshsp, *crshus, crshst[16];
 
 #if	ON_B700
-extern	short	B_log_s;
-extern	short	B_dbg_s;
-extern	char	*B_buf_a;
-extern	int	_bpbin;
-extern	short	dfltpal[16][3];
+extern	int16_t	B_log_s;
+extern	int16_t	B_dbg_s;
+extern	int8_t	*B_buf_a;
+extern	int16_t	_bpbin;
+extern	int16_t	dfltpal[16][3];
 #endif
 
-extern	UWORD16	crshsr;
-extern	long	crshrg[16];
-extern	char	crshvc[4];
+extern	uint16_t	crshsr;
+extern	int32_t	crshrg[16];
+extern	int8_t	crshvc[4];
 
 /* forward references */
 
-int	cp_dump(void);
-int	cp_fill(void);
-int	cp_copy(void);
-int	cp_null(void);
-int	cp_ilev(void);
-int	cp_ldmp(void);
-int	cp_go(void);
-int	cp_read(void);
-int	cp_mset(void);
-int	cp_rset(void);
-int	cp_wset(void);
-int	cp_mtst(void);
-int	cp_wdmp(void);
-int	cp_wfil(void);
-int	cp_vrst(void);
-int	cp_monc(void);
-int	cp_mons(void);
-int	cp_monl(void);
-int	cp_chek(void);
+int16_t	cp_dump(void);
+int16_t	cp_fill(void);
+int16_t	cp_copy(void);
+int16_t	cp_null(void);
+int16_t	cp_ilev(void);
+int16_t	cp_ldmp(void);
+int16_t	cp_go(void);
+int16_t	cp_read(void);
+int16_t	cp_mset(void);
+int16_t	cp_rset(void);
+int16_t	cp_wset(void);
+int16_t	cp_mtst(void);
+int16_t	cp_wdmp(void);
+int16_t	cp_wfil(void);
+int16_t	cp_vrst(void);
+int16_t	cp_monc(void);
+int16_t	cp_mons(void);
+int16_t	cp_monl(void);
+int16_t	cp_chek(void);
 
 #if	ON_B700
-int	cx_dini(void);
-int	cx_mlod(void);
-int	cp_boot(void);
-int	cx_boot(void);
-int	cx_adsp(void);
+int16_t	cx_dini(void);
+int16_t	cx_mlod(void);
+int16_t	cp_boot(void);
+int16_t	cx_boot(void);
+int16_t	cx_adsp(void);
 #endif
 
-int	cx_dump(void);
-int	cx_fill(void);
-int	cx_copy(void);
-int	cx_rset(void);
-int	cx_load(void);
-int	cx_go(void);
-int	cx_read(void);
-int	cx_help(void);
+int16_t	cx_dump(void);
+int16_t	cx_fill(void);
+int16_t	cx_copy(void);
+int16_t	cx_rset(void);
+int16_t	cx_load(void);
+int16_t	cx_go(void);
+int16_t	cx_read(void);
+int16_t	cx_help(void);
 void	cx_exit(void);
-int	cx_writ(void);
-int	cx_regs(void);
-int	cx_mset(void);
-int	cx_bpb(void);
-int	cx_wset(void);
-int	cx_wdmp(void);
-int	cx_wfil(void);
+int16_t	cx_writ(void);
+int16_t	cx_regs(void);
+int16_t	cx_mset(void);
+int16_t	cx_bpb(void);
+int16_t	cx_wset(void);
+int16_t	cx_wdmp(void);
+int16_t	cx_wfil(void);
 void	cx_rest(void);
-int	cx_vrst(void);
-int	cx_vreg(void);
-int	cx_mon(void);
-int	cx_next(void);
-int	cx_ilev(void);
-int	do_srec(char *line);
-int	cx_crsh(void);
-int	cx_mtst(void);
+int16_t	cx_vrst(void);
+int16_t	cx_vreg(void);
+int16_t	cx_mon(void);
+int16_t	cx_next(void);
+int16_t	cx_ilev(void);
+int16_t	do_srec(int8_t *line);
+int16_t	cx_crsh(void);
+int16_t	cx_mtst(void);
 void	cx_zap(void);
-int	cx_ldmp(void);
-int	cx_omap(void);
-int	cx_chek(void);
-
-char	hs_mtst[];
+int16_t	cx_ldmp(void);
+int16_t	cx_omap(void);
+int16_t	cx_chek(void);
+
+int8_t	hs_mtst[];
 
 /* 
@@ -247,8 +245,8 @@
 struct cmdent {			/* command table entry */
 
-	char	*cname;		/* command name pointer */
-	int	(*cp)();	/* command parser function pointer */
-	int	(*cx)();	/* command execution function pointer */
-	char	*hstr;		/* help string pointer */
+	int8_t	*cname;		/* command name pointer */
+	int16_t	(*cp)();	/* command parser function pointer */
+	int16_t	(*cx)();	/* command execution function pointer */
+	int8_t	*hstr;		/* help string pointer */
 };
 
@@ -316,24 +314,24 @@
 */
 
-char	ahex[] = "0123456789abcdefABCDEF";
-
-char	*rlist[] = {		/* register name list */
+int8_t	ahex[] = "0123456789abcdefABCDEF";
+
+int8_t	*rlist[] = {		/* register name list */
 
 	"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
 	"a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7",
 	"sr", "pc", "sp",
-	(char *)0
+	(int8_t *)0
 };
 
-char	*vrlist[] = {		/* video register name list */
+int8_t	*vrlist[] = {		/* video register name list */
 
 	"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
 	"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
 	"h0", "h1", "h2", "h3", "v0", "v1", "v2", "v3",
-	(char *)0
+	(int8_t *)0
 };
 
 #if	ON_B700
-int	sigadr[] = {		/* display offsets for signals */
+int16_t	sigadr[] = {		/* display offsets for signals */
 
 	 0,  0,  0,  0,  0,   1,  1,  1,  1,  1,		/* keys	     */
@@ -366,7 +364,7 @@
 */
 
-char	argsep;		/* argument separator */
-
-char	*aptr,		/* argument pointer */
+int8_t	argsep;		/* argument separator */
+
+int8_t	*aptr,		/* argument pointer */
 	*monptr,	/* monitored variable pointer */
 	*d_cur,		/* dump current from */
@@ -379,5 +377,5 @@
 	*sptr;		/* string scan pointer */
 
-short	argln,		/* argument length */
+int16_t	argln,		/* argument length */
 	b0flag,		/* breakpoint 0 flag */
 	b1flag,		/* breakpoint 1 flag */
@@ -400,5 +398,5 @@
 
 #if	ON_B700
-short	asig,		/* signal number */
+int16_t	asig,		/* signal number */
 	aval,		/* signal value */
 	astat,		/* signal status */
@@ -407,10 +405,10 @@
 	ledcntr;	/* LED scan counter */
 
-short	sigtab[128][2];	/* signal table */
-
-long	afi,		/* analog FIFO input */
+int16_t	sigtab[128][2];	/* signal table */
+
+int32_t	afi,		/* analog FIFO input */
 	ftimer;		/* analog FIFO clear timer */
 
-unsigned	baron,		/* bar 'on' color */
+uint16_t	baron,		/* bar 'on' color */
 		baroff,		/* bar 'off' color */
 		swon,		/* switch 'on' color */
@@ -419,16 +417,16 @@
 #endif
 
-UWORD16	*tba0,		/* breakpoint 0 temporary */
+uint16_t	*tba0,		/* breakpoint 0 temporary */
 	*tba1;		/* breakpoint 1 temporary */
 
-UWORD16	p_bv0,		/* breakpoint 0 value */
+uint16_t	p_bv0,		/* breakpoint 0 value */
 	p_bv1;		/* breakpoint 1 value */
 
-UWORD16	*p_ba0,		/* breakpoint 0 address */
+uint16_t	*p_ba0,		/* breakpoint 0 address */
 	*p_ba1;		/* breakpoint 1 address */
 
 jmp_buf	restart;	/* jmp environment */
 
-long	p_len,		/* length parameter */
+int32_t	p_len,		/* length parameter */
 	p_value,	/* value parameter */
 	p_width;	/* width parameter */
@@ -436,5 +434,5 @@
 struct	regs	*regptr;	/* register save area pointer */
 
-char	argstr[MAXARGLN+1],	/* argument string */
+int8_t	argstr[MAXARGLN+1],	/* argument string */
 	cmdline[MAXCMDLN+1],	/* command line */
 	bfname[MAXFNLN+1],	/* boot file name */
@@ -475,7 +473,7 @@
 */
 
-int cx_mlod(void)
-{
-	register short i;
+int16_t cx_mlod(void)
+{
+	register int16_t i;
 
 	B_log_s = TRUE;
@@ -496,5 +494,5 @@
 
 		for (i = 0; i < 7; i++)		/* clear a0..a6 */
-			regptr->a_reg[i] = (char *)0L;
+			regptr->a_reg[i] = (int8_t *)0L;
 
 		regptr->a_reg[7] = ISTACK;	/* setup initial stack */
@@ -517,8 +515,8 @@
 */
 
-int cp_boot(void)
-{
-	register int i;
-	register char endc;
+int16_t cp_boot(void)
+{
+	register int16_t i;
+	register int8_t endc;
 
 	redo = FALSE;
@@ -560,7 +558,7 @@
 */
 
-int cx_boot(void)
-{
-	register short i;
+int16_t cx_boot(void)
+{
+	register int16_t i;
 
 	B_log_s = TRUE;
@@ -580,5 +578,5 @@
 
 		for (i = 0; i < 7; i++)		/* clear a0..a6 */
-			regptr->a_reg[i] = (char *)0L;
+			regptr->a_reg[i] = (int8_t *)0L;
 
 		regptr->a_reg[7] = ISTACK;	/* setup initial stack */
@@ -601,8 +599,8 @@
 */
 
-void dobar(int nb, int bv)
-{
-	register unsigned *bp;
-	register int i;
+void dobar(int16_t nb, int16_t bv)
+{
+	register uint16_t *bp;
+	register int16_t i;
 
 	if ((nb LT 1) OR (nb GT 82))
@@ -610,5 +608,5 @@
 
 	--nb;
-	bp = obj0 + BARBASE + (long)(sigadr[nb] + MARGIN + nb);
+	bp = obj0 + BARBASE + (int32_t)(sigadr[nb] + MARGIN + nb);
 
 	for (i = 127; i GE 0; --i) {
@@ -641,8 +639,8 @@
 */
 
-void dosw(int nb, int sv)
-{
-	register unsigned *bp;
-	register int i, j;
+void dosw(int16_t nb, int16_t sv)
+{
+	register uint16_t *bp;
+	register int16_t i, j;
 
 	if ((nb LT 1) OR (nb GT 82))
@@ -650,5 +648,5 @@
 
 	--nb;
-	bp = obj0 + SWBASE + (long)(sigadr[nb] + MARGIN + nb);
+	bp = obj0 + SWBASE + (int32_t)(sigadr[nb] + MARGIN + nb);
 
 	if (sv)
@@ -674,5 +672,5 @@
 */
 
-unsigned exp_c(unsigned c)
+uint16_t exp_c(uint16_t c)
 {
 	c &= 0x000F;
@@ -693,12 +691,12 @@
 */
 
-int cx_adsp(void)
-{
-	register int xasig, xastat, xaval;
-	register long xafi;
-	register long lc;
-	register unsigned *bp;
-	int	i, j, k;
-	int	oldi;
+int16_t cx_adsp(void)
+{
+	register int16_t xasig, xastat, xaval;
+	register int32_t xafi;
+	register int32_t lc;
+	register uint16_t *bp;
+	int16_t	i, j, k;
+	int16_t	oldi;
 
 	memsetw(sigtab, 0, sizeof sigtab / 2);
@@ -831,7 +829,7 @@
 */
 
-int waitcr(void)
-{
-	char	c;
+int16_t waitcr(void)
+{
+	int8_t	c;
 
 	BIOS(B_PUTC, CON_DEV, '\007');
@@ -856,8 +854,8 @@
 */
 
-int xdtoi(int c)
-{
-	register int i;
-	register char *ap = &ahex[0];
+int16_t xdtoi(int16_t c)
+{
+	register int16_t i;
+	register int8_t *ap = &ahex[0];
 
 	for (i = 0; i < 22; i++)
@@ -881,7 +879,7 @@
 */
 
-int getcmd(void)
-{
-	register int c;
+int16_t getcmd(void)
+{
+	register int16_t c;
 
 	sptr = cmdline;
@@ -944,7 +942,7 @@
 */
 
-int getarg(void)
-{
-	register int c;
+int16_t getarg(void)
+{
+	register int16_t c;
 
 	argln = 0;
@@ -1009,8 +1007,8 @@
 */
 
-int getlong(long *var)
-{
-	register long	temp = 0L;
-	register int 	csw = FALSE,
+int16_t getlong(int32_t *var)
+{
+	register int32_t	temp = 0L;
+	register int16_t 	csw = FALSE,
 			c;
 
@@ -1050,8 +1048,8 @@
 */
 
-int setvar(long *var, long deflt)
-{
-	int rc;
-	long temp;
+int16_t setvar(int32_t *var, int32_t deflt)
+{
+	int16_t rc;
+	int32_t temp;
 
 	*var = deflt;
@@ -1104,7 +1102,7 @@
 */
 
-void putn(long num, int cw, int unit)
-{
-	register int	d;
+void putn(int32_t num, int16_t cw, int16_t unit)
+{
+	register int16_t	d;
 
 	if (!cw)
@@ -1130,7 +1128,7 @@
 */
 
-void puthn(long num, int cw, int unit)
-{
-	register int	d;
+void puthn(int32_t num, int16_t cw, int16_t unit)
+{
+	register int16_t	d;
 
 	if (!cw)
@@ -1159,9 +1157,9 @@
 */
 
-int ddump(char *loc, char *lastloc, int nwide, int unit)
+int16_t ddump(int8_t *loc, int8_t *lastloc, int16_t nwide, int16_t unit)
 {
 	while (nwide--) {
 
-		puthn((long)(0xFF & *loc), 2, unit);
+		puthn((int32_t)(0xFF & *loc), 2, unit);
 		BIOS(B_PUTC, unit, ' ');
 
@@ -1195,5 +1193,5 @@
 */
 
-void padr(long adr, int unit)
+void padr(int32_t adr, int16_t unit)
 {
 	puthn(adr, 8, unit);
@@ -1213,7 +1211,7 @@
 */
 
-int dtext(char *loc, char *lastloc, int nwide, int unit)
-{
-	register int c;
+int16_t dtext(int8_t *loc, int8_t *lastloc, int16_t nwide, int16_t unit)
+{
+	register int16_t c;
 
 	BIOS(B_PUTC, unit, ' ');
@@ -1259,5 +1257,5 @@
 */
 
-int cp_mset(void)
+int16_t cp_mset(void)
 {
 	redo = FALSE;
@@ -1281,5 +1279,5 @@
 */
 
-int cx_mset(void)
+int16_t cx_mset(void)
 {
 	while (TRUE) {
@@ -1308,5 +1306,5 @@
 */
 
-int cp_wset(void)
+int16_t cp_wset(void)
 {
 	redo = FALSE;
@@ -1321,5 +1319,5 @@
 		return(FALSE);
 
-	if ((long)p_from & 1L)
+	if ((int32_t)p_from & 1L)
 		return(FALSE);
 
@@ -1337,9 +1335,9 @@
 */
 
-int cx_wset(void)
-{
-	UWORD16	*p_uint;
-
-	p_uint = (UWORD16 *)p_from;
+int16_t cx_wset(void)
+{
+	uint16_t	*p_uint;
+
+	p_uint = (uint16_t *)p_from;
 
 	while (TRUE) {
@@ -1369,5 +1367,5 @@
 */
 
-int cp_mtst(void)
+int16_t cp_mtst(void)
 {
 	inext = ilast;
@@ -1375,6 +1373,6 @@
 	if (argsep EQ A_CR OR argsep EQ '\0') {
 
-		p_from = (char *)0x00000008L;
-		p_to   = (char *)USER_RAM - 2L;
+		p_from = (int8_t *)0x00000008L;
+		p_to   = (int8_t *)USER_RAM - 2L;
 		return(TRUE);
 	}
@@ -1391,8 +1389,8 @@
 			return(FALSE);
 
-	if ((long)p_from & 1L)
+	if ((int32_t)p_from & 1L)
 		return(FALSE);
 
-	if ((long)p_to & 1L)
+	if ((int32_t)p_to & 1L)
 		return(FALSE);
 
@@ -1413,14 +1411,14 @@
 */
 
-int cx_mtst(void)
-{
-	register short	mask, was, *loc, *eloc, *oldloc;
+int16_t cx_mtst(void)
+{
+	register int16_t	mask, was, *loc, *eloc, *oldloc;
 
 	mask = 0x0001;
-	loc = (short *)p_from;
-	eloc = (short *)p_to;
+	loc = (int16_t *)p_from;
+	eloc = (int16_t *)p_to;
 	oldloc = loc;
 
-	if (p_from LT (char *)USER_RAM)
+	if (p_from LT (int8_t *)USER_RAM)
 		setipl(7);
 
@@ -1432,5 +1430,5 @@
 
 			if (mask NE (was = *loc))
-				if (p_from LT (char *)USER_RAM)
+				if (p_from LT (int8_t *)USER_RAM)
 					halt();
 				else
@@ -1441,5 +1439,5 @@
 
 			if (~mask NE (was = *loc))
-				if (p_from LT (char *)USER_RAM)
+				if (p_from LT (int8_t *)USER_RAM)
 					halt();
 				else
@@ -1455,6 +1453,6 @@
 	} while (loc LE eloc);
 
-	if (oldloc LT (short *)USER_RAM)
-		rjumpto((long)ROMADDR);
+	if (oldloc LT (int16_t *)USER_RAM)
+		rjumpto((int32_t)ROMADDR);
 
 	return(TRUE);
@@ -1471,5 +1469,5 @@
 */
 
-int cp_go(void)
+int16_t cp_go(void)
 {
 	redo = FALSE;
@@ -1483,5 +1481,5 @@
 			return(FALSE);
 
-		if (1L & (long)p_goto)
+		if (1L & (int32_t)p_goto)
 			return(FALSE);
 
@@ -1495,5 +1493,5 @@
 			return(FALSE);
 
-		if (1L & (long)tba0)
+		if (1L & (int32_t)tba0)
 			return(FALSE);
 
@@ -1506,5 +1504,5 @@
 			return(FALSE);
 
-		if (1L & (long)tba1)
+		if (1L & (int32_t)tba1)
 			return(FALSE);
 
@@ -1527,5 +1525,5 @@
 */
 
-int cx_dini(void)
+int16_t cx_dini(void)
 {
 	redo = TRUE;
@@ -1544,8 +1542,8 @@
 void cx_zap(void)
 {
-	register short *p, *q;
-
-	p = (short *)USER_RAM;
-	q = (short *)RAM_TOP;
+	register int16_t *p, *q;
+
+	p = (int16_t *)USER_RAM;
+	q = (int16_t *)RAM_TOP;
 
 	setipl(7);
@@ -1567,7 +1565,7 @@
 */
 
-int cx_omap(void)
-{
-	register short i, width, xloc;
+int16_t cx_omap(void)
+{
+	register int16_t i, width, xloc;
 
 	printf("Pr B/C Locn      Wd Xloc Flags\r\n");
@@ -1586,5 +1584,5 @@
 
 		printf("$%08lX %2d %4d ",
-			((long)v_odtab[i][2] << 1), width, xloc);
+			((int32_t)v_odtab[i][2] << 1), width, xloc);
 
 		printf("$%04X\r\n", v_odtab[i][0]);
@@ -1604,7 +1602,7 @@
 */
 
-int cx_help(void)
-{
-	int	i, j;
+int16_t cx_help(void)
+{
+	int16_t	i, j;
 
 	j = 0;
@@ -1643,5 +1641,5 @@
 */
 
-int cx_bpb(void)
+int16_t cx_bpb(void)
 {
 	register struct bpb *bpp;
@@ -1656,31 +1654,31 @@
 		writeln(cmdunit, "\r\n\nBPB values:\r\n");
 		writeln(cmdunit, "\r\n   recsiz   ");
-		putn((long)bpp->recsiz, 5, cmdunit);
+		putn((int32_t)bpp->recsiz, 5, cmdunit);
 		writeln(cmdunit, "\r\n   clsiz     ");
-		putn((long)bpp->clsiz, 4, cmdunit);
+		putn((int32_t)bpp->clsiz, 4, cmdunit);
 		writeln(cmdunit, "\r\n   clsizb   ");
-		putn((long)bpp->clsizb, 5, cmdunit);
+		putn((int32_t)bpp->clsizb, 5, cmdunit);
 		writeln(cmdunit, "\r\n   rdlen     ");
-		putn((long)bpp->rdlen, 4, cmdunit);
+		putn((int32_t)bpp->rdlen, 4, cmdunit);
 		writeln(cmdunit, "\r\n   fsiz      ");
-		putn((long)bpp->fsiz, 4, cmdunit);
+		putn((int32_t)bpp->fsiz, 4, cmdunit);
 		writeln(cmdunit, "\r\n   fatrec   ");
-		putn((long)bpp->fatrec, 5, cmdunit);
+		putn((int32_t)bpp->fatrec, 5, cmdunit);
 		writeln(cmdunit, "\r\n   datrec   ");
-		putn((long)bpp->datrec, 5, cmdunit);
+		putn((int32_t)bpp->datrec, 5, cmdunit);
 		writeln(cmdunit, "\r\n   numcl    ");
-		putn((long)bpp->numcl, 5, cmdunit);
+		putn((int32_t)bpp->numcl, 5, cmdunit);
 		writeln(cmdunit, "\r\n   bflags    ");
-		puthn((long)bpp->bflags, 4, cmdunit);
+		puthn((int32_t)bpp->bflags, 4, cmdunit);
 		writeln(cmdunit, "\r\n   ntracks   ");
-		putn((long)bpp->ntracks, 4, cmdunit);
+		putn((int32_t)bpp->ntracks, 4, cmdunit);
 		writeln(cmdunit, "\r\n   nsides    ");
-		putn((long)bpp->nsides, 4, cmdunit);
+		putn((int32_t)bpp->nsides, 4, cmdunit);
 		writeln(cmdunit, "\r\n   sec/cyl  ");
-		putn((long)bpp->dspc, 5, cmdunit);
+		putn((int32_t)bpp->dspc, 5, cmdunit);
 		writeln(cmdunit, "\r\n   sec/trk  ");
-		putn((long)bpp->dspt, 5, cmdunit);
+		putn((int32_t)bpp->dspt, 5, cmdunit);
 		writeln(cmdunit, "\r\n   hidden    ");
-		putn((long)bpp->hidden, 4, cmdunit);
+		putn((int32_t)bpp->hidden, 4, cmdunit);
 		writeln(cmdunit, "\r\n\n");
 		return(TRUE);
@@ -1698,5 +1696,5 @@
 */
 
-int cx_go(void)
+int16_t cx_go(void)
 {
 	redo = FALSE;
@@ -1711,12 +1709,12 @@
 		if (p_ba0) {
 
-			if (*p_ba0 NE (UWORD16)BPINST) {
+			if (*p_ba0 NE (uint16_t)BPINST) {
 
 				writeln(cmdunit, "\r\n\n** Breakpoint 0 at ");
-				puthn((long)p_ba0, 8, cmdunit);
+				puthn((int32_t)p_ba0, 8, cmdunit);
 				writeln(cmdunit, " was ");
-				puthn(0xFFFFL & (long)(*p_ba0), 4, cmdunit);
+				puthn(0xFFFFL & (int32_t)(*p_ba0), 4, cmdunit);
 				writeln(cmdunit, " instead of ");
-				puthn(0xFFFFL & (long)BPINST, 4, cmdunit);
+				puthn(0xFFFFL & (int32_t)BPINST, 4, cmdunit);
 				writeln(cmdunit, " **\r\n\n");
 			}
@@ -1727,5 +1725,5 @@
 		p_ba0 = tba0;
 		p_bv0 = *p_ba0;
-		*p_ba0 = (UWORD16)BPINST;
+		*p_ba0 = (uint16_t)BPINST;
 	}
 
@@ -1738,12 +1736,12 @@
 		if (p_ba1) {
 
-			if (*p_ba1 NE (UWORD16)BPINST) {
+			if (*p_ba1 NE (uint16_t)BPINST) {
 
 				writeln(cmdunit, "\r\n\n** Breakpoint 1 at ");
-				puthn((long)p_ba1, 8, cmdunit);
+				puthn((int32_t)p_ba1, 8, cmdunit);
 				writeln(cmdunit, " was ");
-				puthn(0xFFFFL & (long)(*p_ba1), 4, cmdunit);
+				puthn(0xFFFFL & (int32_t)(*p_ba1), 4, cmdunit);
 				writeln(cmdunit, " instead of ");
-				puthn(0xFFFFL & (long)BPINST, 4, cmdunit);
+				puthn(0xFFFFL & (int32_t)BPINST, 4, cmdunit);
 				writeln(cmdunit, " **\r\n\n");
 			}
@@ -1754,5 +1752,5 @@
 		p_ba1 = tba1;
 		p_bv1 = *p_ba1;
-		*p_ba1 = (UWORD16)BPINST;
+		*p_ba1 = (uint16_t)BPINST;
 	}
 
@@ -1770,5 +1768,5 @@
 */
 
-int cp_dump(void)
+int16_t cp_dump(void)
 {
 	inext = ilast;
@@ -1831,5 +1829,5 @@
 */
 
-int cp_fill(void)
+int16_t cp_fill(void)
 {
 	redo = FALSE;
@@ -1863,5 +1861,5 @@
 */
 
-int cp_wfil(void)
+int16_t cp_wfil(void)
 {
 	redo = FALSE;
@@ -1879,5 +1877,5 @@
 			return(FALSE);
 
-	if ((long)p_from & 1L)
+	if ((int32_t)p_from & 1L)
 		return(FALSE);
 
@@ -1898,5 +1896,5 @@
 */
 
-int cp_copy(void)
+int16_t cp_copy(void)
 {
 	redo = FALSE;
@@ -1926,5 +1924,5 @@
 */
 
-int cp_chek(void)
+int16_t cp_chek(void)
 {
 	redo = FALSE;
@@ -1951,5 +1949,5 @@
 */
 
-int cp_read(void)
+int16_t cp_read(void)
 {
 	redo = FALSE;
@@ -1970,5 +1968,5 @@
 		return(FALSE);
 
-	if ((~0xFFFFL) & (long)p_from)
+	if ((~0xFFFFL) & (int32_t)p_from)
 		return(FALSE);
 
@@ -1982,5 +1980,5 @@
 */
 
-int cp_null(void)
+int16_t cp_null(void)
 {
 	return(TRUE);
@@ -1997,7 +1995,7 @@
 */
 
-int cp_rset(void)
-{
-	int	rc;
+int16_t cp_rset(void)
+{
+	int16_t	rc;
 
 	rc = 0;
@@ -2031,8 +2029,8 @@
 */
 
-int cx_chek(void)
-{
-	register long csum;
-	register char *cp;
+int16_t cx_chek(void)
+{
+	register int32_t csum;
+	register int8_t *cp;
 
 	redo = FALSE;
@@ -2057,5 +2055,5 @@
 */
 
-int cx_rset(void)
+int16_t cx_rset(void)
 {
 	redo = FALSE;
@@ -2072,5 +2070,5 @@
 	if (rnum < 17) {	/* a0..a7 -- address register */
 
-		regptr->a_reg[rnum-9] = (char *)p_value;
+		regptr->a_reg[rnum-9] = (int8_t *)p_value;
 		return(TRUE);
 	}
@@ -2085,5 +2083,5 @@
 			return(FALSE);
 
-		regptr->reg_sr = (UWORD16)p_value;
+		regptr->reg_sr = (uint16_t)p_value;
 		return(TRUE);
 	}
@@ -2094,5 +2092,5 @@
 			return(FALSE);
 
-		regptr->reg_pc = (char *)p_value;
+		regptr->reg_pc = (int8_t *)p_value;
 		return(TRUE);
 	}
@@ -2103,5 +2101,5 @@
 			return(FALSE);
 
-		regptr->a_reg[7] = (char *)p_value;
+		regptr->a_reg[7] = (int8_t *)p_value;
 		return(TRUE);
 	}
@@ -2120,7 +2118,7 @@
 */
 
-int cp_vrst(void)
-{
-	int	rc;
+int16_t cp_vrst(void)
+{
+	int16_t	rc;
 
 	rc = 0;
@@ -2178,5 +2176,5 @@
 */
 
-int cx_vrst(void)
+int16_t cx_vrst(void)
 {
 	redo = FALSE;
@@ -2217,8 +2215,8 @@
 */
 
-int cx_vreg(void)
-{
-	register int	i, j, k, l;
-	register unsigned *rp;
+int16_t cx_vreg(void)
+{
+	register int16_t	i, j, k, l;
+	register uint16_t *rp;
 
 	rp = &v_regs[0];
@@ -2232,7 +2230,7 @@
 
 				writeln(cmdunit, "  ");
-				putn((long)l++, 2, cmdunit);
+				putn((int32_t)l++, 2, cmdunit);
 				writeln(cmdunit, ":");
-				puthn((long)*rp++, 4, cmdunit);
+				puthn((int32_t)*rp++, 4, cmdunit);
 			}
 
@@ -2256,9 +2254,9 @@
 */
 
-int do_srec(char *line)
-{
-	register char *ldadr;
-	register int c, csum, i, len;
-	register unsigned val;
+int16_t do_srec(int8_t *line)
+{
+	register int8_t *ldadr;
+	register int16_t c, csum, i, len;
+	register uint16_t val;
 
 	if ('S' NE (c = *line++))
@@ -2282,5 +2280,5 @@
 
 		csum += (len & 0xFF);
-		ldadr = (char *)0;
+		ldadr = (int8_t *)0;
 		len -= 4;
 
@@ -2297,5 +2295,5 @@
 				return(-3);
 
-			ldadr = (char *)(((long)ldadr << 8) + (long)val);
+			ldadr = (int8_t *)(((int32_t)ldadr << 8) + (int32_t)val);
 			csum += (val & 0xFF);
 		}
@@ -2364,7 +2362,7 @@
 */
 
-int cx_load(void)
-{
-	register int rc;
+int16_t cx_load(void)
+{
+	register int16_t rc;
 
 	do {
@@ -2383,5 +2381,5 @@
 				writeln(cmdunit, NACK);
 				writeln(cmdunit, "** Load error ");
-				putn((long)rc, 3, cmdunit);
+				putn((int32_t)rc, 3, cmdunit);
 				writeln(cmdunit, " **\r\n\n");
 				return(FALSE);
@@ -2428,8 +2426,8 @@
 */
 
-int cx_fill(void)
-{
-	register char *cp = p_from;
-	register long count;
+int16_t cx_fill(void)
+{
+	register int8_t *cp = p_from;
+	register int32_t count;
 
 	redo = FALSE;
@@ -2437,10 +2435,10 @@
 	for (count = p_len; count > 0L; count--) {
 
-		*cp = (char)(0xFFL & p_value);
-
-		if (*cp NE (char)(0xFFL & p_value)) {
+		*cp = (int8_t)(0xFFL & p_value);
+
+		if (*cp NE (int8_t)(0xFFL & p_value)) {
 
 			writeln(cmdunit, "\r\n** FILL failed at ");
-			puthn((long)cp, 8, cmdunit);
+			puthn((int32_t)cp, 8, cmdunit);
 			writeln(cmdunit, " **\r\n");
 			return(FALSE);
@@ -2463,13 +2461,13 @@
 */
 
-int cx_wfil(void)
-{
-	register UWORD16 *cp = (UWORD16 *)p_from;
-	register long count;
+int16_t cx_wfil(void)
+{
+	register uint16_t *cp = (uint16_t *)p_from;
+	register int32_t count;
 
 	redo = FALSE;
 
 	for (count = p_len; count > 0L; count--)
-		*cp++ = (UWORD16)(0xFFFFL & p_value);
+		*cp++ = (uint16_t)(0xFFFFL & p_value);
 
 	return(TRUE);
@@ -2486,9 +2484,9 @@
 */
 
-int cx_copy(void)
-{
-	register char	*from = p_from,
+int16_t cx_copy(void)
+{
+	register int8_t	*from = p_from,
 			*to = p_to;
-	register long	count = p_len;
+	register int32_t	count = p_len;
 
 	redo = FALSE;
@@ -2508,11 +2506,11 @@
 
 				writeln(cmdunit, "\r\n** COPY failed from ");
-				puthn((long)from, 8, cmdunit);
+				puthn((int32_t)from, 8, cmdunit);
 				writeln(cmdunit, " to ");
-				puthn((long)to, 8, cmdunit);
+				puthn((int32_t)to, 8, cmdunit);
 				writeln(cmdunit, " with (from) = ");
-				puthn((long)(*from), 2, cmdunit);
+				puthn((int32_t)(*from), 2, cmdunit);
 				writeln(cmdunit, " and (to) = ");
-				puthn((long)(*to), 2, cmdunit);
+				puthn((int32_t)(*to), 2, cmdunit);
 				writeln(cmdunit, " **\r\n");
 				return(FALSE);
@@ -2533,11 +2531,11 @@
 
 				writeln(cmdunit, "\r\n** COPY failed from ");
-				puthn((long)from, 8, cmdunit);
+				puthn((int32_t)from, 8, cmdunit);
 				writeln(cmdunit, " to ");
-				puthn((long)to, 8, cmdunit);
+				puthn((int32_t)to, 8, cmdunit);
 				writeln(cmdunit, " with (from) = ");
-				puthn((long)(*from), 2, cmdunit);
+				puthn((int32_t)(*from), 2, cmdunit);
 				writeln(cmdunit, " and (to) = ");
-				puthn((long)(*to), 2, cmdunit);
+				puthn((int32_t)(*to), 2, cmdunit);
 				writeln(cmdunit, " **\r\n");
 				return(FALSE);
@@ -2562,12 +2560,12 @@
 */
 
-int cx_dump(void)
-{
-	register int	nw, rc;
+int16_t cx_dump(void)
+{
+	register int16_t	nw, rc;
 
 	redo= TRUE;
 	d_cur = p_from;
 	d_next = p_to + 1;
-	d_last = ((long)p_to - (long)p_from) + d_next;
+	d_last = ((int32_t)p_to - (int32_t)p_from) + d_next;
 	nw = p_width;
 	rc = TRUE;
@@ -2612,9 +2610,9 @@
 */
 
-int wdump(UWORD16 *loc, UWORD16 *lastloc, int nwide, int unit)
+int16_t wdump(uint16_t *loc, uint16_t *lastloc, int16_t nwide, int16_t unit)
 {
 	while (nwide--) {
 
-		puthn((long)(0xFFFFL & *loc), 4, unit);
+		puthn((int32_t)(0xFFFFL & *loc), 4, unit);
 		BIOS(B_PUTC,unit, ' ');
 
@@ -2644,5 +2642,5 @@
 */
 
-int ldump(long *loc, long *lastloc, int nwide, int unit)
+int16_t ldump(int32_t *loc, int32_t *lastloc, int16_t nwide, int16_t unit)
 {
 	while (nwide--) {
@@ -2676,5 +2674,5 @@
 */
 
-int cp_wdmp(void)
+int16_t cp_wdmp(void)
 {
 	inext = ilast;
@@ -2687,5 +2685,5 @@
 		}
 
-	if ((long)p_from & 1L) {
+	if ((int32_t)p_from & 1L) {
 
 		redo = FALSE;
@@ -2708,5 +2706,5 @@
 		}
 
-	if ((long)p_to & 1L) {
+	if ((int32_t)p_to & 1L) {
 
 		redo = FALSE;
@@ -2742,5 +2740,5 @@
 */
 
-int cp_ldmp(void)
+int16_t cp_ldmp(void)
 {
 	inext = ilast;
@@ -2753,5 +2751,5 @@
 		}
 
-	if ((long)p_from & 1L) {
+	if ((int32_t)p_from & 1L) {
 
 		redo = FALSE;
@@ -2774,5 +2772,5 @@
 		}
 
-	if ((long)p_to & 1L) {
+	if ((int32_t)p_to & 1L) {
 
 		redo = FALSE;
@@ -2808,7 +2806,7 @@
 */
 
-int cp_ilev(void)
-{
-	long	iplevl;
+int16_t cp_ilev(void)
+{
+	int32_t	iplevl;
 
 	if (argsep EQ A_CR OR argsep EQ '\0')
@@ -2833,5 +2831,5 @@
 */
 
-int cx_ilev(void)
+int16_t cx_ilev(void)
 {
 	if (-1 EQ setipl(iplev)) {
@@ -2855,5 +2853,5 @@
 */
 
-int cp_monc(void)
+int16_t cp_monc(void)
 {
 	if (getarg())
@@ -2872,5 +2870,5 @@
 */
 
-int cp_mons(void)
+int16_t cp_mons(void)
 {
 	if (getarg())
@@ -2893,5 +2891,5 @@
 */
 
-int cp_monl(void)
+int16_t cp_monl(void)
 {
 	if (getarg())
@@ -2914,9 +2912,9 @@
 */
 
-int cx_mon(void)
-{
-	register char vc, vcc;
-	register short vs, vss, *vsp;
-	register long vl, vll, *vlp;
+int16_t cx_mon(void)
+{
+	register int8_t vc, vcc;
+	register int16_t vs, vss, *vsp;
+	register int32_t vl, vll, *vlp;
 
 	switch (monsw) {
@@ -2925,5 +2923,5 @@
 
 		vc = *monptr & 0x0FF;
-		puthn((long)vc, 2, cmdunit);
+		puthn((int32_t)vc, 2, cmdunit);
 		writeln(cmdunit, "\r\n");
 
@@ -2935,5 +2933,5 @@
 
 				vc = vcc;
-				puthn((long)vc, 2, cmdunit);
+				puthn((int32_t)vc, 2, cmdunit);
 				writeln(cmdunit, "\r\n");
 			}
@@ -2945,7 +2943,7 @@
 	case MON_S:
 
-		vsp = (short *)monptr;
+		vsp = (int16_t *)monptr;
 		vs = *vsp;
-		puthn((long)vs, 4, cmdunit);
+		puthn((int32_t)vs, 4, cmdunit);
 		writeln(cmdunit, "\r\n");
 
@@ -2957,5 +2955,5 @@
 
 				vs = vss;
-				puthn((long)vs, 4, cmdunit);
+				puthn((int32_t)vs, 4, cmdunit);
 				writeln(cmdunit, "\r\n");
 			}
@@ -2970,5 +2968,5 @@
 	case MON_L:
 
-		vlp = (long *)monptr;
+		vlp = (int32_t *)monptr;
 		vl = *vlp;
 		puthn(vl, 8, cmdunit);
@@ -3005,11 +3003,11 @@
 */
 
-int cx_wdmp(void)
-{
-	int	nw, rc;
+int16_t cx_wdmp(void)
+{
+	int16_t	nw, rc;
 
 	d_cur = p_from;
 	d_next = p_to + 2;
-	d_last = ((long)p_to - (long)p_from) + d_next;
+	d_last = ((int32_t)p_to - (int32_t)p_from) + d_next;
 	nw = p_width;
 	rc = TRUE;
@@ -3048,11 +3046,11 @@
 */
 
-int cx_ldmp(void)
-{
-	int	nw, rc;
+int16_t cx_ldmp(void)
+{
+	int16_t	nw, rc;
 
 	d_cur = p_from;
 	d_next = p_to + 4;
-	d_last = ((long)p_to - (long)p_from) + d_next;
+	d_last = ((int32_t)p_to - (int32_t)p_from) + d_next;
 	nw = p_width;
 	rc = TRUE;
@@ -3093,5 +3091,5 @@
 void do_cmd(void)
 {
-	int	rc, i;
+	int16_t	rc, i;
 
 	/* prompt for a command line */
@@ -3188,5 +3186,5 @@
 */
 
-int cx_next(void)
+int16_t cx_next(void)
 {
 	p_to = d_last;	
@@ -3205,11 +3203,11 @@
 */
 
-int cx_read(void)
-{
-	long	rc;
-	int	ns, recno;
+int16_t cx_read(void)
+{
+	int32_t	rc;
+	int16_t	ns, recno;
 
 	ns = p_len & 0x7FFFL;
-	recno = (long)p_from & 0xFFFFL;
+	recno = (int32_t)p_from & 0xFFFFL;
 
 	rc = BIOS(B_RDWR, 2, p_to, ns, recno, 0);
@@ -3238,11 +3236,11 @@
 */
 
-int cx_writ(void)
-{
-	long	rc;
-	int	ns, recno;
+int16_t cx_writ(void)
+{
+	int32_t	rc;
+	int16_t	ns, recno;
 
 	ns = p_len & 0x7FFFL;
-	recno = (long)p_from & 0xFFFFL;
+	recno = (int32_t)p_from & 0xFFFFL;
 
 	rc = BIOS(B_RDWR, 3, p_to, ns, recno, 0);
@@ -3273,6 +3271,6 @@
 void showrs(struct regs *rp)
 {
-	int	i;
-	UWORD16	srtemp;
+	int16_t	i;
+	uint16_t	srtemp;
 
 	writeln(cmdunit, "       ");
@@ -3302,9 +3300,9 @@
 
 	writeln(cmdunit, "\r\nPC =  ");
-	puthn((long)rp->reg_pc, 8, cmdunit);
+	puthn((int32_t)rp->reg_pc, 8, cmdunit);
 
 	srtemp = rp->reg_sr;
 	writeln(cmdunit, ",    SR = ");
-	puthn( (long)srtemp & 0xFFFFL, 4, cmdunit);
+	puthn( (int32_t)srtemp & 0xFFFFL, 4, cmdunit);
 
 /* 
@@ -3313,5 +3311,5 @@
 
 	writeln(cmdunit, "  (IPL = ");
-	puthn( (long)(srtemp >> 8) & 0x7L, 1, cmdunit);
+	puthn( (int32_t)(srtemp >> 8) & 0x7L, 1, cmdunit);
 	writeln(cmdunit, ", ");
 
@@ -3368,7 +3366,7 @@
 void showcr(void)
 {
-	register int	i;
-	register char	*cause;
-	register UWORD16	srtemp;
+	register int16_t	i;
+	register int8_t	*cause;
+	register uint16_t	srtemp;
 
 	writeln(cmdunit, "BIOS Crash Area Dump\r\n");
@@ -3399,9 +3397,9 @@
 
 	writeln(cmdunit, "\r\n\nPC =  ");
-	puthn((long)crshpc, 8, cmdunit);
+	puthn((int32_t)crshpc, 8, cmdunit);
 
 	srtemp = crshsr;
 	writeln(cmdunit, ",    SR = ");
-	puthn((long)srtemp & 0xFFFFL, 4, cmdunit);
+	puthn((int32_t)srtemp & 0xFFFFL, 4, cmdunit);
 
 /* 
@@ -3410,5 +3408,5 @@
 
 	writeln(cmdunit, "  (IPL = ");
-	puthn((long)(srtemp >> 8) & 0x7L, 1, cmdunit);
+	puthn((int32_t)(srtemp >> 8) & 0x7L, 1, cmdunit);
 	writeln(cmdunit, ", ");
 
@@ -3456,5 +3454,5 @@
 */
 	writeln(cmdunit, "TRAP vector number = ");
-	putn((long)crshvc[0], 2, cmdunit);
+	putn((int32_t)crshvc[0], 2, cmdunit);
 
 	cause = "  (no handler for interrupt)";
@@ -3573,5 +3571,5 @@
 */
 
-int cx_crsh(void)
+int16_t cx_crsh(void)
 {
 	if (!wzcrsh)
@@ -3593,11 +3591,11 @@
 */
 
-int bphit(void)
-{
-	int	rc;
+int16_t bphit(void)
+{
+	int16_t	rc;
 
 	rc = FALSE;
 
-	if ((char *)p_ba0 EQ regptr->reg_pc) {
+	if ((int8_t *)p_ba0 EQ regptr->reg_pc) {
 
 		if (*p_ba0 EQ BPINST) {
@@ -3613,7 +3611,7 @@
 			puthn(p_ba0, 8 , cmdunit);
 			writeln(cmdunit, " was ");
-			puthn(0xFFFFL & (long)(*p_ba0), 4, cmdunit);
+			puthn(0xFFFFL & (int32_t)(*p_ba0), 4, cmdunit);
 			writeln(cmdunit, " instead of ");
-			puthn((long)BPINST, 4, cmdunit);
+			puthn((int32_t)BPINST, 4, cmdunit);
 			writeln(cmdunit, " **\r\n\n");
 			rc = TRUE;
@@ -3625,5 +3623,5 @@
 */
 
-	if ((char *)p_ba1 EQ regptr->reg_pc) {
+	if ((int8_t *)p_ba1 EQ regptr->reg_pc) {
 
 		if (*p_ba1 EQ BPINST) {
@@ -3637,9 +3635,9 @@
 
 			writeln(cmdunit, "** Breakpoint word at ");
-			puthn((long)p_ba0, 8 , cmdunit);
+			puthn((int32_t)p_ba0, 8 , cmdunit);
 			writeln(cmdunit, " was ");
-			puthn(0xFFFFL & (long)(*p_ba1), 4, cmdunit);
+			puthn(0xFFFFL & (int32_t)(*p_ba1), 4, cmdunit);
 			writeln(cmdunit, " instead of ");
-			puthn((long)BPINST, 4, cmdunit);
+			puthn((int32_t)BPINST, 4, cmdunit);
 			writeln(cmdunit, " **\r\n\n");
 			rc = TRUE;
@@ -3663,7 +3661,7 @@
 			puthn(p_ba0, 8 , cmdunit);
 			writeln(cmdunit, " was ");
-			puthn(0xFFFFL & (long)(*p_ba0), 4, cmdunit);
+			puthn(0xFFFFL & (int32_t)(*p_ba0), 4, cmdunit);
 			writeln(cmdunit, " instead of ");
-			puthn((long)BPINST, 4, cmdunit);
+			puthn((int32_t)BPINST, 4, cmdunit);
 			writeln(cmdunit, " **\r\n\n");
 			rc = TRUE;
@@ -3687,9 +3685,9 @@
 
 			writeln(cmdunit, "** Breakpoint word at ");
-			puthn((long)p_ba0, 8 , cmdunit);
+			puthn((int32_t)p_ba0, 8 , cmdunit);
 			writeln(cmdunit, " was ");
-			puthn(0xFFFFL & (long)(*p_ba1), 4, cmdunit);
+			puthn(0xFFFFL & (int32_t)(*p_ba1), 4, cmdunit);
 			writeln(cmdunit, " instead of ");
-			puthn((long)BPINST, 4, cmdunit);
+			puthn((int32_t)BPINST, 4, cmdunit);
 			writeln(cmdunit, " **\r\n\n");
 			rc = TRUE;
@@ -3714,5 +3712,5 @@
 */
 
-int cx_regs(void)
+int16_t cx_regs(void)
 {
 	showrs(regptr);
@@ -3730,7 +3728,7 @@
 */
 
-void rompbp(long d0, long d1, long d2, long d3, long d4, long d5, long d6, long d7, char *a0, char *a1, char *a2, char *a3, char *a4, char *a5, char *a6, char *a7, char *pc, UWORD16 sr0, UWORD16 sr)
-{
-	register int i;
+void rompbp(int32_t d0, int32_t d1, int32_t d2, int32_t d3, int32_t d4, int32_t d5, int32_t d6, int32_t d7, int8_t *a0, int8_t *a1, int8_t *a2, int8_t *a3, int8_t *a4, int8_t *a5, int8_t *a6, int8_t *a7, int8_t *pc, uint16_t sr0, uint16_t sr)
+{
+	register int16_t i;
 
 	regptr = (struct regs *)&d0;	/* make registers accessable */
@@ -3746,5 +3744,5 @@
 
 		for (i = 0; i < 7; i++)		/* clear a0..a6 */
-			regptr->a_reg[i] = (char *)0L;
+			regptr->a_reg[i] = (int8_t *)0L;
 
 		regptr->a_reg[7] = ISTACK;	/* setup initial stack */
@@ -3788,5 +3786,5 @@
 void progid(void)
 {
-	register char *pcptr;
+	register int8_t *pcptr;
 
 #if	TINYMSG
@@ -3810,8 +3808,8 @@
 
 	writeln(cmdunit, "\r\n  BIOS Version ");
-	pcptr = (char *)PRM_VERS;
-	putn((long)*pcptr++, 2, cmdunit);
+	pcptr = (int8_t *)PRM_VERS;
+	putn((int32_t)*pcptr++, 2, cmdunit);
 	BIOS(B_PUTC, cmdunit, '.');
-	putn((long)*pcptr++, 2, cmdunit);
+	putn((int32_t)*pcptr++, 2, cmdunit);
 	writeln(cmdunit, promdate);
 
@@ -3832,7 +3830,7 @@
 */
 
-short pclr(void)
-{
-	register short i;
+int16_t pclr(void)
+{
+	register int16_t i;
 
 	ftimer = FIFOLIM;
@@ -3872,7 +3870,7 @@
 */
 
-short pscan(void)
-{
-	register short i, c;
+int16_t pscan(void)
+{
+	register int16_t i, c;
 
 	if (0 EQ ledcntr--) {
@@ -3976,10 +3974,10 @@
 void main(void)
 {
-	register short i;
-	register char *pdptr, *pcptr;
+	register int16_t i;
+	register int8_t *pdptr, *pcptr;
 
 	/* unpack PROM date */
 
-	pcptr = (char *)PRM_DATE;	/* prom date: yyyymmdd */
+	pcptr = (int8_t *)PRM_DATE;	/* prom date: yyyymmdd */
 	pdptr = promdate;		/*  -- yyyy-mm-dd */
 	*pdptr++ = ' ';
@@ -4017,5 +4015,5 @@
 	b1flag = FALSE;
 
-	p_goto  = (char *)ROMADDR;
+	p_goto  = (int8_t *)ROMADDR;
 	p_len   = 0L;
 	p_width = 16L;
@@ -4047,5 +4045,5 @@
 
 	sprintf(idbuf, "BIOS Version %02d.%02d%s",
-		*(char *)PRM_VERS, *(char *)(PRM_VERS+1), promdate);
+		*(int8_t *)PRM_VERS, *(int8_t *)(PRM_VERS+1), promdate);
 	GLCtext(5, 30, idbuf);
 
@@ -4054,5 +4052,5 @@
 	GLCcrc(0, 0);
 
-	(char *)BIOS(B_SETV, 47, trap15);	/* set ROMP trap vec */
+	(int8_t *)BIOS(B_SETV, 47, trap15);	/* set ROMP trap vec */
 
 	for (i = 0; i < 128; i++) {
@@ -4079,5 +4077,5 @@
 	progid();	/* identify the program */
 
-	(char *)BIOS(B_SETV, 47, trap15);	/* set ROMP trap vec */
+	(int8_t *)BIOS(B_SETV, 47, trap15);	/* set ROMP trap vec */
 	writeln(cmdunit, "\r\n\n");
 
