Index: vlib/vbfill4.c
===================================================================
--- vlib/vbfill4.c	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vbfill4.c	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -10,5 +10,5 @@
 #include "ram.h"
 
-static int16_t	fm[] = {	/* fill masks */
+static uint16_t	fm[] = {	/* fill masks */
 
 	0x000F,
@@ -60,21 +60,23 @@
 					wp = fwp;
 					fwp += obwidth;
-					*wp++ = (*wp & ~lmask) | (color & lmask);
-
-					for (j = 0; j < mw; j++)
-						*wp++ = color;
-
-					*wp = (*wp & ~rmask) | (color & rmask);
-				}
-
-			} else {
-
-				rmask = fm[width & 3];
-
-				for (i = 0; i < nl; i++) {
-
-					wp = fwp;
-					fwp += obwidth;
-					*wp++ = (*wp & ~lmask) | (color & lmask);
+					*wp = (*wp & ~lmask) | (color & lmask);
+					wp++;
+
+					for (j = 0; j < mw; j++)
+						*wp++ = color;
+
+					*wp = (*wp & ~rmask) | (color & rmask);
+				}
+
+			} else {
+
+				rmask = fm[width & 3];
+
+				for (i = 0; i < nl; i++) {
+
+					wp = fwp;
+					fwp += obwidth;
+					*wp = (*wp & ~lmask) | (color & lmask);
+					wp++;
 					*wp = (*wp & ~rmask) | (color & rmask);
 				}
@@ -112,21 +114,23 @@
 					wp = fwp;
 					fwp += obwidth;
-					*wp++ = (*wp & ~lmask) | (color & lmask);
-
-					for (j = 0; j < mw; j++)
-						*wp++ = color;
-
-					*wp = (*wp & ~rmask) | (color & rmask);
-				}
-
-			} else {
-
-				rmask = fm[width & 3];
-
-				for (i = 0; i < nl; i++) {
-
-					wp = fwp;
-					fwp += obwidth;
-					*wp++ = (*wp & ~lmask) | (color & lmask);
+					*wp = (*wp & ~lmask) | (color & lmask);
+					wp++;
+
+					for (j = 0; j < mw; j++)
+						*wp++ = color;
+
+					*wp = (*wp & ~rmask) | (color & rmask);
+				}
+
+			} else {
+
+				rmask = fm[width & 3];
+
+				for (i = 0; i < nl; i++) {
+
+					wp = fwp;
+					fwp += obwidth;
+					*wp = (*wp & ~lmask) | (color & lmask);
+					wp++;
 					*wp = (*wp & ~rmask) | (color & rmask);
 				}
@@ -164,21 +168,23 @@
 					wp = fwp;
 					fwp += obwidth;
-					*wp++ = (*wp & ~lmask) | (color & lmask);
-
-					for (j = 0; j < mw; j++)
-						*wp++ = color;
-
-					*wp = (*wp & ~rmask) | (color & rmask);
-				}
-
-			} else {
-
-				rmask = fm[width & 3];
-
-				for (i = 0; i < nl; i++) {
-
-					wp = fwp;
-					fwp += obwidth;
-					*wp++ = (*wp & ~lmask) | (color & lmask);
+					*wp = (*wp & ~lmask) | (color & lmask);
+					wp++;
+
+					for (j = 0; j < mw; j++)
+						*wp++ = color;
+
+					*wp = (*wp & ~rmask) | (color & rmask);
+				}
+
+			} else {
+
+				rmask = fm[width & 3];
+
+				for (i = 0; i < nl; i++) {
+
+					wp = fwp;
+					fwp += obwidth;
+					*wp = (*wp & ~lmask) | (color & lmask);
+					wp++;
 					*wp = (*wp & ~rmask) | (color & rmask);
 				}
@@ -216,5 +222,6 @@
 					wp = fwp;
 					fwp += obwidth;
-					*wp++ = (*wp & ~lmask) | (color & lmask);
+					*wp = (*wp & ~lmask) | (color & lmask);
+					wp++;
 
 					for (j = 0; j < mw; j++)
@@ -232,5 +239,6 @@
 					wp = fwp;
 					fwp += obwidth;
-					*wp++ = (*wp & ~lmask) | (color & lmask);
+					*wp = (*wp & ~lmask) | (color & lmask);
+					wp++;
 					*wp = (*wp & ~rmask) | (color & rmask);
 				}
