Index: ram/instdsp.c
===================================================================
--- ram/instdsp.c	(revision 0c834c599f225d78f3cee559f0421011b124be6d)
+++ ram/instdsp.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -30,29 +30,29 @@
 /* things defined elsewhere */
 
-extern	void	(*point)(short x, short y, short pen);
+extern	void	(*point)(int16_t x, int16_t y, int16_t pen);
 
 extern	void	fpuint(void);
-extern	unsigned	setipl(unsigned arg);
-extern	void	cnvc2p(char *buf, short cv);
-
-extern	unsigned	tofpu(unsigned time);
-extern	unsigned	fromfpu(unsigned fputime);
-extern	unsigned	exp_c(unsigned c);
-
-extern	char	*dsimlt(char *buf, short src, short mltval);
-
-extern	long	rand24(void);
-
-/* 
-
-*/
-
-extern	short	cxval, cyval, stcrow, stccol, initcfg;
-extern	short	curslim, idimsw;
-
-extern	unsigned	*obj0, *obj2;
-
-extern	char	bfs[], *srctbl[], sfdsp[];
-extern	char	vtlin1[], vtlin2[], vtlin3[];
+extern	uint16_t	setipl(uint16_t arg);
+extern	void	cnvc2p(int8_t *buf, int16_t cv);
+
+extern	uint16_t	tofpu(uint16_t time);
+extern	uint16_t	fromfpu(uint16_t fputime);
+extern	uint16_t	exp_c(uint16_t c);
+
+extern	int8_t	*dsimlt(int8_t *buf, int16_t src, int16_t mltval);
+
+extern	int32_t	rand24(void);
+
+/* 
+
+*/
+
+extern	int16_t	cxval, cyval, stcrow, stccol, initcfg;
+extern	int16_t	curslim, idimsw;
+
+extern	uint16_t	*obj0, *obj2;
+
+extern	int8_t	bfs[], *srctbl[], sfdsp[];
+extern	int8_t	vtlin1[], vtlin2[], vtlin3[];
 
 extern	struct	sment	sments[];
@@ -60,28 +60,28 @@
 extern	struct	sment	*vpsms[];
 
-extern	short	s_inst[], vce2trg[], vce2grp[];
-
-extern	short	curfunc;	/* current function number */
-extern	short	curinst;	/* current instrument number */
-extern	short	curpnt;		/* current point number (absolute) */
-extern	short	curvce;		/* current voice number */
-extern	short	idcfsw;		/* copy / fetch menu switch */
-extern	short	idintmp;	/* temporary for instrument number */
-extern	short	idnamsw;	/* typewriter switch */
-extern	short	idsrcsw;	/* source menu switch */
-extern	short	npts;		/* number of points in function */
-extern	short	pecase;		/* point edit case variable */
-extern	short	pntsv;		/* point selection state variable */
-extern	short	subj;		/* edited point number (relative) */
-extern	short	submenu;	/* submenu cursor switch */
-extern	short	temax;		/* time upper limit */
-extern	short	temin;		/* time lower limit */
-extern	short	vlbtype;	/* type of message window display */
-extern	short	wcflag;		/* ws/cf menu type */
-extern	short	wcpage;		/* ws/cf menu page */
-
-extern	short	instmod[12];	/* intrument data modified */
-
-extern	unsigned *instob;	/* instrument object pointer */
+extern	int16_t	s_inst[], vce2trg[], vce2grp[];
+
+extern	int16_t	curfunc;	/* current function number */
+extern	int16_t	curinst;	/* current instrument number */
+extern	int16_t	curpnt;		/* current point number (absolute) */
+extern	int16_t	curvce;		/* current voice number */
+extern	int16_t	idcfsw;		/* copy / fetch menu switch */
+extern	int16_t	idintmp;	/* temporary for instrument number */
+extern	int16_t	idnamsw;	/* typewriter switch */
+extern	int16_t	idsrcsw;	/* source menu switch */
+extern	int16_t	npts;		/* number of points in function */
+extern	int16_t	pecase;		/* point edit case variable */
+extern	int16_t	pntsv;		/* point selection state variable */
+extern	int16_t	subj;		/* edited point number (relative) */
+extern	int16_t	submenu;	/* submenu cursor switch */
+extern	int16_t	temax;		/* time upper limit */
+extern	int16_t	temin;		/* time lower limit */
+extern	int16_t	vlbtype;	/* type of message window display */
+extern	int16_t	wcflag;		/* ws/cf menu type */
+extern	int16_t	wcpage;		/* ws/cf menu page */
+
+extern	int16_t	instmod[12];	/* intrument data modified */
+
+extern	uint16_t *instob;	/* instrument object pointer */
 
 extern	struct	octent *idoct;		/* instrument display octent pointer */
