Index: vlib/cg2.c
===================================================================
--- vlib/cg2.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/cg2.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -1,7 +1,8 @@
+
 /* Character generator table -- 12V by 8H */
 
-int	cg_rows = 12;
-
-int	cgtable[12][256] = {
+int16_t	cg_rows = 12;
+
+int16_t	cgtable[12][256] = {
 
 	{	/* Scan line 0 */
Index: vlib/cg3.c
===================================================================
--- vlib/cg3.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/cg3.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -3,7 +3,7 @@
 /* Generated:  1989-11-16  15:40:14 */
 
-/* int	cg_rows = 14; */
-
-int	cg3[14][256] = {
+/* int16_t	cg_rows = 14; */
+
+int16_t	cg3[14][256] = {
 
 	{	/* Scan line 0 */
Index: vlib/glcinit.c
===================================================================
--- vlib/glcinit.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/glcinit.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -63,18 +63,18 @@
 #include "glcdefs.h"
 
-unsigned	lcdbase;	/* LCD graphics base address */
-unsigned	lcdbit;		/* LCD graphics pixel bit mask */
-unsigned	lcdcol;		/* LCD text column */
-unsigned	lcdctl1;	/* LCD display control -- command */
-unsigned	lcdctl2;	/* LCD display control -- data */
-unsigned	lcdcurs;	/* LCD graphics pixel byte address */
-unsigned	lcdrow;		/* LCD text row */
-unsigned	lcdx;		/* LCD graphics x */
-unsigned	lcdy;		/* LCD graphics y */
+uint16_t	lcdbase;	/* LCD graphics base address */
+uint16_t	lcdbit;		/* LCD graphics pixel bit mask */
+uint16_t	lcdcol;		/* LCD text column */
+uint16_t	lcdctl1;	/* LCD display control -- command */
+uint16_t	lcdctl2;	/* LCD display control -- data */
+uint16_t	lcdcurs;	/* LCD graphics pixel byte address */
+uint16_t	lcdrow;		/* LCD text row */
+uint16_t	lcdx;		/* LCD graphics x */
+uint16_t	lcdy;		/* LCD graphics y */
 
 /* GLC initialization values */
 
-char glc_is1[] = { 0x12, 0x05, 0x07, 0x54, 0x58, 0x3F, 0x55, 0x00 };
-char glc_is2[] = { 0x00, 0x00, 0x3F, 0x00, 0x20, 0x3F, 0x00, 0x00 };
+int8_t glc_is1[] = { 0x12, 0x05, 0x07, 0x54, 0x58, 0x3F, 0x55, 0x00 };
+int8_t glc_is2[] = { 0x00, 0x00, 0x3F, 0x00, 0x20, 0x3F, 0x00, 0x00 };
 
 /* 
@@ -89,7 +89,7 @@
 */
 
-void GLCdisp(short dsp, short crs, short blk1, short blk2, short blk3)
-{
-	register short val;
+void GLCdisp(int16_t dsp, int16_t crs, int16_t blk1, int16_t blk2, int16_t blk3)
+{
+	register int16_t val;
 
 	val = ((blk3 & 3) << 6) | ((blk2 & 3) << 4) | ((blk1 & 3) << 2) |
@@ -110,5 +110,5 @@
 */
 
-void GLCcurs(short crs)
+void GLCcurs(int16_t crs)
 {
 	lcdctl2 = (crs & 3) | (lcdctl2 & ~3);
@@ -131,7 +131,7 @@
 void GLCinit(void)
 {
-	register int	i;
-	register long ic;
-	register char *gp;
+	register int16_t	i;
+	register int32_t ic;
+	register int8_t *gp;
 
 	lcdbase = G_PLANE2;	/* set defaults for graphics variables */
@@ -205,7 +205,7 @@
 */
 
-unsigned GLCcrc(unsigned row, unsigned col)
-{
-	unsigned curad;
+uint16_t GLCcrc(uint16_t row, uint16_t col)
+{
+	uint16_t curad;
 
 	curad = col + (row * 85);	/* calculate cursor location */
@@ -235,7 +235,7 @@
 */
 
-unsigned GLCcxy(unsigned x, unsigned y)
-{
-	register unsigned curad, xby6;
+uint16_t GLCcxy(uint16_t x, uint16_t y)
+{
+	register uint16_t curad, xby6;
 
 	/* calculate cursor address */
@@ -277,5 +277,5 @@
 */
 
-void GLCwrts(char *s)
+void GLCwrts(int8_t *s)
 {
 	LCD_WC = G_CRSMRT;	/* set cursor motion =  right */
@@ -304,7 +304,7 @@
 */
 
-void GLCtext(unsigned row, unsigned col, char *s)
-{
-	register unsigned curad;
+void GLCtext(uint16_t row, uint16_t col, int8_t *s)
+{
+	register uint16_t curad;
 
 	curad = col + (row * 85);	/* calculate cursor address */
Index: vlib/lseg.c
===================================================================
--- vlib/lseg.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/lseg.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -7,5 +7,5 @@
 */
 
-void	(*point)(short x, short y, short pen);
+void	(*point)(int16_t x, int16_t y, int16_t pen);
 
 #define	ABS(x)	((x) < 0 ? (-(x)) : (x))
@@ -41,8 +41,8 @@
 */
 
-void lseg(short x1, short y1, short x2, short y2, short t)
+void lseg(int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t t)
 {
-	register short dx, dy, ptx, pty, p;
-	short i, px, py;
+	register int16_t dx, dy, ptx, pty, p;
+	int16_t i, px, py;
 
 	p = x2 - (ptx = x1);
Index: vlib/vbfill4.c
===================================================================
--- vlib/vbfill4.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/vbfill4.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -8,5 +8,5 @@
 */
 
-static short	fm[] = {	/* fill masks */
+static int16_t	fm[] = {	/* fill masks */
 
 	0x000F,
@@ -29,14 +29,14 @@
 */
 
-void vbfill4(unsigned *obj, short obwidth, short xmin, short ymin, short xmax, short ymax, unsigned color)
+void vbfill4(uint16_t *obj, int16_t obwidth, int16_t xmin, int16_t ymin, int16_t xmax, int16_t ymax, uint16_t color)
 {
-	short mw, nl, width;
-
-	register unsigned *fwp, *wp;
-
-	register unsigned lmask, rmask;
-	register short i, j;
-
-	fwp = obj + (long)(xmin >> 2) + ((long)ymin * obwidth);
+	int16_t mw, nl, width;
+
+	register uint16_t *fwp, *wp;
+
+	register uint16_t lmask, rmask;
+	register int16_t i, j;
+
+	fwp = obj + (int32_t)(xmin >> 2) + ((int32_t)ymin * obwidth);
 	width = xmax - xmin + 1;
 	nl = ymax - ymin + 1;
Index: vlib/vclrs.c
===================================================================
--- vlib/vclrs.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/vclrs.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -16,5 +16,5 @@
 */
 
-extern	void	vputc(unsigned *sbase, unsigned row, unsigned col, unsigned c, unsigned attrib);
+extern	void	vputc(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t c, uint16_t attrib);
 
 /*
@@ -24,5 +24,5 @@
 */
 
-void vclrs(unsigned int obase[], int row, int col, int nc, int ch, int atr)
+void vclrs(uint16_t obase[], int16_t row, int16_t col, int16_t nc, int16_t ch, int16_t atr)
 {
 	while (nc--)
Index: vlib/vhinit.c
===================================================================
--- vlib/vhinit.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/vhinit.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -22,6 +22,6 @@
 #define	VREG(h,v)	((h<<10)|v)
 
-extern	int	cgtable[][256];
-extern	int	cg_rows;
+extern	int16_t	cgtable[][256];
+extern	int16_t	cg_rows;
 
 struct octent	v_obtab[16];	/* object control table */
@@ -29,6 +29,6 @@
 struct octent	*v_curob;	/* current v_obtab pointer */
 
-int	v_nobj;			/* current object number */
-int	v_obpri;		/* current object priority */
+int16_t	v_nobj;			/* current object number */
+int16_t	v_obpri;		/* current object priority */
 
 /* 
@@ -37,5 +37,5 @@
 /* initialized variables */
 
-int	vr_data[] = {
+int16_t	vr_data[] = {
 
 	0x825B,		/* R0  -- Mode word 0 */
Index: vlib/vmput.c
===================================================================
--- vlib/vmput.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/vmput.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -19,7 +19,5 @@
 */
 
-typedef	unsigned int	uint;
-
-extern	void	vputc(unsigned *sbase, unsigned row, unsigned col, unsigned c, unsigned attrib);
+extern	void	vputc(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t c, uint16_t attrib);
 
 /*
@@ -30,8 +28,8 @@
 */
 
-void vmput(uint *sbase, uint row, uint col, uint ma, char *ms[])
+void vmput(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t ma, int8_t *ms[])
 {
-	register uint c, tc, tr;
-	char *cp;
+	register uint16_t c, tc, tr;
+	int8_t *cp;
 
 	tr = row;
@@ -58,9 +56,9 @@
 */
 
-void vmputa(uint *sbase, uint row, uint col, uint *ma[], char *ms[])
+void vmputa(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t *ma[], int8_t *ms[])
 {
-	register uint c, tc, tr;
-	uint *tm;
-	char *cp;
+	register uint16_t c, tc, tr;
+	uint16_t *tm;
+	int8_t *cp;
 
 	tr = row;
Index: vlib/vobjfns.c
===================================================================
--- vlib/vobjfns.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/vobjfns.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -60,12 +60,12 @@
 #include "vsddvars.h"
 
-extern	void	vbank(unsigned b);
-extern	void	objon(unsigned obj, unsigned line, unsigned num);
+extern	void	vbank(uint16_t b);
+extern	void	objon(uint16_t obj, uint16_t line, uint16_t num);
 extern	void	VIint(void);
 
-short		wsize;		/* object width calculated by SetObj() */
-short		vi_dis;		/* disable use of VIint */
-
-unsigned	vi_ctl;		/* object unblank control bits */
+int16_t		wsize;		/* object width calculated by SetObj() */
+int16_t		vi_dis;		/* disable use of VIint */
+
+uint16_t	vi_ctl;		/* object unblank control bits */
 
 /* 
@@ -79,8 +79,8 @@
 */
 
-void SelObj(int obj)
+void SelObj(int16_t obj)
 {
 	register struct octent *op;
-	register unsigned newbank;
+	register uint16_t newbank;
 
 	op = &v_obtab[obj];
@@ -109,5 +109,5 @@
 */
 
-void SetPri(int obj, int pri)
+void SetPri(int16_t obj, int16_t pri)
 {
 	register struct octent *op;
@@ -121,5 +121,5 @@
 	v_odtab[pri][0] = op->odtw0 | V_BLA;	/* start object as blanked */
 	v_odtab[pri][1] = op->odtw1;
-	v_odtab[pri][2] = ((long)op->obase >> 1) & 0xFFFF;
+	v_odtab[pri][2] = ((int32_t)op->obase >> 1) & 0xFFFF;
 
 	objon(pri, op->objy, op->ysize);	/* enable access table bits */
@@ -132,5 +132,5 @@
 	vi_ctl |= (1 << pri);			/* set unblank bit */
 
-	if (*((long *)0x000064) NE &VIint)	/* make sure VI vector is set */
+	if (*((int32_t *)0x000064) NE &VIint)	/* make sure VI vector is set */
 		BIOS(B_SETV, 25, VIint);
 
@@ -149,5 +149,5 @@
 */
 
-void SetObj(int obj, int type, int bank, int xpix, int ypix, int x0, int y0, int flags, int pri, unsigned int *base)
+void SetObj(int16_t obj, int16_t type, int16_t bank, int16_t xpix, int16_t ypix, int16_t x0, int16_t y0, int16_t flags, int16_t pri, uint16_t *base)
 {
 	register struct octent *op;
@@ -252,8 +252,8 @@
 */
 
-void CpyObj(unsigned *from, unsigned *to, unsigned w, unsigned h, unsigned sw)
-{
-	register unsigned *tp;
-	register unsigned i, j;
+void CpyObj(uint16_t *from, uint16_t *to, uint16_t w, uint16_t h, uint16_t sw)
+{
+	register uint16_t *tp;
+	register uint16_t i, j;
 
 	for (i = h; i--; ) {
Index: vlib/vputs.c
===================================================================
--- vlib/vputs.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/vputs.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -14,7 +14,5 @@
 #include <stddefs.h>
 
-typedef	unsigned int	uint;
-
-extern	void	vputc(unsigned *sbase, unsigned row, unsigned col, unsigned c, unsigned attrib);
+extern	void	vputc(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t c, uint16_t attrib);
 
 /*
@@ -27,7 +25,7 @@
 */
 
-void vputs(uint *sbase, uint row, uint col, uint attrib, char *str)
+void vputs(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t attrib, int8_t *str)
 {
-	uint	c;
+	uint16_t	c;
 
 	while (c = *str++) {
@@ -57,7 +55,7 @@
 */
 
-void vputsa(uint *sbase, uint row, uint col, uint *attrib, char *str)
+void vputsa(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t *attrib, int8_t *str)
 {
-	uint	c;
+	uint16_t	c;
 
 	while (c = *str++) {
Index: vlib/vputsv.c
===================================================================
--- vlib/vputsv.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/vputsv.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -14,7 +14,5 @@
 #include "stddefs.h"
 
-typedef	unsigned int	uint;
-
-extern	void	vputcv(unsigned *adr, unsigned row, unsigned col, unsigned char, unsigned atr, unsigned cols);
+extern	void	vputcv(uint16_t *adr, uint16_t row, uint16_t col, uint8_t chr, uint16_t atr, uint16_t cols);
 
 /*
@@ -27,7 +25,7 @@
 */
 
-void vputsv(uint *sbase, uint row, uint col, char *str, uint attrib, uint len)
+void vputsv(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *str, uint16_t attrib, uint16_t len)
 {
-	uint	c;
+	uint16_t	c;
 
 	while (c = *str++) {
@@ -58,7 +56,7 @@
 */
 
-void vputsav(uint *sbase, uint row, uint col, char *str, uint *attrib, uint len)
+void vputsav(uint16_t *sbase, uint16_t row, uint16_t col, int8_t *str, uint16_t *attrib, uint16_t len)
 {
-	uint	c;
+	uint16_t	c;
 
 	while (c = *str++) {
Index: vlib/vsetpal.c
===================================================================
--- vlib/vsetpal.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/vsetpal.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -6,7 +6,7 @@
 */
 
-#define	PALETTE		((unsigned *)0x280000L)
+#define	PALETTE		((uint16_t *)0x280000L)
 
-short	dfltpal[16][3] = {
+int16_t	dfltpal[16][3] = {
 
 /*	 R  G  B	  color */
@@ -45,8 +45,8 @@
 */
 
-void vsetpal(unsigned slot, unsigned red, unsigned grn, unsigned blu)
+void vsetpal(uint16_t slot, uint16_t red, uint16_t grn, uint16_t blu)
 {
-	register unsigned palval;
-	unsigned *pal;
+	register uint16_t palval;
+	uint16_t *pal;
 
 	pal = PALETTE;
@@ -79,7 +79,7 @@
 */
 
-void vsndpal(short pp[16][3])
+void vsndpal(int16_t pp[16][3])
 {
-	register short i;
+	register int16_t i;
 
 	for (i = 0; i < 16; i++)
Index: vlib/vspray4.c
===================================================================
--- vlib/vspray4.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/vspray4.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -9,5 +9,5 @@
 #include "vsddsw.h"
 
-static 	char cl[81];
+static 	int8_t cl[81];
 
 /*
@@ -30,8 +30,8 @@
 */
 
-void vspray4(unsigned *vobj, short vwid, short fg, short vb, short pitch, char *ml[])
+void vspray4(uint16_t *vobj, int16_t vwid, int16_t fg, int16_t vb, int16_t pitch, int8_t *ml[])
 {
-	register char *cp, *lp, c;
-	register short j, k, row;
+	register int8_t *cp, *lp, c;
+	register int16_t j, k, row;
 
 	row = 0;
Index: vlib/vtext.c
===================================================================
--- vlib/vtext.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/vtext.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -8,9 +8,9 @@
 */
 
-static int	msk[] = { 0xFF00, 0x00FF };
+static int16_t	msk[] = { 0xFF00, 0x00FF };
 
-void vtext(unsigned *obj, unsigned nc, unsigned row, unsigned col, char *ip)
+void vtext(uint16_t *obj, uint16_t nc, uint16_t row, uint16_t col, int8_t *ip)
 {
-	register unsigned *op;
+	register uint16_t *op;
 
 	while (*ip) {
@@ -18,5 +18,5 @@
 		op = obj + ((nc >> 1) * row) + (col >> 1);
 
-		*op = (*op & (unsigned)msk[col & 1]) |
+		*op = (*op & (uint16_t)msk[col & 1]) |
 		      ((*ip++ & 0x00FF) << ((col & 1) ? 8 : 0));
 
Index: vlib/vwputm.c
===================================================================
--- vlib/vwputm.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ vlib/vwputm.c	(revision 8618599ab825088c720c202c6e50a52572282c0f)
@@ -18,5 +18,5 @@
 #include <vsdd.h>
 
-extern	void	vwputs(int *obase, int nw, int fg, int bg, int row, int col, char *str);
+extern	void	vwputs(int16_t *obase, int16_t nw, int16_t fg, int16_t bg, int16_t row, int16_t col, int8_t *str);
 
 /*
@@ -26,5 +26,5 @@
 */
 
-void vwputm(unsigned int *obase, int nw, int fg, int bg, int row, int col, char *ml[])
+void vwputm(uint16_t *obase, int16_t nw, int16_t fg, int16_t bg, int16_t row, int16_t col, int8_t *ml[])
 {
 	while (*ml) {