Index: vlib/vclrs.c
===================================================================
--- vlib/vclrs.c	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vclrs.c	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -6,6 +6,4 @@
 
 	vclrs(obase, row, col, nc, ch, atr)
-	unsigned int obase[];
-	int row, col, nc, ch, atr;
 
 		Clear 'nc' characters in the text object 'obase' to 'ch',
@@ -24,7 +22,7 @@
 */
 
-void vclrs(uint16_t obase[], int16_t row, int16_t col, int16_t nc, int16_t ch, int16_t atr)
+void vclrs(uint16_t *obase, int16_t row, int16_t col, int16_t nc, int16_t ch, uint16_t attr)
 {
 	while (nc--)
-		vputc(obase, row, col++, ch, atr);
+		vputc(obase, row, col++, ch, attr);
 }
Index: vlib/vclrs.x
===================================================================
--- vlib/vclrs.x	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vclrs.x	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -15,3 +15,3 @@
 */
 
-extern	void		vclrs(uint16_t obase[], int16_t row, int16_t col, int16_t nc, int16_t ch, int16_t atr);
+extern	void		vclrs(uint16_t *obase, int16_t row, int16_t col, int16_t nc, int16_t ch, uint16_t attr);
Index: vlib/vmput.c
===================================================================
--- vlib/vmput.c	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vmput.c	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -4,16 +4,4 @@
 	Version 3 -- 1987-03-30 -- D.N. Lynx Crowe
 	(c) Copyright 1987 -- D.N. Lynx Crowe
-
-	vmput(sbase, row, col, ms, ma)
-	uint *sbase, rwo, col, ma;
-	char *ms[];
-
-		Copies lines from ms, with attribute ma, to sbase at (row,col).
-
-	vmputa(sbase, row, col, ms, ma)
-	uint *sbase, row, col, *ma;
-	char *ms[];
-
-		Copies lines from ms, with attributes from ma, to sbase at (row,col).
    =============================================================================
 */
@@ -23,12 +11,12 @@
 /*
    =============================================================================
-	vmput(sbase, row, col, ms, ma) -- put a menu item in a screen image.
-	Copies lines from ms, with attribute ma, to sbase at (row,col).
+	vmput(obase, row, col, ms, ma) -- put a menu item in a screen image.
+	Copies lines from ms, with attribute ma, to obase at (row,col).
    =============================================================================
 */
 
