Index: include/asgdsp.h
===================================================================
--- include/asgdsp.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/asgdsp.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -10,21 +10,21 @@
 struct	asgent	{	/* assignment table library entry structure */
 
-	short	a_mop;			/* MIDI output port */
-	short	a_tun;			/* tuning table number */
+	int16_t	a_mop;			/* MIDI output port */
+	int16_t	a_tun;			/* tuning table number */
 
-	short	a_aux;			/* auxiliary control state */
-	short	a_intn;			/* intensity */
-	short	a_rate;			/* rate */
-	short	a_dpth;			/* depth */
+	int16_t	a_aux;			/* auxiliary control state */
+	int16_t	a_intn;			/* intensity */
+	int16_t	a_rate;			/* rate */
+	int16_t	a_dpth;			/* depth */
 
-	short	a_i2grp[12];		/* instrument to group table */
-	short	a_gpdyn[12];		/* group dynamics table */
+	int16_t	a_i2grp[12];		/* instrument to group table */
+	int16_t	a_gpdyn[12];		/* group dynamics table */
 
-	short	a_v2grp[12];		/* voice to group table */
-	short	a_mctln[4];		/* MIDI controller number table */
-	short	a_g2prt[12][2];		/* group to port and channel table */
-	short	a_k2grp[88];		/* port 1 key to group assigment table */
+	int16_t	a_v2grp[12];		/* voice to group table */
+	int16_t	a_mctln[4];		/* MIDI controller number table */
+	int16_t	a_g2prt[12][2];		/* group to port and channel table */
+	int16_t	a_k2grp[88];		/* port 1 key to group assigment table */
 
-	char	a_name[16];		/* assignment table name */
+	int8_t	a_name[16];		/* assignment table name */
 };
 
Index: include/biosdefs.h
===================================================================
--- include/biosdefs.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/biosdefs.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -6,6 +6,6 @@
 */
 
-extern	long	trap13(short fun, ...);
-extern	long	trap14(short fun, ...);
+extern	int32_t	trap13(int16_t fun, ...);
+extern	int32_t	trap14(int16_t fun, ...);
 
 #define	BIOS	trap13
@@ -65,20 +65,20 @@
 struct bpb {			/* BIOS parameter block returned by B_GBPB */
 
-	unsigned short	recsiz;		/* physical sector size in bytes */
-	unsigned short	clsiz;		/* cluster size in sectors */
-	unsigned short	clsizb;		/* cluster size in bytes */
-	unsigned short	rdlen;		/* root directory length in sectors */
-	unsigned short	fsiz;		/* FAT size in sectors */
-	unsigned short	fatrec;		/* sector number of 1st sector of 2nd FAT */
-	unsigned short	datrec;		/* sector number of 1st data sector */
-	unsigned short	numcl;		/* number of data clusters on disk */
-	unsigned short	bflags;		/* flags */
-	unsigned short	ntracks;	/* number of tracks */
-	unsigned short	nsides;		/* number of sides (heads) */
-	unsigned short	dspc;		/* sectors per cylinder */
-	unsigned short	dspt;		/* sectors per track */
-	unsigned short	hidden;		/* number of hidden files */
-	char	serno[3];		/* disk serial number */
-	char	nada;			/* --- filler - nothing here --- */
+	uint16_t	recsiz;		/* physical sector size in bytes */
+	uint16_t	clsiz;		/* cluster size in sectors */
+	uint16_t	clsizb;		/* cluster size in bytes */
+	uint16_t	rdlen;		/* root directory length in sectors */
+	uint16_t	fsiz;		/* FAT size in sectors */
+	uint16_t	fatrec;		/* sector number of 1st sector of 2nd FAT */
+	uint16_t	datrec;		/* sector number of 1st data sector */
+	uint16_t	numcl;		/* number of data clusters on disk */
+	uint16_t	bflags;		/* flags */
+	uint16_t	ntracks;	/* number of tracks */
+	uint16_t	nsides;		/* number of sides (heads) */
+	uint16_t	dspc;		/* sectors per cylinder */
+	uint16_t	dspt;		/* sectors per track */
+	uint16_t	hidden;		/* number of hidden files */
+	int8_t	serno[3];		/* disk serial number */
+	int8_t	nada;			/* --- filler - nothing here --- */
 };
 
@@ -99,12 +99,12 @@
 struct dirent {			/* Directory entry */
 
-	char	fname[8];		/* file name */
-	char	fext[3];		/* file extension */
-	char	atrib;			/* attribute byte */
-	char	unused[10];		/* unused space */
-	unsigned short	crtime;		/* 'LLHH' creation time */
-	unsigned short	crdate;		/* 'LLHH' creation date */
-	unsigned short	bclust;		/* 'LLHH' starting cluster number */
-	long	flen;			/* 'LLHH' file length */
+	int8_t	fname[8];		/* file name */
+	int8_t	fext[3];		/* file extension */
+	int8_t	atrib;			/* attribute byte */
+	int8_t	unused[10];		/* unused space */
+	uint16_t	crtime;		/* 'LLHH' creation time */
+	uint16_t	crdate;		/* 'LLHH' creation date */
+	uint16_t	bclust;		/* 'LLHH' starting cluster number */
+	int32_t	flen;			/* 'LLHH' file length */
 };
 
@@ -131,12 +131,12 @@
 
 	struct	dirent	de;	/* directory entry image for file */
-	unsigned short	modefl;	/* fcb flags */
-	unsigned short	clsec;	/* current sector in cluster */
-	unsigned short	curcls;	/* current cluster */
-	unsigned short	offset;	/* current offset into sector */
-	long	curlsn;		/* current logical sector number in file */
-	long	curdsn;		/* current logical sector number on disk */
-	long	curlen;		/* current file length in bytes */
-	long	asects;		/* allocated file length in sectors */
+	uint16_t	modefl;	/* fcb flags */
+	uint16_t	clsec;	/* current sector in cluster */
+	uint16_t	curcls;	/* current cluster */
+	uint16_t	offset;	/* current offset into sector */
+	int32_t	curlsn;		/* current logical sector number in file */
+	int32_t	curdsn;		/* current logical sector number on disk */
+	int32_t	curlen;		/* current file length in bytes */
+	int32_t	asects;		/* allocated file length in sectors */
 };
 
Index: include/cmeta.h
===================================================================
--- include/cmeta.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/cmeta.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -6,28 +6,28 @@
 */
 
-extern	void	CMinit(char *ip);
-extern	int	CMstat(char *msg);
-extern	int	CMchr(char c);
-extern	int	CMuchr(char c);
-extern	int	CMstr(char *s);
-extern	int	CMustr(char *s);
-extern	int	CMlong(void);
-extern	int	CMdig(void);
-extern	int	CMlist(char *l[]);
-extern	int	CMulist(char *l[]);
+extern	void	CMinit(int8_t *ip);
+extern	int16_t	CMstat(int8_t *msg);
+extern	int16_t	CMchr(int8_t c);
+extern	int16_t	CMuchr(int8_t c);
+extern	int16_t	CMstr(int8_t *s);
+extern	int16_t	CMustr(int8_t *s);
+extern	int16_t	CMlong(void);
+extern	int16_t	CMdig(void);
+extern	int16_t	CMlist(int8_t *l[]);
+extern	int16_t	CMulist(int8_t *l[]);
 
-extern	int	QQsw;
-extern	int	QQanch;
+extern	int16_t	QQsw;
+extern	int16_t	QQanch;
 
-extern	char	*QQin;
-extern	char	*QQip;
-extern	char	*QQop;
+extern	int8_t	*QQin;
+extern	int8_t	*QQip;
+extern	int8_t	*QQop;
 
-extern	long	QQnum;
-extern	int	QQlnum;
-extern	char	QQchr;
-extern	char	QQdig;
+extern	int32_t	QQnum;
+extern	int16_t	QQlnum;
+extern	int8_t	QQchr;
+extern	int8_t	QQdig;
 
-extern	char	QQstr[];
+extern	int8_t	QQstr[];
 
 #define	CM_CHR(c)	CMchr(c)
Index: include/configs.h
===================================================================
--- include/configs.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/configs.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -3,5 +3,5 @@
 /* Configuration 0 */
 