@@ -91,8 +91,8 @@
 extern	struct	instdef	vbufs[12];	/* voice instrument buffers */
 
-extern	char	*funcndx[256][2];	/* function header pointers */
-extern	char	*vlbptr[3];		/* variable label pointers */
-
-extern	char	idbuf[65];		/* display conversion work area */
+extern	int8_t	*funcndx[256][2];	/* function header pointers */
+extern	int8_t	*vlbptr[3];		/* variable label pointers */
+
+extern	int8_t	idbuf[65];		/* display conversion work area */
 
 /* 
@@ -102,7 +102,7 @@
 /* forward references */
 
-void	idpoint(short x, short y, short pen);
-
-short	idbox[][8] = {	/* display box parameters */
+void	idpoint(int16_t x, int16_t y, int16_t pen);
+
+int16_t	idbox[][8] = {	/* display box parameters */
 
 	{  1,   1,  84,  26, CFBX00, CBBX00,  0,  1},	/*  0: Freq 1 */
@@ -144,5 +144,5 @@
 /* instrument function to FPU function table */
 
-short	fnoff[NFINST] = {
+int16_t	fnoff[NFINST] = {
 
 	1,	/*  0: Freq 1 */
@@ -161,5 +161,5 @@
 };
 
-short	inspal[16][3] = {	/* instrument display color palette */
+int16_t	inspal[16][3] = {	/* instrument display color palette */
 
 	{0, 0, 0},	/*  0 */
@@ -185,5 +185,5 @@
 */
 
-char	*idbxlbl[] = {	/* display box labels */
+int8_t	*idbxlbl[] = {	/* display box labels */
 
 	"    Frq 1",		/*  0 */
@@ -213,9 +213,9 @@
 };
 
-char idhlbl[] =		/* main function time axis label */
+int8_t idhlbl[] =		/* main function time axis label */
 	"       \324\302     \325\305     \326      \301      \302      \304      \310     \321\306    \323\302";
 
 
-char	*osclbl[] = {	/* oscillator mode labels */
+int8_t	*osclbl[] = {	/* oscillator mode labels */
 			/* NOTE: must match values in instdsp.h */
 
@@ -230,5 +230,5 @@
 */
 
-long	rngdiv[] = {	/* divisors for ranges of 0..9 */
+int32_t	rngdiv[] = {	/* divisors for ranges of 0..9 */
 
 	MAXRAND,		/* 0..0 */
@@ -254,7 +254,7 @@
 */
 
-void drawpt(short px, short py, short pc)
-{
-	register short tmp;
+void drawpt(int16_t px, int16_t py, int16_t pc)
+{
+	register int16_t tmp;
 
 	tmp = px - 1;
@@ -291,12 +291,12 @@
 */
 
-void drawfn(short fn, short how, short pen, short wn)
+void drawfn(int16_t fn, int16_t how, int16_t pen, int16_t wn)
 {
 	struct idfnhdr *fp;
 	struct instdef *ip;
 	register struct instpnt *pt1, *pt2;
-	register short i, npt1, npt2, xp;
-	register unsigned color;
-	short np, ptx, pty, ptc;
+	register int16_t i, npt1, npt2, xp;
+	register uint16_t color;
+	int16_t np, ptx, pty, ptc;
 
 	ip = &vbufs[curvce];
@@ -413,14 +413,14 @@
 */
 
-short addpch(short p1, short p2)
-{
-	register long pl;
-
-	pl = ((((long)p1 >> 5) - 500L) << LSPCH) + (long)p2;
+int16_t addpch(int16_t p1, int16_t p2)
+{
+	register int32_t pl;
+
+	pl = ((((int32_t)p1 >> 5) - 500L) << LSPCH) + (int32_t)p2;
 
 	if (pl > PITCHMAX)
 		pl = PITCHMAX;
 
-	return((short)pl);
+	return((int16_t)pl);
 }
 
@@ -435,5 +435,5 @@
 */
 
-short irand(short range)
+int16_t irand(int16_t range)
 {
 	if (range LE 0)		/* limit things to 'reasonable' values */
@@ -443,5 +443,5 @@
 		range = 9;
 
-	return((short)(rand24() / rngdiv[range]));
+	return((int16_t)(rand24() / rngdiv[range]));
 }
 
@@ -456,12 +456,12 @@
 */
 
-short xgetran(short mlt)
-{
-	register short sltmp;
-
-	sltmp = (short)rand24();
+int16_t xgetran(int16_t mlt)
+{
+	register int16_t sltmp;
+
+	sltmp = (int16_t)rand24();
 
 	if (mlt < 0)
-		sltmp += (short)rand24();
+		sltmp += (int16_t)rand24();
 
 	return(sltmp);
@@ -478,7 +478,7 @@
 */
 
-void dosync(short vce)
-{
-	register short sync;
+void dosync(int16_t vce)
+{
+	register int16_t sync;
 	register struct instdef *ip;
 
@@ -495,5 +495,5 @@
 		sync |= 0x8000;
 
-	*(io_fpu + vce + (long)FPU_OCFG) = sync;
+	*(io_fpu + vce + (int32_t)FPU_OCFG) = sync;
 }
 
@@ -508,7 +508,7 @@
 */
 
-void oscdsp(short row, short val, short n, short frq, char *lbl)
-{
-		register short fh, fl;
+void oscdsp(int16_t row, int16_t val, int16_t n, int16_t frq, int8_t *lbl)
+{
+		register int16_t fh, fl;
 
 		tsplot4(instob, 64, idbox[n][4], row, 34, lbl, 14);
@@ -576,7 +576,7 @@
 */
 
-void pltws(unsigned ws[], short pen)
-{
-	register short i, x, y;
+void pltws(uint16_t ws[], int16_t pen)
+{
+	register int16_t i, x, y;
 
 	for (i = 1; i < 254; i++) {
@@ -599,10 +599,10 @@
 */
 
-void dswin(short n)
-{
-	short th, tl, vh, vl, vv, mltval, lboff;
-	char *s1, mltstr[6], mltsgn;
-	long tt, sc;
-	register short cx, pnt, par;
+void dswin(int16_t n)
+{
+	int16_t th, tl, vh, vl, vv, mltval, lboff;
+	int8_t *s1, mltstr[6], mltsgn;
+	int32_t tt, sc;
+	register int16_t cx, pnt, par;
 	register struct instdef *ip;
 	register struct idfnhdr *fp;
@@ -881,5 +881,5 @@
 void allwins(void)
 {
-	register short i;
+	register int16_t i;
 
 	for (i = 0; i < 24; i++)
@@ -893,5 +893,5 @@
 */
 
-void idpoint(short x, short y, short pen)
+void idpoint(int16_t x, int16_t y, int16_t pen)
 {
 	if (v_regs[5] & 0x0180)