-void vmput(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *ms[], uint16_t ma)
+void vmput(uint16_t *obase, int16_t row, int16_t col, int8_t *ms[], uint16_t ma)
 {
-	register uint16_t c, tc, tr;
+	register int16_t c, tc, tr;
 	int8_t *cp;
 
@@ -40,5 +28,5 @@
 
 		while (c = *cp++)
-			vputc(sbase, tr, tc++, c, ma);
+			vputc(obase, tr, tc++, c, ma);
 
 		tr++;
@@ -48,12 +36,12 @@
 /*
    =============================================================================
-	vmputa(sbase, row, col, ms, ma) -- put a menu item in a screen image.
-	Copies lines from ms, with attributes from ma, to sbase at (row,col).
+	vmputa(obase, row, col, ms, ma) -- put a menu item in a screen image.
+	Copies lines from ms, with attributes from ma, to obase at (row,col).
    =============================================================================
 */
 
-void vmputa(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *ms[], uint16_t *ma[])
+void vmputa(uint16_t *obase, int16_t row, int16_t col, int8_t *ms[], uint16_t *ma[])
 {
-	register uint16_t c, tc, tr;
+	register int16_t c, tc, tr;
 	uint16_t *tm;
 	int8_t *cp;
@@ -67,5 +55,5 @@
 
 		while (c = *cp++)
-			vputc(sbase, tr, tc++, c, *tm++);
+			vputc(obase, tr, tc++, c, *tm++);
 
 		tr++;
Index: vlib/vmput.x
===================================================================
--- vlib/vmput.x	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vmput.x	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -15,4 +15,4 @@
 */
 
-extern	void		vmput(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *ms[], uint16_t ma);
-extern	void		vmputa(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *ms[], uint16_t *ma[]);
+extern	void		vmput(uint16_t *obase, int16_t row, int16_t col, int8_t *ms[], uint16_t ma);
+extern	void		vmputa(uint16_t *obase, int16_t row, int16_t col, int8_t *ms[], uint16_t *ma[]);
Index: vlib/vobjfns.c
===================================================================
--- vlib/vobjfns.c	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vobjfns.c	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -69,5 +69,5 @@
 	op = &v_obtab[obj];
 
-	newbank = ((op->obank & 0x0001) << 8) | ((op->obank & 0x0002) << 6);
+	newbank = ((op->obank & 0x0001u) << 8) | ((op->obank & 0x0002u) << 6);
 
 	v_nobj = obj;
@@ -109,5 +109,5 @@
 	setipl(7);				/* disable interrupts */
 
-	vi_ctl |= (1 << pri);			/* set unblank bit */
+	vi_ctl |= (1u << pri);			/* set unblank bit */
 
 	if (*((int32_t *)0x000064) NE &VIint)	/* make sure VI vector is set */
@@ -124,5 +124,5 @@
 */
 
-void SetObj(int16_t obj, int16_t type, int16_t bank, uint16_t *base, int16_t xpix, int16_t ypix, int16_t x0, int16_t y0, int16_t flags, int16_t pri)
+void SetObj(int16_t obj, int16_t type, int16_t bank, uint16_t *base, int16_t xpix, int16_t ypix, int16_t x0, int16_t y0, uint16_t flags, int16_t pri)
 {
 	register struct octent *op;
@@ -148,5 +148,5 @@
 	if (type) {	/* character objects */
 
-		op->odtw0 = (flags & 0xF9FF) | V_CTYPE;
+		op->odtw0 = (flags & 0xF9FFu) | V_CTYPE;
 
 		switch (V_RES3 & op->odtw0) {
@@ -179,5 +179,5 @@
 	} else {	/* bitmap objects */
 
-		op->odtw0 = (flags & 0x0E37) | (V_BTYPE | ((bank & 3) << 6));
+		op->odtw0 = (flags & 0x0E37u) | (V_BTYPE | (((uint16_t)bank & 3u) << 6));
 
 		switch (V_RES3 & op->odtw0) {
@@ -201,5 +201,5 @@
 	}
 
-	op->odtw1 = ((x0 >> 1) & 0x03FF) | (0xFC00 & (wsize << 10));
+	op->odtw1 = (((uint16_t)x0 >> 1) & 0x03FFu) | (0xFC00u & ((uint16_t)wsize << 10));
 
 	if (pri < 0)
@@ -219,8 +219,8 @@
 */
 
-void CpyObj(uint16_t *from, uint16_t *to, uint16_t w, uint16_t h, uint16_t sw)
+void CpyObj(uint16_t *from, uint16_t *to, int16_t w, int16_t h, int16_t sw)
 {
 	register uint16_t *tp;
-	register uint16_t i, j;
+	register int16_t i, j;
 
 	for (i = h; i--; ) {
Index: vlib/vobjfns.x
===================================================================
--- vlib/vobjfns.x	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vobjfns.x	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -25,6 +25,6 @@
 */
 
-extern	void		CpyObj(uint16_t *from, uint16_t *to, uint16_t w, uint16_t h, uint16_t sw);
+extern	void		CpyObj(uint16_t *from, uint16_t *to, int16_t w, int16_t h, int16_t sw);
 extern	void		SelObj(int16_t obj);
-extern	void		SetObj(int16_t obj, int16_t type, int16_t bank, uint16_t *base, int16_t xpix, int16_t ypix, int16_t x0, int16_t y0, int16_t flags, int16_t pri);
+extern	void		SetObj(int16_t obj, int16_t type, int16_t bank, uint16_t *base, int16_t xpix, int16_t ypix, int16_t x0, int16_t y0, uint16_t flags, int16_t pri);
 extern	void		SetPri(int16_t obj, int16_t pri);
Index: vlib/vputs.c
===================================================================
--- vlib/vputs.c	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vputs.c	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -16,18 +16,18 @@
 /*
    =============================================================================
-	vputs(sbase, row, col, str, attrib)
+	vputs(obase, row, col, str, attrib)
 
-	Write string str to video RAM object pointed to by sbase
-	at (row,col) with attrib used for all characters.
+	Write string str to video RAM object pointed to by obase
+	at (row,col) with attr used for all characters.
    =============================================================================
 */
 
-void vputs(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *str, uint16_t attrib)
+void vputs(uint16_t *obase, int16_t row, int16_t col, int8_t *str, uint16_t attr)
 {
-	uint16_t	c;
+	int16_t	c;
 
 	while (c = *str++) {
 
-		vputc(sbase, row, col, c, attrib);
+		vputc(obase, row, col, c, attr);
 
 		if (++col GE 64) {
@@ -43,18 +43,18 @@
 /*
    =============================================================================
-	vputsa(sbase, row, col, str, attrib)
+	vputsa(obase, row, col, str, attrib)
 
-	Write string str in video RAM pointed to by sbase starting
-	at (row, col) using attributes from the words pointed to by attrib.
+	Write string str in video RAM pointed to by obase starting
+	at (row, col) using attributes from the words pointed to by attr.
    =============================================================================
 */
 
-void vputsa(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *str, uint16_t *attrib)
+void vputsa(uint16_t *obase, int16_t row, int16_t col, int8_t *str, uint16_t *attr)
 {
-	uint16_t	c;
+	int16_t	c;
 
 	while (c = *str++) {
 
-		vputc(sbase, row, col, c, *attrib++);
+		vputc(obase, row, col, c, *attr++);
 
 		if (++col GE 64) {
Index: vlib/vputs.x
===================================================================
--- vlib/vputs.x	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vputs.x	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -15,4 +15,4 @@
 */
 
-extern	void		vputs(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *str, uint16_t attrib);
-extern	void		vputsa(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *str, uint16_t *attrib);
+extern	void		vputs(uint16_t *obase, int16_t row, int16_t col, int8_t *str, uint16_t attr);
+extern	void		vputsa(uint16_t *obase, int16_t row, int16_t col, int8_t *str, uint16_t *attr);
Index: vlib/vputsv.c
===================================================================
--- vlib/vputsv.c	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vputsv.c	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -16,18 +16,18 @@
 /*
    =============================================================================
-	vputsv(sbase, row, col, str, attrib, len)
+	vputsv(obase, row, col, str, attr, len)
 
-	Write string str to video RAM object pointed to by sbase
-	at (row,col) with attrib used for all characters. Line length is len.
+	Write string str to video RAM object pointed to by obase
+	at (row,col) with attr used for all characters. Line length is len.
    =============================================================================
 */
 
-void vputsv(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *str, uint16_t attrib, uint16_t len)
+void vputsv(uint16_t *obase, int16_t row, int16_t col, int8_t *str, uint16_t attr, int16_t len)
 {
-	uint16_t	c;
+	int16_t	c;
 
 	while (c = *str++) {
 
-		vputcv(sbase, row, col, c, attrib, len);
+		vputcv(obase, row, col, c, attr, len);
 
 		if (++col GE 64) {
@@ -43,19 +43,19 @@
 /*
    =============================================================================
-	vputsav(sbase, row, col, str, attrib, len)
+	vputsav(obase, row, col, str, attr, len)
 
-	Write string str in video RAM pointed to by sbase starting
-	at (row, col) using attributes from the words pointed to by attrib.
+	Write string str in video RAM pointed to by obase starting
+	at (row, col) using attributes from the words pointed to by attr.
 	Line length is len.
    =============================================================================
 */
 
-void vputsav(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *str, uint16_t *attrib, uint16_t len)
+void vputsav(uint16_t *obase, int16_t row, int16_t col, int8_t *str, uint16_t *attr, int16_t len)
 {
-	uint16_t	c;
+	int16_t	c;
 
 	while (c = *str++) {
 
-		vputcv(sbase, row, col, c, *attrib++, len);
+		vputcv(obase, row, col, c, *attr++, len);
 
 		if (++col GE 64) {
Index: vlib/vputsv.x
===================================================================
--- vlib/vputsv.x	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vputsv.x	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -15,4 +15,4 @@
 */
 
-extern	void		vputsav(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *str, uint16_t *attrib, uint16_t len);
-extern	void		vputsv(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *str, uint16_t attrib, uint16_t len);
+extern	void		vputsav(uint16_t *obase, int16_t row, int16_t col, int8_t *str, uint16_t *attr, int16_t len);
+extern	void		vputsv(uint16_t *obase, int16_t row, int16_t col, int8_t *str, uint16_t attr, int16_t len);
Index: vlib/vsetpal.c
===================================================================
--- vlib/vsetpal.c	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vsetpal.c	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -43,7 +43,7 @@
 */
 
-void vsetpal(uint16_t slot, uint16_t red, uint16_t grn, uint16_t blu)
+void vsetpal(int16_t slot, int16_t red, int16_t grn, int16_t blu)
 {
-	register uint16_t palval;
+	register int16_t palval;
 	uint16_t *pal;
 
@@ -55,5 +55,5 @@
 		 ((blu & 1) << 3) | ((blu & 2) >> 1);
 
-	*pal = palval ^ 0x003F;
+	*pal = (uint16_t)palval ^ 0x003F;
 }
 
Index: vlib/vsetpal.x
===================================================================
--- vlib/vsetpal.x	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vsetpal.x	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -23,4 +23,4 @@
 */
 
-extern	void		vsetpal(uint16_t slot, uint16_t red, uint16_t grn, uint16_t blu);
+extern	void		vsetpal(int16_t slot, int16_t red, int16_t grn, int16_t blu);
 extern	void		vsndpal(int16_t pp[16][3]);
Index: vlib/vtext.c
===================================================================
--- vlib/vtext.c	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vtext.c	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -10,7 +10,7 @@
 #include "ram.h"
 
-static int16_t	msk[] = { 0xFF00, 0x00FF };
+static uint16_t	msk[] = { 0xFF00, 0x00FF };
 
-void vtext(uint16_t *obj, uint16_t nc, uint16_t row, uint16_t col, int8_t *ip)
+void vtext(uint16_t *obj, int16_t nc, int16_t row, int16_t col, int8_t *ip)
 {
 	register uint16_t *op;
@@ -20,6 +20,6 @@
 		op = obj + ((nc >> 1) * row) + (col >> 1);
 
-		*op = (*op & (uint16_t)msk[col & 1]) |
-		      ((*ip++ & 0x00FF) << ((col & 1) ? 8 : 0));
+		*op = (*op & msk[col & 1]) |
+		      ((uint16_t)(*ip++ & 0x00FF) << ((col & 1) ? 8 : 0));
 
 		col++;
Index: vlib/vtext.x
===================================================================
--- vlib/vtext.x	(revision fa3880436faee3a802167a6643a177727fdf94ea)
+++ vlib/vtext.x	(revision 09d13458eaf73781ea49a7ff93d5b5297fa74f9b)
@@ -15,3 +15,3 @@
 */
 
-extern	void		vtext(uint16_t *obj, uint16_t nc, uint16_t row, uint16_t col, int8_t *ip);
+extern	void		vtext(uint16_t *obj, int16_t nc, int16_t row, int16_t col, int8_t *ip);