-char	cfg_00[64][3] = {
+int8_t	cfg_00[64][3] = {
 
 	{22, 18, 104},	/* 1 */
@@ -66,5 +66,5 @@
 /* Configuration 1 */
 
-char	cfg_01[64][3] = {
+int8_t	cfg_01[64][3] = {
 
 	{22, 16, 104},	/* 1 */
@@ -133,5 +133,5 @@
 /* Configuration 2 */
 
-char	cfg_02[64][3] = {
+int8_t	cfg_02[64][3] = {
 
 	{22, 36, 104},	/* 1 */
@@ -197,5 +197,5 @@
 /* Configuration 3 */
 
-char	cfg_03[64][3] = {
+int8_t	cfg_03[64][3] = {
 
 	{20, 44, 43},	/* 1 */
@@ -259,5 +259,5 @@
 /* Configuration 4 */
 
-char	cfg_04[64][3] = {
+int8_t	cfg_04[64][3] = {
 
 	{19, 65, 26},	/* 1 */
@@ -312,5 +312,5 @@
 /* Configuration 5 */
 
-char	cfg_05[64][3] = {
+int8_t	cfg_05[64][3] = {
 
 	{19, 16, 42},	/* 1 */
@@ -374,5 +374,5 @@
 /* Configuration 6 */
 
-char	cfg_06[64][3] = {
+int8_t	cfg_06[64][3] = {
 
 	{21, 65, 26},	/* 1 */
@@ -425,5 +425,5 @@
 /* Configuration 7 */
 
-char	cfg_07[64][3] = {
+int8_t	cfg_07[64][3] = {
 
 	{22, 18, 104},	/* 1 */
@@ -477,5 +477,5 @@
 /* Configuration 8 */
 
-char	cfg_08[64][3] = {
+int8_t	cfg_08[64][3] = {
 
 	{20, 66, 104},	/* 1 */
@@ -535,5 +535,5 @@
 /* Configuration 9 */
 
-char	cfg_09[64][3] = {
+int8_t	cfg_09[64][3] = {
 
 	{22, 36, 104},	/* 1 */
@@ -599,5 +599,5 @@
 /* Configuration 10 */
 
-char	cfg_10[64][3] = {
+int8_t	cfg_10[64][3] = {
 
 	{19, 18, 26},	/* 1 */
@@ -666,5 +666,5 @@
 /* Configuration 11 */
 
-char	cfg_11[64][3] = {
+int8_t	cfg_11[64][3] = {
 
 	{21, 68, 26},	/* 1 */
@@ -729,8 +729,9 @@
 };
 
-char	*cfgptr[MAXCFG] = {
-
-	(char *)cfg_00, (char *)cfg_01, (char *)cfg_02, (char *)cfg_03,
-	(char *)cfg_04,	(char *)cfg_05, (char *)cfg_06, (char *)cfg_07,
-	(char *)cfg_08, (char *)cfg_09, (char *)cfg_10, (char *)cfg_11
-};
+int8_t	*cfgptr[MAXCFG] = {
+
+	(int8_t *)cfg_00, (int8_t *)cfg_01, (int8_t *)cfg_02, (int8_t *)cfg_03,
+	(int8_t *)cfg_04,	(int8_t *)cfg_05, (int8_t *)cfg_06, (int8_t *)cfg_07,
+	(int8_t *)cfg_08, (int8_t *)cfg_09, (int8_t *)cfg_10, (int8_t *)cfg_11
+};
+
Index: include/ctype.h
===================================================================
--- include/ctype.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/ctype.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -98,5 +98,5 @@
 
 extern	void	___atab(void);
-extern	char __atab[];		/* character type table */
+extern	int8_t __atab[];		/* character type table */
 
 #endif	/* SYS5CODE */
Index: include/curpak.h
===================================================================
--- include/curpak.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/curpak.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -20,5 +20,5 @@
 struct curpak {
 
-	short		(*curtype)(void);
+	int16_t		(*curtype)(void);
 	void		(*premove)(void);
 	void		(*pstmove)(void);
@@ -32,12 +32,13 @@
 	void		(*e_key)(void);
 	void		(*m_key)(void);
-	void		(*d_key)(short k);
-	short		(*not_fld)(short k);
+	void		(*d_key)(int16_t k);
+	int16_t		(*not_fld)(int16_t k);
 	struct fet	*curfet;
 	struct selbox	*csbp;
-	short		*cratex;
-	short		*cratey;
-	short		cmtype;
-	short		cxval;
-	short		cyval;
+	int16_t		*cratex;
+	int16_t		*cratey;
+	int16_t		cmtype;
+	int16_t		cxval;
+	int16_t		cyval;
 };
+
Index: include/dfltins.h
===================================================================
--- include/dfltins.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/dfltins.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -1,3 +1,4 @@
-short	dfltins[] = {		/* default instrument */
+
+int16_t	dfltins[] = {		/* default instrument */
 
 	0x0000, 0x4465, 0x2046, 0x6175, 0x6C74, 0x2020, 0x2020, 0x2020,
Index: include/errno.h
===================================================================
--- include/errno.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/errno.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -7,5 +7,5 @@
  */
 
-extern	int	errno;
+extern	int16_t	errno;
 
 #define EPERM	1
Index: include/fields.h
===================================================================
--- include/fields.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/fields.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -10,15 +10,15 @@
 struct fet {			/* field definition structure */
 
-	short	frow;		/* row the field is in */
-	short	flcol;		/* leftmost column of field */
-	short	frcol;		/* rightmost column of field */
-	short	ftags;		/* field tags / parameters (used variously) */
-	short	(*ebto)(short n);
+	int16_t	frow;		/* row the field is in */
+	int16_t	flcol;		/* leftmost column of field */
+	int16_t	frcol;		/* rightmost column of field */
+	int16_t	ftags;		/* field tags / parameters (used variously) */
+	int16_t	(*ebto)(int16_t n);
 				/* edit buffer 'to' (setup) function */
-	short	(*ebfrom)(short n);
+	int16_t	(*ebfrom)(int16_t n);
 				/* edit buffer 'from' (parse) function */
-	short	(*redisp)(short nn);
+	int16_t	(*redisp)(int16_t nn);
 				/* field (re)display function */
-	short	(*datain)(short nn, short k);
+	int16_t	(*datain)(int16_t nn, int16_t k);
 				/* data entry function */
 };
@@ -26,16 +26,16 @@
 struct	selbox	{		/* selection box structure */
 
-	short	sbxmin;		/* minimum x - left edge of box */
-	short	sbymin;		/* minimum y - top edge of box */
-	short	sbxmax;		/* maximum x - right edge of box */
-	short	sbymax;		/* maximum y - bottom edge of box */
-	short	sbarg;		/* select box argument */
-	short	(*boxhit)(short n);
+	int16_t	sbxmin;		/* minimum x - left edge of box */
+	int16_t	sbymin;		/* minimum y - top edge of box */
+	int16_t	sbxmax;		/* maximum x - right edge of box */
+	int16_t	sbymax;		/* maximum y - bottom edge of box */
+	int16_t	sbarg;		/* select box argument */
+	int16_t	(*boxhit)(int16_t n);
 				/* box-hit function */
 };
 
 #ifndef	FET_DEFS
-extern	short	ebflag;			/* edit buffer setup flag */
-extern	char	ebuf[MAXEBUF+1];	/* edit buffer */
+extern	int16_t	ebflag;			/* edit buffer setup flag */
+extern	int8_t	ebuf[MAXEBUF+1];	/* edit buffer */
 
 extern	struct	fet *curfet;		/* current fet table pointer */
Index: include/fspars.h
===================================================================
--- include/fspars.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/fspars.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -15,5 +15,5 @@
 
 #define	BUFSIZL	256				/* buffer length -- longs */
-#define BUFSIZ	(sizeof (long) * BUFSIZL)	/* buffer length -- chars */
+#define BUFSIZ	(sizeof (int32_t) * BUFSIZL)	/* buffer length -- chars */
 
 #define	BPSEC		512	/* bytes per disk sector */
@@ -24,5 +24,5 @@
 #define	MAXDIRNT	224	/* maximum number of directory entries */
 
-typedef	char	*io_arg;	/* must be big enough to contain a pointer */
+typedef	int8_t	*io_arg;	/* must be big enough to contain a pointer */
 
 #endif
Index: include/glcbars.h
===================================================================
--- include/glcbars.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/glcbars.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -4,10 +4,10 @@
 */
 
-short	BBase   = 9;		/* bottom line of bar graph */
-short	BCenter = 32;		/* center line of bar graph */
-short	BTop    = 53;		/* top line of bar graph */
-short	BOffset = 128;		/* data offset for centered-zero bars */
+int16_t	BBase   = 9;		/* bottom line of bar graph */
+int16_t	BCenter = 32;		/* center line of bar graph */
+int16_t	BTop    = 53;		/* top line of bar graph */
+int16_t	BOffset = 128;		/* data offset for centered-zero bars */
 
-short	BarBLn[128] = {		/* bottom-zero bar lines */
+int16_t	BarBLn[128] = {		/* bottom-zero bar lines */
 
 	 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 
@@ -21,5 +21,5 @@
 };
 
-short	BarCLn[256] = {		/* centered-zero bar lines */
+int16_t	BarCLn[256] = {		/* centered-zero bar lines */
 
 	 9,  9,  9,  9,  9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 
Index: include/glcdefs.h
===================================================================
--- include/glcdefs.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/glcdefs.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -6,21 +6,21 @@
 */
 
-#define	G_INIT		(char)0x40
-#define	G_MWRITE	(char)0x42
-#define	G_MREAD		(char)0x43
-#define	G_SETSAD	(char)0x44
-#define	G_CRSWR		(char)0x46
-#define	G_CRSRD		(char)0x47
-#define	G_CRSMRT	(char)0x4C
-#define	G_CRSMLT	(char)0x4D
-#define	G_CRSMUP	(char)0x4E
-#define	G_CRSMDN	(char)0x4F
-#define	G_ERASE		(char)0x52
-#define	G_SLEEP		(char)0x53
-#define	G_DSPCTL	(char)0x58
-#define	G_HSCRL		(char)0x5A
-#define	G_OVRLAY	(char)0x5B
-#define	G_CGRAM		(char)0x5C
-#define	G_CRSFRM	(char)0x5D
+#define	G_INIT		(int8_t)0x40
+#define	G_MWRITE	(int8_t)0x42
+#define	G_MREAD		(int8_t)0x43
+#define	G_SETSAD	(int8_t)0x44
+#define	G_CRSWR		(int8_t)0x46
+#define	G_CRSRD		(int8_t)0x47
+#define	G_CRSMRT	(int8_t)0x4C
+#define	G_CRSMLT	(int8_t)0x4D
+#define	G_CRSMUP	(int8_t)0x4E
+#define	G_CRSMDN	(int8_t)0x4F
+#define	G_ERASE		(int8_t)0x52
+#define	G_SLEEP		(int8_t)0x53
+#define	G_DSPCTL	(int8_t)0x58
+#define	G_HSCRL		(int8_t)0x5A
+#define	G_OVRLAY	(int8_t)0x5B
+#define	G_CGRAM		(int8_t)0x5C
+#define	G_CRSFRM	(int8_t)0x5D
 
 #define	LCD_WC		lcd_a1
@@ -29,6 +29,6 @@
 #define	LCD_RD		lcd_a1
 
-#define	G_PLANE1	(unsigned)0x0000
-#define	G_PLANE2	(unsigned)0x2000
+#define	G_PLANE1	(uint16_t)0x0000
+#define	G_PLANE2	(uint16_t)0x2000
 
 #define	G_OFF		0		/* off */
Index: include/glcfns.h
===================================================================
--- include/glcfns.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/glcfns.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -6,13 +6,15 @@
 */
 
-extern	unsigned	GLCcrc(unsigned row, unsigned col);
-extern	unsigned	GLCcxy(unsigned x, unsigned y);
-extern	void	GLCplot(unsigned x, unsigned y, unsigned val);
+extern	uint16_t	GLCcrc(uint16_t row, uint16_t col);
+extern	uint16_t	GLCcxy(uint16_t x, uint16_t y);
+extern	void	GLCplot(uint16_t x, uint16_t y, uint16_t val);
 extern	void	GLCinit(void);
-extern	void	GLCwrts(char *s);
-extern	void	GLCtext(unsigned row, unsigned col, char *s);
-extern	void	GLCdisp(short dsp, short crs, short blk1, short blk2, short blk3);
-extern	void	GLCcurs(short crs);
+extern	void	GLCwrts(int8_t *s);
+extern	void	GLCtext(uint16_t row, uint16_t col, int8_t *s);
+extern	void	GLCdisp(int16_t dsp, int16_t crs, int16_t blk1, int16_t blk2, int16_t blk3);
+extern	void	GLCcurs(int16_t crs);
 
-extern	unsigned	lcdx, lcdy, lcdbit, lcdrow, lcdcol, lcdbase;
-extern	unsigned	lcdctl1, lcdctl2;
+extern	uint16_t	lcdx, lcdy, lcdbit, lcdrow, lcdcol, lcdbase;
+extern	uint16_t	lcdctl1, lcdctl2;
+
+
Index: include/hwdefs.h
===================================================================
--- include/hwdefs.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/hwdefs.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -8,25 +8,26 @@
 /* hardware addresses */
 
-extern	char	io_time[], io_lcd, io_ser, io_midi;
-extern	char	io_disk, io_tone, io_leds, io_kbrd;
-extern	char	lcd_a0, lcd_a1;
+extern	int8_t	io_time[], io_lcd, io_ser, io_midi;
+extern	int8_t	io_disk, io_tone, io_leds, io_kbrd;
+extern	int8_t	lcd_a0, lcd_a1;
 
-extern	unsigned	io_vreg[], io_vraw[], io_vram[], io_fpu[];
+extern	uint16_t	io_vreg[], io_vraw[], io_vram[], io_fpu[];
 
 
 /* video memory allocations */
 
-extern	unsigned	v_regs[], v_odtab[][4], v_actab[];
-extern	unsigned	v_ct0[], v_gt1[], v_score[], v_cgtab[];
+extern	uint16_t	v_regs[], v_odtab[][4], v_actab[];
+extern	uint16_t	v_ct0[], v_gt1[], v_score[], v_cgtab[];
 
-extern	unsigned	v_curs0[], v_curs1[], v_curs2[], v_curs3[];
-extern	unsigned	v_curs4[], v_curs5[], v_curs6[], v_curs7[];
-extern	unsigned	v_tcur[], v_kbobj[], v_lnobj[];
-extern	unsigned	v_win0[], v_cur[];
+extern	uint16_t	v_curs0[], v_curs1[], v_curs2[], v_curs3[];
+extern	uint16_t	v_curs4[], v_curs5[], v_curs6[], v_curs7[];
+extern	uint16_t	v_tcur[], v_kbobj[], v_lnobj[];
+extern	uint16_t	v_win0[], v_cur[];
 
 
 /* stuff in the depths of the bios */
 
-extern	short	fc_sw;
+extern	int16_t	fc_sw;
 
-extern	long	fc_val;
+extern	int32_t	fc_val;
+
Index: include/instdsp.h
===================================================================
--- include/instdsp.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/instdsp.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -117,12 +117,12 @@
 
 	struct	pflent	*nextpf;	/* next entry pointer */
-	unsigned	pftrig;		/* trigger number */
-	unsigned	pfvpval;	/* voice / parameter number */
-	long		d1reg;		/* D1 register contents */
-	long		d2reg;		/* D2 register contents */
-	long		d4reg;		/* D4 register contents */
-	char		*a1reg;		/* A1 register contents */
-	char		*a2reg;		/* A2 register contents */
-	char		*a3reg;		/* A3 register contents */
+	uint16_t	pftrig;		/* trigger number */
+	uint16_t	pfvpval;	/* voice / parameter number */
+	int32_t		d1reg;		/* D1 register contents */
+	int32_t		d2reg;		/* D2 register contents */
+	int32_t		d4reg;		/* D4 register contents */
+	int8_t		*a1reg;		/* A1 register contents */
+	int8_t		*a2reg;		/* A2 register contents */
+	int8_t		*a3reg;		/* A3 register contents */
 };
 
@@ -135,10 +135,10 @@
 struct	instpnt	{	/* function point definition */
 
-	short	iptim;		/* time (packed) */
-	short	ipval;		/* value */
-	short	ipvmlt;		/* value multiplier */
-
-	char	ipvsrc;		/* value source */
-	char	ipact;		/* action code */
+	int16_t	iptim;		/* time (packed) */
+	int16_t	ipval;		/* value */
+	int16_t	ipvmlt;		/* value multiplier */
+
+	int8_t	ipvsrc;		/* value source */
+	int8_t	ipact;		/* action code */
 
 #define	AC_NULL		0	/* null action */
@@ -151,9 +151,9 @@
 #define	AC_UNDF		7	/* -- undefined - treated as AC_NULL -- */
 
-	char	ippar1;		/* action parameter 1  (point) */
-	char	ippar2;		/* action parameter 2  (count) */
-
-	char	ippar3;		/* action parameter 3  (counter) */
-	char	ippad;		/* padding for even boundary */
+	int8_t	ippar1;		/* action parameter 1  (point) */
+	int8_t	ippar2;		/* action parameter 2  (count) */
+
+	int8_t	ippar3;		/* action parameter 3  (counter) */
+	int8_t	ippad;		/* padding for even boundary */
 };
 
@@ -166,12 +166,12 @@
 struct	idfnhdr	{	/* function header */
 
-	short	idfpch;		/* pitch (used for freq1 only) */
-	short	idfmlt;		/* overall value multiplier (-1 .. +1) */
-
-	char	idfsrc;		/* overall value source */
-	char	idfpif;		/* points in the function */
-
-	char	idfpt1;		/* index of first point (0..NIPTS) */
-	char	idftmd;		/* trigger mode and control bits */
+	int16_t	idfpch;		/* pitch (used for freq1 only) */
+	int16_t	idfmlt;		/* overall value multiplier (-1 .. +1) */
+
+	int8_t	idfsrc;		/* overall value source */
+	int8_t	idfpif;		/* points in the function */
+
+	int8_t	idfpt1;		/* index of first point (0..NIPTS) */
+	int8_t	idftmd;		/* trigger mode and control bits */
 
 #define	I_TM_KEY	0x01	/* trigger on key closure */
@@ -181,8 +181,8 @@
 #define	I_VNSUBN	0x08	/* new value sub-n bit    (matches hardware) */
 
-	char	idfcpt;		/* index of current point (0..NIPTS) */
-	char	idfprm;		/* parameter associated with this function */
-
-	short	idftrg;		/* trigger that started the function */
+	int8_t	idfcpt;		/* index of current point (0..NIPTS) */
+	int8_t	idfprm;		/* parameter associated with this function */
+
+	int16_t	idftrg;		/* trigger that started the function */
 };
 
@@ -195,21 +195,21 @@
 struct	instdef	{	/* instrument definition */
 
-	short	idhflag;		/* flags */
-
-	char	idhname[MAXIDLN+1];	/* instrument name */
-	char	idhcom1[MAXIDLN+1];	/* first line of comments */
-	char	idhcom2[MAXIDLN+1];	/* second line of comments */
-	char	idhcom3[MAXIDLN+1];	/* third line of comments */
-
-	char	idhcfg;			/* configuration byte */
-	char	idhplft;		/* points unused */
-
-	char	idhwsa;			/* waveshape A library number */
-	char	idhwsb;			/* waveshape B library number */
-
-	char	idhos1c;		/* oscillator 1 controls */
-	char	idhos2c;		/* oscillator 2 controls */
-	char	idhos3c;		/* oscillator 3 controls */
-	char	idhos4c;		/* oscillator 4 controls */
+	int16_t	idhflag;		/* flags */
+
+	int8_t	idhname[MAXIDLN+1];	/* instrument name */
+	int8_t	idhcom1[MAXIDLN+1];	/* first line of comments */
+	int8_t	idhcom2[MAXIDLN+1];	/* second line of comments */
+	int8_t	idhcom3[MAXIDLN+1];	/* third line of comments */
+
+	int8_t	idhcfg;			/* configuration byte */
+	int8_t	idhplft;		/* points unused */
+
+	int8_t	idhwsa;			/* waveshape A library number */
+	int8_t	idhwsb;			/* waveshape B library number */
+
+	int8_t	idhos1c;		/* oscillator 1 controls */
+	int8_t	idhos2c;		/* oscillator 2 controls */
+	int8_t	idhos3c;		/* oscillator 3 controls */
+	int8_t	idhos4c;		/* oscillator 4 controls */
 
 #define	OC_MOD		0x0003		/* oscillator mode mask */
@@ -222,8 +222,8 @@
 #define	OC_SYN		0x0004		/* oscillator in sync mode */
 
-	short	idhos1v;		/* oscillator 1 value */
-	short	idhos2v;		/* oscillator 2 value */
-	short	idhos3v;		/* oscillator 3 value */
-	short	idhos4v;		/* oscillator 4 value */
+	int16_t	idhos1v;		/* oscillator 1 value */
+	int16_t	idhos2v;		/* oscillator 2 value */
+	int16_t	idhos3v;		/* oscillator 3 value */
+	int16_t	idhos4v;		/* oscillator 4 value */
 
 	struct	idfnhdr	idhfnc[NFINST];	/* function headers */
@@ -231,11 +231,11 @@
 	struct	instpnt	idhpnt[NIPNTS];	/* point table */
 
-	short	idhwvaf[NUMWPNT];	/* waveshape A final values */
-	short	idhwvao[NUMWPNT];	/* waveshape A offset values */
-	short	idhwvah[NUMHARM];	/* waveshape A harmonic values */
-
-	short	idhwvbf[NUMWPNT];	/* waveshape B final values */
-	short	idhwvbo[NUMWPNT];	/* waveshape B offset values */
-	short	idhwvbh[NUMHARM];	/* waveshape B harmonic values */
-
-};
+	int16_t	idhwvaf[NUMWPNT];	/* waveshape A final values */
+	int16_t	idhwvao[NUMWPNT];	/* waveshape A offset values */
+	int16_t	idhwvah[NUMHARM];	/* waveshape A harmonic values */
+
+	int16_t	idhwvbf[NUMWPNT];	/* waveshape B final values */
+	int16_t	idhwvbo[NUMWPNT];	/* waveshape B offset values */
+	int16_t	idhwvbh[NUMHARM];	/* waveshape B harmonic values */
+
+};
Index: include/io.h
===================================================================
--- include/io.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/io.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -10,9 +10,9 @@
 struct channel {		/* channel table entry */
 
-	char	c_read;		/* read routine index */
-	char	c_write;	/* write routine index */
-	char	c_ioctl;	/* ioctl routine index */
-	char	c_seek;		/* seek routine index */
-	int	(*c_close)();	/* close function pointer */
+	int8_t	c_read;		/* read routine index */
+	int8_t	c_write;	/* write routine index */
+	int8_t	c_ioctl;	/* ioctl routine index */
+	int8_t	c_seek;		/* seek routine index */
+	int16_t	(*c_close)();	/* close function pointer */
 	io_arg	c_arg;		/* argument to channel driver */
 };
@@ -20,14 +20,14 @@
 struct device {			/* device control structure */
 
-	char	d_read;		/* read routine code */
-	char	d_write;	/* write routine code */
-	char	d_ioctl;	/* ioctl routine code */
-	char	d_seek;		/* seek routine code */
-	int	(*d_open)();	/* special open function */
+	int8_t	d_read;		/* read routine code */
+	int8_t	d_write;	/* write routine code */
+	int8_t	d_ioctl;	/* ioctl routine code */
+	int8_t	d_seek;		/* seek routine code */
+	int16_t	(*d_open)();	/* special open function */
 };
 
 struct devtabl {		/* device table entry */
 
-	char	*d_name;	/* device name */
+	int8_t	*d_name;	/* device name */
 	struct	device	*d_dev;	/* pointer to device structure */
 	io_arg	d_arg;		/* argument to device driver */
@@ -37,5 +37,5 @@
 
 extern	struct channel chantab[MAXCHAN];	/* defined in fsinit.c */
-extern	char	Wrkbuf[BPSEC];			/* defined in fsinit.c */
+extern	int8_t	Wrkbuf[BPSEC];			/* defined in fsinit.c */
 
 #endif
Index: include/knmtab.h
===================================================================
--- include/knmtab.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/knmtab.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -20,5 +20,5 @@
 */
 
-short	knmtab[32][256] = {
+int16_t	knmtab[32][256] = {
 
 /* 
Index: include/libdsp.h
===================================================================
--- include/libdsp.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/libdsp.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -91,31 +91,31 @@
 struct	scndx {		/* score index */
 
-	long	sclen;		/* score length */
-	char	scfnm[16];	/* score name */
+	int32_t	sclen;		/* score length */
+	int8_t	scfnm[16];	/* score name */
 };
 
 struct	fcat {		/* file catalog entry */
 
-	char	fcsize[3];	/* allocated size in clusters */
-	char	fcp0;		/* parameter 0 - Autoload flag */
-	char	fcname[8];	/* directory name */
-	char	fcp1;		/* parameter 1 - -reserved- */
-	char	fcextn[3];	/* directory extension  (file type) */
-	char	fcp2;		/* parameter 2 - -reserved- */
-	char	fccmnt[37];	/* comment field */
-	char	fceol[2];	/* end of line  (CR, LF) */
+	int8_t	fcsize[3];	/* allocated size in clusters */
+	int8_t	fcp0;		/* parameter 0 - Autoload flag */
+	int8_t	fcname[8];	/* directory name */
+	int8_t	fcp1;		/* parameter 1 - -reserved- */
+	int8_t	fcextn[3];	/* directory extension  (file type) */
+	int8_t	fcp2;		/* parameter 2 - -reserved- */
+	int8_t	fccmnt[37];	/* comment field */
+	int8_t	fceol[2];	/* end of line  (CR, LF) */
 };
 
 struct	mlibhdr	{	/* MIDAS library file header */
 
-	char	l_csum[8];	/* checksum in HEX ASCII, of all but l_csum[] */
-	char	l_name[8];	/* file name */
-	char	l_type[3];	/* file type */
-	char	l_cmnt[37];	/* comment */
+	int8_t	l_csum[8];	/* checksum in HEX ASCII, of all but l_csum[] */
+	int8_t	l_name[8];	/* file name */
+	int8_t	l_type[3];	/* file type */
+	int8_t	l_cmnt[37];	/* comment */
 };
 
 #define	LH_LEN		(sizeof (struct mlibhdr))
 
-#define	OR_LEN1		((long)&idefs[0].idhwvaf[0]-(long)&idefs[0].idhflag)
+#define	OR_LEN1		((int32_t)&idefs[0].idhwvaf[0]-(int32_t)&idefs[0].idhflag)
 #define	OR_LEN2		(2 * (NUMWPNT + NUMHARM))
 
Index: include/memory.h
===================================================================
--- include/memory.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/memory.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -6,10 +6,12 @@
 */
 
-extern	void	*memccpy(void *vp1, void *vp2, char c, int n);
-extern	void	*memchr(void *vp, char c, int n);
-extern	void	*memcpy(void *vp1, void *vp2, int n);
-extern	void	*memset(void *vp, char c, int n);
-extern	int	memcmp(void *vp1, void *vp2, int n);
-extern	void	*memsetw(void *vp, short s, short n);
-extern	void	*memcpyw(void *vp1, void *vp2, int n);
-extern	int	memcmpu(void *vp1, void *vp2, int n);
+extern	void	*memccpy(void *vp1, void *vp2, int8_t c, int16_t n);
+extern	void	*memchr(void *vp, int8_t c, int16_t n);
+extern	void	*memcpy(void *vp1, void *vp2, int16_t n);
+extern	void	*memset(void *vp, int8_t c, int16_t n);
+extern	int16_t	memcmp(void *vp1, void *vp2, int16_t n);
+extern	void	*memsetw(void *vp, int16_t s, int16_t n);
+extern	void	*memcpyw(void *vp1, void *vp2, int16_t n);
+extern	int16_t	memcmpu(void *vp1, void *vp2, int16_t n);
+
+
Index: include/midas.h
===================================================================
--- include/midas.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/midas.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -8,5 +8,5 @@
 */
 
-typedef	void	(*LPF)(short _1, short _2);	/* pointer to a LCD panel function */
+typedef	void	(*LPF)(int16_t _1, int16_t _2);	/* pointer to a LCD panel function */
 
 #define	SM_SCALE(x)	(((x) * 252) & 0x7FE0)
Index: include/neddefs.h
===================================================================
--- include/neddefs.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/neddefs.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -8,7 +8,7 @@
 */
 
-extern	short	noteop, notesel;
+extern	int16_t	noteop, notesel;
 
-extern	long	t_note;
+extern	int32_t	t_note;
 
 extern	struct	n_entry	*p_nbeg, *p_nend;
Index: include/objdefs.h
===================================================================
--- include/objdefs.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/objdefs.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -8,12 +8,12 @@
 struct EXFILE {			/* executable file header */
 
-	unsigned	F_Magic;	/* File type magic */
-	long		F_Text;		/* SIze of text segment */
-	long		F_Data;		/* Size of data segment */
-	long		F_BSS;		/* Size of BSS segment */
-	long		F_Symtab;	/* Size of symbol table */
-	long		F_Res1;		/* Reserved area #1 */
-	long		F_Res2;		/* Reserved area #2 -- text origin */
-	unsigned	F_Res3;		/* Reserved area #3 -- flag word */
+	uint16_t	F_Magic;	/* File type magic */
+	int32_t		F_Text;		/* SIze of text segment */
+	int32_t		F_Data;		/* Size of data segment */
+	int32_t		F_BSS;		/* Size of BSS segment */
+	int32_t		F_Symtab;	/* Size of symbol table */
+	int32_t		F_Res1;		/* Reserved area #1 */
+	int32_t		F_Res2;		/* Reserved area #2 -- text origin */
+	uint16_t	F_Res3;		/* Reserved area #3 -- flag word */
 
 					/* data origin - long */
@@ -26,7 +26,7 @@
 struct SYMBOL {			/* Symbol table entry -- 14 bytes */
 
-	char		symname[8];	/* Symbol name  (LJZF) */
-	unsigned	symtype;	/* Symbol type flags */
-	long		symvalue;	/* Symbol value */
+	int8_t		symname[8];	/* Symbol name  (LJZF) */
+	uint16_t	symtype;	/* Symbol type flags */
+	int32_t		symvalue;	/* Symbol value */
 };
 
Index: include/patch.h
===================================================================
--- include/patch.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/patch.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -37,21 +37,21 @@
 struct	patch	{	/* patch table entry (16 bytes per entry) */
 
-	unsigned short	nextstm;	/* index of next entry in stm chain */
-	unsigned short	prevstm;	/* index of previous entry in stm chain */
-	unsigned short	defnum;		/* definer */
-	unsigned short	stmnum;		/* stimulus */
-	unsigned short	paspec;		/* destination type and flags */
-	unsigned short	pasuba;		/* sub-address */
-	unsigned short	padat1;		/* data word 1 */
-	unsigned short	padat2;		/* data word 2 */
+	uint16_t	nextstm;	/* index of next entry in stm chain */
+	uint16_t	prevstm;	/* index of previous entry in stm chain */
+	uint16_t	defnum;		/* definer */
+	uint16_t	stmnum;		/* stimulus */
+	uint16_t	paspec;		/* destination type and flags */
+	uint16_t	pasuba;		/* sub-address */
+	uint16_t	padat1;		/* data word 1 */
+	uint16_t	padat2;		/* data word 2 */
 };
 
 struct	defent	{	/* definition table entry -- 10 bytes per entry */
 
-	unsigned short	nextdef;	/* index of next in def chain */
-	unsigned short	stm;		/* stimulus */
-	unsigned short	adspec;		/* destination type */
-	unsigned short	adsuba;		/* sub-address */
-	unsigned short	addat1;		/* data word 1 */
+	uint16_t	nextdef;	/* index of next in def chain */
+	uint16_t	stm;		/* stimulus */
+	uint16_t	adspec;		/* destination type */
+	uint16_t	adsuba;		/* sub-address */
+	uint16_t	addat1;		/* data word 1 */
 };
 
@@ -61,11 +61,11 @@
 struct	seqent	{	/* sequence table entry -- 14 bytes per entry */
 
-	unsigned short	seqtime;	/* time */
-	unsigned short	seqact1;	/* action 1 */
-	unsigned short	seqdat1;	/* action 1 data */
-	unsigned short	seqact2;	/* action 2 */
-	unsigned short	seqdat2;	/* action 2 data */
-	unsigned short	seqact3;	/* action 3 */
-	unsigned short	seqdat3;	/* action 3 data */
+	uint16_t	seqtime;	/* time */
+	uint16_t	seqact1;	/* action 1 */
+	uint16_t	seqdat1;	/* action 1 data */
+	uint16_t	seqact2;	/* action 2 */
+	uint16_t	seqdat2;	/* action 2 data */
+	uint16_t	seqact3;	/* action 3 */
+	uint16_t	seqdat3;	/* action 3 data */
 };
 
@@ -77,6 +77,6 @@
 
 #ifndef	PATCHDEF
-extern	char		stmptr[];	/* stimulus pointer table */
-extern	char		defptr[];	/* definition pointer table */
+extern	int8_t		stmptr[];	/* stimulus pointer table */
+extern	int8_t		defptr[];	/* definition pointer table */
 
 extern	struct patch	patches[];	/* patch table */
@@ -91,10 +91,10 @@
 extern	struct seqent	seqtab[];		/* sequence table */
 
-extern	unsigned short	seqflag[16];		/* sequence flags */
-extern	unsigned short	seqline[16];		/* sequence line */
-extern	unsigned short	seqstim[16];		/* sequence stimulus */
-extern	unsigned short	seqtime[16];		/* sequence timers */
-extern	unsigned short	sregval[16];		/* register values */
-extern	unsigned short	trstate[16];		/* trigger states */
+extern	uint16_t	seqflag[16];		/* sequence flags */
+extern	uint16_t	seqline[16];		/* sequence line */
+extern	uint16_t	seqstim[16];		/* sequence stimulus */
+extern	uint16_t	seqtime[16];		/* sequence timers */
+extern	uint16_t	sregval[16];		/* register values */
+extern	uint16_t	trstate[16];		/* trigger states */
 
 #endif
Index: include/ptoftab.h
===================================================================
--- include/ptoftab.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/ptoftab.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -1,5 +1,6 @@
+
 /* Pitch to Frequency */
 
-short ptoftab[] = {
+int16_t ptoftab[] = {
 
 	0x0060,	/*   0:     0.03561      0    0.00000 */
Index: include/ratio.h
===================================================================
--- include/ratio.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/ratio.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -1,5 +1,6 @@
+
 /* ratio.h -- generated:  1988-08-25  19:23:42 */
 
-short	ratio[100] = {	/* ratio table */
+int16_t	ratio[100] = {	/* ratio table */
 
 	    0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
Index: include/rawio.h
===================================================================
--- include/rawio.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/rawio.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -6,9 +6,11 @@
 */
 
-int	getln(int unit, int nb, char *buf);
-int	getrln(int unit, int nb, char *buf);
-int	readln(int unit, int nc, char *ctl, int nb, char *buf);
+int16_t	getln(int16_t unit, int16_t nb, int8_t *buf);
+int16_t	getrln(int16_t unit, int16_t nb, int8_t *buf);
+int16_t	readln(int16_t unit, int16_t nc, int8_t *ctl, int16_t nb, int8_t *buf);
 
 /* The following should really be void ... */
 
-void	writeln(int unit, char *buf);
+void	writeln(int16_t unit, int8_t *buf);
+
+
Index: include/regs.h
===================================================================
--- include/regs.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/regs.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -11,9 +11,9 @@
 struct regs {
 
-	long	d_reg[8];		/* Data registers d0..d7 */
+	int32_t	d_reg[8];		/* Data registers d0..d7 */
 
-	char	*a_reg[8];		/* Address registers */
+	int8_t	*a_reg[8];		/* Address registers */
 
-	unsigned short	reg_fill,	/* Filler to keep long alignment */
+	uint16_t	reg_fill,	/* Filler to keep long alignment */
 			reg_sr,		/* Status register */
 			*reg_pc;	/* Program counter */
Index: include/scfns.h
===================================================================
--- include/scfns.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/scfns.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -8,36 +8,36 @@
 */
 
-extern	void	eh_ins(struct s_entry *ne, short et);
-extern	void	eh_rmv(struct s_entry *ev, short et);
-extern	void	sc_clr(short ns);
+extern	void	eh_ins(struct s_entry *ne, int16_t et);
+extern	void	eh_rmv(struct s_entry *ev, int16_t et);
+extern	void	sc_clr(int16_t ns);
 
-extern	short	e_del(struct s_entry *e1);
-extern	short	selscor(short ns);
-extern	int	sc_goto(long tval);
+extern	int16_t	e_del(struct s_entry *e1);
+extern	int16_t	selscor(int16_t ns);
+extern	int16_t	sc_goto(int32_t tval);
 
-extern	long	scinit(void);
-extern	long	evleft(void);
+extern	int32_t	scinit(void);
+extern	int32_t	evleft(void);
 
-extern	struct	s_entry	*e_alc(short w);
+extern	struct	s_entry	*e_alc(int16_t w);
 extern	struct	s_entry	*e_ins(struct s_entry *e1, struct s_entry *e2);
 extern	struct	s_entry	*e_rmv(struct s_entry *e1);
 extern	struct	s_entry	*e_clr(struct s_entry *e1);
-extern	struct	s_entry	*ehfind(short eh, long te, short d1, short d2);
-extern	struct	s_entry	*frfind(long tval, int sdir);
-extern	struct	s_entry	*ep_adj(struct s_entry *sep, int sdir, long tval);
-extern	struct	s_entry	*se_exec(struct s_entry *ep, short sd);
-extern	struct	s_entry	*findev(struct s_entry *ep, long te, short et, short d1, short d2);
+extern	struct	s_entry	*ehfind(int16_t eh, int32_t te, int16_t d1, int16_t d2);
+extern	struct	s_entry	*frfind(int32_t tval, int16_t sdir);
+extern	struct	s_entry	*ep_adj(struct s_entry *sep, int16_t sdir, int32_t tval);
+extern	struct	s_entry	*se_exec(struct s_entry *ep, int16_t sd);
+extern	struct	s_entry	*findev(struct s_entry *ep, int32_t te, int16_t et, int16_t d1, int16_t d2);
 
-extern	char	ac_code;
-extern	char	scname[][16];
+extern	int8_t	ac_code;
+extern	int8_t	scname[][16];
 
 extern	BOOL	se_chg;
 
-extern	short	curscor, cursect;
+extern	int16_t	curscor, cursect;
 
-extern	long	se1_cnt, se2_cnt, se3_cnt;
-extern	long	spool[], *pspool;
-extern	long	spcount, frags;
-extern	long	t_bak, t_cur, t_ctr, t_fwd;
+extern	int32_t	se1_cnt, se2_cnt, se3_cnt;
+extern	int32_t	spool[], *pspool;
+extern	int32_t	spcount, frags;
+extern	int32_t	t_bak, t_cur, t_ctr, t_fwd;
 
 extern	struct	s_entry	*size1, *size2, *size3;
Index: include/score.h
===================================================================
--- include/score.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/score.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -15,12 +15,12 @@
 
 	struct	nevent	*nxt;
-	short	group;
-	short	note;
+	int16_t	group;
+	int16_t	note;
 };
 
 struct s_time {
 
-	short	sflags;
-	char	smpte[10];
+	int16_t	sflags;
+	int8_t	smpte[10];
 };
 
@@ -33,9 +33,9 @@
 struct	s_entry {	/* event entry structure */
 
-	long		e_time;		/* time, in frames */
-	char		e_size;		/* size of entry, in longs */
-	char		e_type;		/* type of entry */
-	char		e_data1;	/* 1st 8 bits of data */
-	char		e_data2;	/* 2nd 8 bits of data */
+	int32_t		e_time;		/* time, in frames */
+	int8_t		e_size;		/* size of entry, in longs */
+	int8_t		e_type;		/* type of entry */
+	int8_t		e_data1;	/* 1st 8 bits of data */
+	int8_t		e_data2;	/* 2nd 8 bits of data */
 
 	struct s_entry	*e_bak,		/* backward pointer */
@@ -51,15 +51,15 @@
 struct	n_entry {	/* note entry structure */
 
-	long		e_time;		/* time, in frames */
-	char		e_size;		/* size of entry, in longs */
-	char		e_type;		/* type of entry */
-	char		e_note;		/* note number */
-	char		e_group;	/* group */
+	int32_t		e_time;		/* time, in frames */
+	int8_t		e_size;		/* size of entry, in longs */
+	int8_t		e_type;		/* type of entry */
+	int8_t		e_note;		/* note number */
+	int8_t		e_group;	/* group */
 
 	struct s_entry	*e_bak,		/* backward pointer */
 			*e_fwd;		/* forward pointer */
 
-	short		e_vel;		/* velocity */
-	short		e_data4;
+	int16_t		e_vel;		/* velocity */
+	int16_t		e_data4;
 };
 
Index: include/secdefs.h
===================================================================
--- include/secdefs.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/secdefs.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -6,5 +6,6 @@
 */
 
-extern	short	secopok;
-extern	long	t_sbgn, t_send, t_sect, t_sec1, t_sec2, t_cbgn, t_cend;
+extern	int16_t	secopok;
+extern	int32_t	t_sbgn, t_send, t_sect, t_sec1, t_sec2, t_cbgn, t_cend;
 extern	struct	s_entry	*p_sbgn, *p_send, *p_sec1, *p_sec2, *p_cbgn, *p_cend;
+
Index: include/setjmp.h
===================================================================
--- include/setjmp.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/setjmp.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -17,21 +17,21 @@
 struct	JMP_BUF {	/* setjmp() / longjmp() environment structure */
 
-	long	jmpret;		/* return address */
+	int32_t	jmpret;		/* return address */
 
-	long	jmp_d1;		/* data registers */
-	long	jmp_d2;
-	long	jmp_d3;
-	long	jmp_d4;
-	long	jmp_d5;
-	long	jmp_d6;
-	long	jmp_d7;
+	int32_t	jmp_d1;		/* data registers */
+	int32_t	jmp_d2;
+	int32_t	jmp_d3;
+	int32_t	jmp_d4;
+	int32_t	jmp_d5;
+	int32_t	jmp_d6;
+	int32_t	jmp_d7;
 
-	long	jmp_a1;		/* address registers */
-	long	jmp_a2;
-	long	jmp_a3;
-	long	jmp_a4;
-	long	jmp_a5;
-	long	jmp_a6;
-	long	jmp_a7;
+	int32_t	jmp_a1;		/* address registers */
+	int32_t	jmp_a2;
+	int32_t	jmp_a3;
+	int32_t	jmp_a4;
+	int32_t	jmp_a5;
+	int32_t	jmp_a6;
+	int32_t	jmp_a7;
 };
 
Index: include/slice.h
===================================================================
--- include/slice.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/slice.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -15,6 +15,6 @@
 
 	struct	gdsel	*next;		/* pointer to next element */
-	short	note;			/* note offset 0..87 */
-	short	code;			/* update code */
+	int16_t	note;			/* note offset 0..87 */
+	int16_t	code;			/* update code */
 };
 
Index: include/smdefs.h
===================================================================
--- include/smdefs.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/smdefs.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -10,6 +10,6 @@
 	struct	sment	*nxt;
 	struct	sment	*prv;
-	unsigned	vp;
-	unsigned	sm;
+	uint16_t	vp;
+	uint16_t	sm;
 };
 
@@ -18,5 +18,5 @@
 	struct	sment	*nxt;
 	struct	sment	*prv;
-	unsigned	val;
+	uint16_t	val;
 };
 
Index: include/stdarg.h
===================================================================
--- include/stdarg.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/stdarg.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -6,7 +6,7 @@
 */
 
-typedef	char	*va_list;
+typedef	int8_t	*va_list;
 
-#define	va_start(ap, last)	ap = (char *)&last + sizeof(last)
+#define	va_start(ap, last)	ap = (int8_t *)&last + sizeof(last)
 #define	va_arg(ap, type)	(ap += sizeof(type), ap[-1])
 #define	va_end(ap)
Index: include/stddefs.h
===================================================================
--- include/stddefs.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/stddefs.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -96,5 +96,5 @@
 /* BOOL type definition for flag variables */
 
-typedef	char	BOOL;
+typedef	int8_t	BOOL;
 
 #endif
Index: include/stdio.h
===================================================================
--- include/stdio.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/stdio.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -22,12 +22,12 @@
 typedef struct {
 
-	char	*_bp;		/* current position in buffer */
-	char	*_bend;		/* last character in buffer + 1 */
-	char	*_buff;		/* address of buffer */
-	char	_flags;		/* {_BUSY, _ALLBUF, _DIRTY, _EOF, _IOERR} */
-	char	_unit;		/* fd token returned by open */
-	char	_bytbuf;	/* single byte buffer for unbuffered streams */
-	char	_pad;		/* pad for alignment -- possibly use later */
-	int	_buflen;	/* length of buffer */
+	int8_t	*_bp;		/* current position in buffer */
+	int8_t	*_bend;		/* last character in buffer + 1 */
+	int8_t	*_buff;		/* address of buffer */
+	int8_t	_flags;		/* {_BUSY, _ALLBUF, _DIRTY, _EOF, _IOERR} */
+	int8_t	_unit;		/* fd token returned by open */
+	int8_t	_bytbuf;	/* single byte buffer for unbuffered streams */
+	int8_t	_pad;		/* pad for alignment -- possibly use later */
+	int16_t	_buflen;	/* length of buffer */
 
 } FILE;
@@ -36,15 +36,15 @@
 
 extern	FILE	Cbuffs[NSTREAMS];		/* table of FILE structures */
-extern	char	*Stdbufs;			/* free list of buffers */
-extern	long	Stdbuf[MAXDFILE][BUFSIZL];	/* buffers */
+extern	int8_t	*Stdbufs;			/* free list of buffers */
+extern	int32_t	Stdbuf[MAXDFILE][BUFSIZL];	/* buffers */
 
 #endif
 
-extern	long	ftell(FILE *fp);
-extern	char	*gets(char *line);
-extern	char	*fgets(char *s, int n, FILE *fp);
-extern	FILE	*fopen(char *name, char *mode);
-extern	FILE	*fopena(char *name, char *mode);
-extern	FILE	*fopenb(char *name, char *mode);
+extern	int32_t	ftell(FILE *fp);
+extern	int8_t	*gets(int8_t *line);
+extern	int8_t	*fgets(int8_t *s, int16_t n, FILE *fp);
+extern	FILE	*fopen(int8_t *name, int8_t *mode);
+extern	FILE	*fopena(int8_t *name, int8_t *mode);
+extern	FILE	*fopenb(int8_t *name, int8_t *mode);
 
 #define	stdin	(&Cbuffs[0])
Index: include/strings.h
===================================================================
--- include/strings.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/strings.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -6,24 +6,26 @@
 */
 
-extern	char	*strccpy(char *s1, char *s2, char c);
-extern	char	*strcpy(char *s1, char *s2);
-extern	char	*strncpy(char *s1, char *s2, int n);
-extern	char	*strcat(char *s1, char *s2);
-extern	char	*strncat(char *s1, char *s2, int n);
-extern	char	*strchr(char *sp, char c);
-extern	char	*strrchr(char *sp, char c);
-extern	char	*strpbrk(char *string, char *brkset);
-extern	char	*strtok(char *string, char *sepset);
-extern	char	*index(char *str, char c);
-extern	char	*rindex(char *str, char c);
-extern	char	*str2lc(char *s);
-extern	char	*str2uc(char *s);
+extern	int8_t	*strccpy(int8_t *s1, int8_t *s2, int8_t c);
+extern	int8_t	*strcpy(int8_t *s1, int8_t *s2);
+extern	int8_t	*strncpy(int8_t *s1, int8_t *s2, int16_t n);
+extern	int8_t	*strcat(int8_t *s1, int8_t *s2);
+extern	int8_t	*strncat(int8_t *s1, int8_t *s2, int16_t n);
+extern	int8_t	*strchr(int8_t *sp, int8_t c);
+extern	int8_t	*strrchr(int8_t *sp, int8_t c);
+extern	int8_t	*strpbrk(int8_t *string, int8_t *brkset);
+extern	int8_t	*strtok(int8_t *string, int8_t *sepset);
+extern	int8_t	*index(int8_t *str, int8_t c);
+extern	int8_t	*rindex(int8_t *str, int8_t c);
+extern	int8_t	*str2lc(int8_t *s);
+extern	int8_t	*str2uc(int8_t *s);
 
-extern	int	strcmp(char *s1, char *s2);
-extern	int	strlcmp(char *s, char *l[]);
-extern	int	strncmp(char *s1, char *s2, int n);
-extern	int	strlen(char *s);
-extern	int	strspn(char *string, char *charset);
-extern	int	strcspn(char *string, char *charset);
+extern	int16_t	strcmp(int8_t *s1, int8_t *s2);
+extern	int16_t	strlcmp(int8_t *s, int8_t *l[]);
+extern	int16_t	strncmp(int8_t *s1, int8_t *s2, int16_t n);
+extern	int16_t	strlen(int8_t *s);
+extern	int16_t	strspn(int8_t *string, int8_t *charset);
+extern	int16_t	strcspn(int8_t *string, int8_t *charset);
 
-extern	long	strtol(char *str, char **ptr, int base);
+extern	int32_t	strtol(int8_t *str, int8_t **ptr, int16_t base);
+
+
Index: include/swrtab.h
===================================================================
--- include/swrtab.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/swrtab.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -1,3 +1,4 @@
-long swrtab[128] = {	/* scroll rates */
+
+int32_t swrtab[128] = {	/* scroll rates */
 
 	0x00000000L, 0x00000800L, 0x00001000L, 0x00001800L,	/* 0 */
Index: include/timers.h
===================================================================
--- include/timers.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/timers.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -15,3 +15,4 @@
 #define	MUTIMER		5		/* mouse buffer flush timer */
 
-extern	short	timers[NTIMERS];	/* timer array */
+extern	int16_t	timers[NTIMERS];	/* timer array */
+
Index: include/vsdd.h
===================================================================
--- include/vsdd.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/vsdd.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -55,16 +55,16 @@
 struct octent {			/* Object control table entry */
 
-	unsigned int	ysize,	/* Height of object in pixels */
+	uint16_t	ysize,	/* Height of object in pixels */
 			xsize;	/* Width of object in pixels */
 
-	int		objx,	/* Object x location */
+	int16_t		objx,	/* Object x location */
 			objy;	/* Object y location */
 
-	unsigned int	*obase;	/* Base of object data */
+	uint16_t	*obase;	/* Base of object data */
 
-	char		opri,	/* Current object priority */
+	int8_t		opri,	/* Current object priority */
 			obank;	/* Object bank 0..3 */
 
-	unsigned int	odtw0,	/* Object descriptor table word 0 */
+	uint16_t	odtw0,	/* Object descriptor table word 0 */
 			odtw1;	/* Object descriptor table word 1 */
 };
Index: include/vsddsw.h
===================================================================
--- include/vsddsw.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/vsddsw.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -9,26 +9,28 @@
 /* functions */
 
-extern	void	vbank(unsigned b);
-extern	void	vputp(struct octent *octad, int xloc, int yloc, int val);
-extern	void	vwputp(struct octent *octad, int xloc, int yloc, int val);
+extern	void	vbank(uint16_t b);
+extern	void	vputp(struct octent *octad, int16_t xloc, int16_t yloc, int16_t val);
+extern	void	vwputp(struct octent *octad, int16_t xloc, int16_t yloc, int16_t val);
 
 /* these should be voids ... */
 
 extern	void	vfwait(void);
-extern	void	vputs(uint *sbase, uint row, uint col, uint attrib, char *str);
-extern	void	vputsa(uint *sbase, uint row, uint col, uint *attrib, char *str);
-extern	void	vputc(unsigned *sbase, unsigned row, unsigned col, unsigned c, unsigned attrib);
+extern	void	vputs(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t attrib, int8_t *str);
+extern	void	vputsa(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t *attrib, int8_t *str);
+extern	void	vputc(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t c, uint16_t attrib);
 extern	void	VHinit(void);
-extern	void	objclr(unsigned obj);
-extern	void	objon(unsigned obj, unsigned line, unsigned num);
-extern	void	objoff(unsigned obj, unsigned line, unsigned num);
-extern	void	vcputs(int *obase, int nw, int fg, int bg, int row, int col, char *str);
-extern	void	vwputs(int *obase, int nw, int fg, int bg, int row, int col, char *str);
-extern	void	vwputm(unsigned int *obase, int nw, int fg, int bg, int row, int col, char *ml[]);
-extern	void	vmput(uint *sbase, uint row, uint col, uint ma, char *ms[]);
-extern	void	vmputa(uint *sbase, uint row, uint col, uint *ma[], char *ms[]);
+extern	void	objclr(uint16_t obj);
+extern	void	objon(uint16_t obj, uint16_t line, uint16_t num);
+extern	void	objoff(uint16_t obj, uint16_t line, uint16_t num);
+extern	void	vcputs(int16_t *obase, int16_t nw, int16_t fg, int16_t bg, int16_t row, int16_t col, int8_t *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);
+extern	void	vwputm(uint16_t *obase, int16_t nw, int16_t fg, int16_t bg, int16_t row, int16_t col, int8_t *ml[]);
+extern	void	vmput(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t ma, int8_t *ms[]);
+extern	void	vmputa(uint16_t *sbase, uint16_t row, uint16_t col, uint16_t *ma[], int8_t *ms[]);
 extern	void	VSinit(void);
-extern	void	SelObj(int obj);
-extern	void	SetPri(int obj, int pri);
-extern	void	SetObj(int obj, int type, int bank, int xpix, int ypix, int x0, int y0, int flags, int pri, unsigned int *base);
-extern	void	CpyObj(unsigned *from, unsigned *to, unsigned w, unsigned h, unsigned sw);
+extern	void	SelObj(int16_t obj);
+extern	void	SetPri(int16_t obj, int16_t pri);
+extern	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);
+extern	void	CpyObj(uint16_t *from, uint16_t *to, uint16_t w, uint16_t h, uint16_t sw);
+
+
Index: include/vsddvars.h
===================================================================
--- include/vsddvars.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/vsddvars.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -10,5 +10,6 @@
 
 extern	struct	octent	*v_curob;	/* working object control pointer */
-extern	int	v_nobj;			/* working object number */
-extern	int	v_obpri;		/* working object priority */
+extern	int16_t	v_nobj;			/* working object number */
+extern	int16_t	v_obpri;		/* working object priority */
 
+
Index: include/wdcurtb.h
===================================================================
--- include/wdcurtb.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/wdcurtb.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -6,5 +6,5 @@
 */
 
-short	wdcurtb[] = {
+int16_t	wdcurtb[] = {
 
 	0x7FFF,		/*    0    64   1.00000000  1.00000000 */
@@ -147,5 +147,5 @@
 };
 
-short	wdcurct[8][2] = {
+int16_t	wdcurct[8][2] = {
 
 /*	{ np, inc}	   w */
Index: include/wordq.h
===================================================================
--- include/wordq.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/wordq.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -8,16 +8,17 @@
 struct	wordq {
 
-	unsigned short	qsize;		/* maximum queue length */
-	unsigned short	qlen;		/* current queue length */
-	unsigned short	qin;		/* in pointer */
-	unsigned short 	qout;		/* out pointer */
-	unsigned short	qhi;		/* high water mark */
-	unsigned short	qlo;		/* low water mark */
-	unsigned short	*qbuf;		/* base of queue */
+	uint16_t	qsize;		/* maximum queue length */
+	uint16_t	qlen;		/* current queue length */
+	uint16_t	qin;		/* in pointer */
+	uint16_t 	qout;		/* out pointer */
+	uint16_t	qhi;		/* high water mark */
+	uint16_t	qlo;		/* low water mark */
+	uint16_t	*qbuf;		/* base of queue */
 };
 
 #ifndef	WORDQHDR
-extern	short	putwq(struct wordq *qp, unsigned short c);
-extern	short	getwq(struct wordq *qp, unsigned short *p);
-extern	unsigned	short	setwq(struct wordq *qp, unsigned short *qadr, unsigned short qsiz, unsigned short hi, unsigned short lo);
+extern	int16_t	putwq(struct wordq *qp, uint16_t c);
+extern	int16_t	getwq(struct wordq *qp, uint16_t *p);
+extern	uint16_t	setwq(struct wordq *qp, uint16_t *qadr, uint16_t qsiz, uint16_t hi, uint16_t lo);
 #endif
+
Index: include/wsdsp.h
===================================================================
--- include/wsdsp.h	(revision 5c13d6473fc3b87b0f3add3efa9e24cfc9622d76)
+++ include/wsdsp.h	(revision bc11fc1450acb905f703961d148cb242b63fb6e0)
@@ -12,7 +12,7 @@
 struct	wstbl	{		/* waveshape table library entry */
 
-	short	final[NUMWPNT];		/* final values */
-	short	offset[NUMWPNT];	/* offset values */
-	short	harmon[NUMHARM];	/* harmonic values */
+	int16_t	final[NUMWPNT];		/* final values */
+	int16_t	offset[NUMWPNT];	/* offset values */
+	int16_t	harmon[NUMHARM];	/* harmonic values */
 };
 
