Index: ram/wheel.c
===================================================================
--- ram/wheel.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ ram/wheel.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -28,5 +28,5 @@
 #include "midas.h"
 
-extern	unsigned	setipl(unsigned arg);
+extern	uint16_t	setipl(uint16_t arg);
 
 #define	M_FL_CT		1024			/* mouse flush count */
@@ -66,36 +66,36 @@
 #endif
 
-short	M_error;		/* mouse I/F error code */
-short	M_state;		/* mouse state */
-short	M_oldbs;		/* previous mouse button state */
-
-char	M_strng[32];		/* mouse input string buffer */
-
-short	msctrl;			/* mouse control flag -- mouse update */
-short	msflag;			/* mouse control flag -- mouse movement */
-short	msrtag;			/* mouse control flag -- mouse reset */
-short	msxres;			/* mouse x residue */	
-short	msyres;			/* mouse y residue */
-short	msxmov;			/* mouse x movement */
-short	msymov;			/* mouse y movement */
-short	msxdiv;			/* mouse x divisor */
-short	msydiv;			/* mouse y divisor */
-
-short	tkboth;			/* both trackball axes went active */
-
-short	txdiv;			/* text cursor X divider */
-short	tydiv;			/* text cursor Y divider */
-
-short	tkxdvr = TKXDVR;	/* text cursor X divisor */
-short	tkydvr = TKYDVR;	/* text cursor Y divisor */
-
-short	tkhdvr = TKCDVR;	/* text cursor horizontal movement threshold */
-short	tkvdvr = TKCDVR;	/* text cursor vertical movement threshold */
-
-/* 
-
-*/
-
-short	msxgdv[13] = {		/* mouse x cursor divisor table */
+int16_t	M_error;		/* mouse I/F error code */
+int16_t	M_state;		/* mouse state */
+int16_t	M_oldbs;		/* previous mouse button state */
+
+int8_t	M_strng[32];		/* mouse input string buffer */
+
+int16_t	msctrl;			/* mouse control flag -- mouse update */
+int16_t	msflag;			/* mouse control flag -- mouse movement */
+int16_t	msrtag;			/* mouse control flag -- mouse reset */
+int16_t	msxres;			/* mouse x residue */	
+int16_t	msyres;			/* mouse y residue */
+int16_t	msxmov;			/* mouse x movement */
+int16_t	msymov;			/* mouse y movement */
+int16_t	msxdiv;			/* mouse x divisor */
+int16_t	msydiv;			/* mouse y divisor */
+
+int16_t	tkboth;			/* both trackball axes went active */
+
+int16_t	txdiv;			/* text cursor X divider */
+int16_t	tydiv;			/* text cursor Y divider */
+
+int16_t	tkxdvr = TKXDVR;	/* text cursor X divisor */
+int16_t	tkydvr = TKYDVR;	/* text cursor Y divisor */
+
+int16_t	tkhdvr = TKCDVR;	/* text cursor horizontal movement threshold */
+int16_t	tkvdvr = TKCDVR;	/* text cursor vertical movement threshold */
+
+/* 
+
+*/
+
+int16_t	msxgdv[13] = {		/* mouse x cursor divisor table */
 
 	1,	/* -1 -- Main menu */
@@ -114,5 +114,5 @@
 };
 
-short	msygdv[13] = {		/* mouse y cursor divisor table */
+int16_t	msygdv[13] = {		/* mouse y cursor divisor table */
 
 	2,	/* -1 -- Main menu */
@@ -144,83 +144,83 @@
 extern	void	(*x_key)(void);
 
-extern	short	asig;
-extern	short	astat;
-extern	short	aval;
-extern	short	chtime;
-extern	short	chwait;
-extern	short	clkctl;
-extern	short	clkrun;
-extern	short	cmfirst;
-extern	short	cmtype;
-extern	short	ctrsw;
-extern	short	curhold;
-extern	short	cvtime;
-extern	short	cvwait;
-extern	short	cxrate;
-extern	short	cxval;
-extern	short	cyrate;
-extern	short	cyval;
-extern	short	msctrl;
-extern	short	msflag;
-extern	short	msxdiv;
-extern	short	msydiv;
-extern	short	nchwait;
-extern	short	ncvwait;
-extern	short	ndisp;
-extern	short	ss_ptsw;
-extern	short	ss_sqsw;
-extern	short	stccol;
-extern	short	stcrow;
-extern	short	swback;
-extern	short	swctrl;
-extern	short	swdelta;
-extern	short	swdir;
-extern	short	swfiin;
-extern	short	swflag;
-extern	short	swlast;
-extern	short	swndx;
-extern	short	swstop;
-extern	short	swthr;
-extern	short	swtime;
-extern	short	swwait;
-
-/* 
-
-*/
-
-extern	short	tkback;
-extern	short	tkctrl;
-extern	short	tkrmin;
-extern	short	tkthr;
-extern	short	tktime;
-extern	short	tkwait;
-extern	short	trkball;
-extern	short	txfiin;
-extern	short	txflag;
-extern	short	txlast;
-extern	short	tyfiin;
-extern	short	tyflag;
-extern	short	tylast;
-extern	short	txstop;
-extern	short	tystop;
-extern	short	vtccol;
-extern	short	vtcrow;
-extern	short	vtpcol;
-extern	short	vtprow;
-extern	short	xkstat;
-extern	short	ykstat;
-
-extern	long	swcount;
-extern	long	swrate;
-extern	long	swrmin;
-extern	long	swtemp;
-
-extern	short	*cratex;
-extern	short	*cratey;
-
-extern	short	sigtab[][2];
-extern	short	swfifo[NSWFIFO];
-extern	short	txfifo[NTKFIFO];
-extern	short	tyfifo[NTKFIFO];
+extern	int16_t	asig;
+extern	int16_t	astat;
+extern	int16_t	aval;
+extern	int16_t	chtime;
+extern	int16_t	chwait;
+extern	int16_t	clkctl;
+extern	int16_t	clkrun;
+extern	int16_t	cmfirst;
+extern	int16_t	cmtype;
+extern	int16_t	ctrsw;
+extern	int16_t	curhold;
+extern	int16_t	cvtime;
+extern	int16_t	cvwait;
+extern	int16_t	cxrate;
+extern	int16_t	cxval;
+extern	int16_t	cyrate;
+extern	int16_t	cyval;
+extern	int16_t	msctrl;
+extern	int16_t	msflag;
+extern	int16_t	msxdiv;
+extern	int16_t	msydiv;
+extern	int16_t	nchwait;
+extern	int16_t	ncvwait;
+extern	int16_t	ndisp;
+extern	int16_t	ss_ptsw;
+extern	int16_t	ss_sqsw;
+extern	int16_t	stccol;
+extern	int16_t	stcrow;
+extern	int16_t	swback;
+extern	int16_t	swctrl;
+extern	int16_t	swdelta;
+extern	int16_t	swdir;
+extern	int16_t	swfiin;
+extern	int16_t	swflag;
+extern	int16_t	swlast;
+extern	int16_t	swndx;
+extern	int16_t	swstop;
+extern	int16_t	swthr;
+extern	int16_t	swtime;
+extern	int16_t	swwait;
+
+/* 
+
+*/
+
+extern	int16_t	tkback;
+extern	int16_t	tkctrl;
+extern	int16_t	tkrmin;
+extern	int16_t	tkthr;
+extern	int16_t	tktime;
+extern	int16_t	tkwait;
+extern	int16_t	trkball;
+extern	int16_t	txfiin;
+extern	int16_t	txflag;
+extern	int16_t	txlast;
+extern	int16_t	tyfiin;
+extern	int16_t	tyflag;
+extern	int16_t	tylast;
+extern	int16_t	txstop;
+extern	int16_t	tystop;
+extern	int16_t	vtccol;
+extern	int16_t	vtcrow;
+extern	int16_t	vtpcol;
+extern	int16_t	vtprow;
+extern	int16_t	xkstat;
+extern	int16_t	ykstat;
+
+extern	int32_t	swcount;
+extern	int32_t	swrate;
+extern	int32_t	swrmin;
+extern	int32_t	swtemp;
+
+extern	int16_t	*cratex;
+extern	int16_t	*cratey;
+
+extern	int16_t	sigtab[][2];
+extern	int16_t	swfifo[NSWFIFO];
+extern	int16_t	txfifo[NTKFIFO];
+extern	int16_t	tyfifo[NTKFIFO];
 
 #include "swrtab.h"		/* long swrtab[128]; */
@@ -236,7 +236,7 @@
 */
 
-void MouseRT(unsigned short t)
-{
-	unsigned short oldi;
+void MouseRT(uint16_t t)
+{
+	uint16_t oldi;
 
 	oldi = setipl(TIM_DI);		/* disable interrupts */
@@ -262,9 +262,9 @@
 */
 
-int MouseRD(char *str, short nc, short nt)
-{
-	long tc;
-
-	tc = nt * (long)C_PER_S;
+int16_t MouseRD(int8_t *str, int16_t nc, int16_t nt)
+{
+	int32_t tc;
+
+	tc = nt * (int32_t)C_PER_S;
 
 	while (nc > 0) {
@@ -272,5 +272,5 @@
 		if (BIOS(B_RDAV, PRT_DEV)) {
 
-			*str++ = (char)BIOS(B_GETC, PRT_DEV);
+			*str++ = (int8_t)BIOS(B_GETC, PRT_DEV);
 			*str = '\0';
 			--nc;
@@ -292,7 +292,7 @@
 */
 
-void MouseWR(char *str)
-{
-	register unsigned short c;
+void MouseWR(int8_t *str)
+{
+	register uint16_t c;
 
 #if	DEBUGMS
@@ -315,7 +315,7 @@
 */
 
-short MouseFL(short tc)
-{
-	long flushed;
+int16_t MouseFL(int16_t tc)
+{
+	int32_t flushed;
 
 	flushed = 0L;				/* reset the flush counter */
@@ -359,7 +359,7 @@
 */
 
-short MouseWK(void)
-{
-	short tries;
+int16_t MouseWK(void)
+{
+	int16_t tries;
 
 	M_error = M_NONE;		/* reset mouse error flag */
@@ -430,7 +430,7 @@
 */
 
-void MouseEX(char *str)
-{
-	unsigned short oldi, msc, mst;
+void MouseEX(int8_t *str)
+{
+	uint16_t oldi, msc, mst;
 
 #if	DEBUGMS
@@ -568,5 +568,5 @@
 */
 
-void MouseIN(short c)
+void MouseIN(int16_t c)
 {
 	c &= 0x00FF;		/* mask off extraneous bits from mouse input */
@@ -659,5 +659,5 @@
 void wheel(void)
 {
-	register short i, oldi;
+	register int16_t i, oldi;
 
 	if (astat) {	/* if it's touched ... */
@@ -782,5 +782,5 @@
 void txyup(void)
 {
-	register short txndx, tyndx, txrate, tyrate;
+	register int16_t txndx, tyndx, txrate, tyrate;
 
 #if	DEBUGTF
@@ -861,5 +861,5 @@
 void txydn(void)
 {
-	register short i;
+	register int16_t i;
 
 #if	DEBUGTK
@@ -903,5 +903,5 @@
 void txstd(void)
 {
-	register short i, oldcx, oldi, txdelta, txcdvr;
+	register int16_t i, oldcx, oldi, txdelta, txcdvr;
 
 	trkball = TRUE;				/* set trackball mode */
@@ -999,5 +999,5 @@
 void tystd(void)
 {
-	register short i, oldcy, oldi, tydelta, tycdvr;
+	register int16_t i, oldcy, oldi, tydelta, tycdvr;
 
 	trkball = TRUE;				/* set trackball mode */
@@ -1093,7 +1093,7 @@
 void curproc(void)
 {
-	register short i, cxprev, cyprev;
-	short oldcx, oldcy;
-	register unsigned short oldi;
+	register int16_t i, cxprev, cyprev;
+	int16_t oldcx, oldcy;
+	register uint16_t oldi;
 
 	/* SET CURRENT WAIT COUNTS FROM TIMERS */
@@ -1139,5 +1139,5 @@
 	if (BIOS(B_RDAV, PRT_DEV)) {
 
-		MouseIN((short)BIOS(B_GETC, PRT_DEV));
+		MouseIN((int16_t)BIOS(B_GETC, PRT_DEV));
 
 		MouseRT(MATIME);	/* reset mouse activity timer */
