Index: ram/im700.c
===================================================================
--- ram/im700.c	(revision 6dd74a91deaf351eb39ff277233faa17ef83cab5)
+++ ram/im700.c	(revision 7258c6ac4de2518c5430095742a27be7af0c89d7)
@@ -44,8 +44,8 @@
 #include "wsdsp.h"
 
-extern	unsigned	tofpu(unsigned time);
+extern	uint16_t	tofpu(uint16_t time);
 
 extern	void	nokey(void);
-extern	short	nonf(short k);
+extern	int16_t	nonf(int16_t k);
 extern	void	stdmkey(void);
 extern	void	cxkstd(void);
@@ -54,38 +54,38 @@
 extern	void	cygen(void);
 extern	void	cmvgen(void);
-extern	short	stdctp2(void);
-
-extern	short	blakpal[16][3];
+extern	int16_t	stdctp2(void);
+
+extern	int16_t	blakpal[16][3];
 
 extern	LPF	t_prmtr[];
 
-extern	char	*funcndx[256][2];
-
-extern	char	keystat[24];
-extern	char	ldcmnt[38];
-extern	char	ldfile[9];
-extern	char	loadedc[NLTYPES][37];
-extern	char	loadedf[NLTYPES][8];
-extern	char	masens[3];
-extern	char	mctlval[NCTRLS];
-extern	char	mdbyte[3];
-extern	char	mpsust[48];
-extern	char	mrstat[3];
-extern	char	trgtab[NTRIGS];
-
-extern	short	fnoff[];
-
-extern	short	articen[12];		/* voice articulation enable status */
-extern	short	grpmode[12];		/* group mode - 0 = play, 1 = stdby, 2 = rec */
-extern	short	grpsel[12];		/* group select status for instrument selection */
-extern	short	grpstat[12];		/* group status - 0 = off, non-0 = on */
-extern	short	gtctab[12];		/* group to color table */
-extern	short	lastvce[12];		/* last voice assigned in each group */
-extern	short	lastvel[12];		/* last velocity sent to group */
-extern	short	mpbend[48];		/* MIDI pitch bend data, by port and channel */
-extern	short	msmstv[3];		/* MIDI state machine state variables */
-extern	short	prstab[NTRIGS];		/* pressure */
-extern	short	vce2trg[12];		/* voice to trigger map (-1 EQ NULL) */
-extern	short	veltab[NTRIGS];		/* velocity */
+extern	int8_t	*funcndx[256][2];
+
+extern	int8_t	keystat[24];
+extern	int8_t	ldcmnt[38];
+extern	int8_t	ldfile[9];
+extern	int8_t	loadedc[NLTYPES][37];
+extern	int8_t	loadedf[NLTYPES][8];
+extern	int8_t	masens[3];
+extern	int8_t	mctlval[NCTRLS];
+extern	int8_t	mdbyte[3];
+extern	int8_t	mpsust[48];
+extern	int8_t	mrstat[3];
+extern	int8_t	trgtab[NTRIGS];
+
+extern	int16_t	fnoff[];
+
+extern	int16_t	articen[12];		/* voice articulation enable status */
+extern	int16_t	grpmode[12];		/* group mode - 0 = play, 1 = stdby, 2 = rec */
+extern	int16_t	grpsel[12];		/* group select status for instrument selection */
+extern	int16_t	grpstat[12];		/* group status - 0 = off, non-0 = on */
+extern	int16_t	gtctab[12];		/* group to color table */
+extern	int16_t	lastvce[12];		/* last voice assigned in each group */
+extern	int16_t	lastvel[12];		/* last velocity sent to group */
+extern	int16_t	mpbend[48];		/* MIDI pitch bend data, by port and channel */
+extern	int16_t	msmstv[3];		/* MIDI state machine state variables */
+extern	int16_t	prstab[NTRIGS];		/* pressure */
+extern	int16_t	vce2trg[12];		/* voice to trigger map (-1 EQ NULL) */
+extern	int16_t	veltab[NTRIGS];		/* velocity */
 
 /* 
@@ -97,13 +97,13 @@
 
 extern	void	(*curmove)(void);	/* cursor move function */
-extern	short	(*curtype)(void);	/* cursor type function */
+extern	int16_t	(*curtype)(void);	/* cursor type function */
 extern	void	(*cx_key)(void);	/* x rate calculation */
 extern	void	(*cx_upd)(void);	/* x update */
 extern	void	(*cy_key)(void);	/* y rate calculation */
 extern	void	(*cy_upd)(void);	/* y update */
-extern	void	(*d_key)(short k);	/* in-field data key processor */
+extern	void	(*d_key)(int16_t k);	/* in-field data key processor */
 extern	void	(*e_key)(void);		/* E key processor */
 extern	void	(*m_key)(void);		/* M key processor */
-extern	short	(*not_fld)(short k);	/* not-in-field data key processor */
+extern	int16_t	(*not_fld)(int16_t k);	/* not-in-field data key processor */
 extern	void	(*premove)(void);	/* cursor pre-move function */
 extern	void	(*pstmove)(void);	/* cursor post-move function */
@@ -112,266 +112,266 @@
 extern	void	(*xy_up)(void);		/* cursor - finger off (up) */
 
-extern	short	*cratex;		/* cursor x rate table pointer */
-extern	short	*cratey;		/* cursor x rate table pointer */
-
-short	admctl;			/* assignment display submenu control variable */
-short	adnamsw;		/* assignment display virtual typewriter flag */
-short	aflag;			/* analog activity flag */
-short	aform;			/* action buffer format */
-short	amplval;		/* amplitude */
-short	ancmsw;			/* analog variable r/p control source */
-short	angroup;		/* analog variable group being shown */
-short	asgfks;			/* first key selected */
-short	asghit;			/* row hit / assignment in progress */
-short	asgmod;			/* assignment number or table modified */
-short	asig;			/* analog signal number */
-short	asmode;			/* panel assignment mode */
-short	astat;			/* analog signal status */
-short	auxctl;			/* aux control flag */
-short	aval;			/* analog signal value */
-short	bform;			/* oscillator data buffer format */
-short	catin;			/* catalog read in flag */
-short	cents;			/* pitch to cents conversion buffer */
-short	chtime;			/* horizontal cursor counter */
-short	chwait;			/* horizontal cursor wait time */
-short	cflag;			/* accidental flag */
-short	clkctl;			/* clock control */
-short	clkrun;			/* clock status */
-short	clksrc;			/* clock source */
-short	cmfirst;		/* first cursor motion switch */
-short	cmtype;			/* cursor motion type */
-short	cnote;			/* note value at cursor */
-short	ctrsw;			/* scupd center update switch */
-short	curasg;			/* current assignment table */
-short	curfunc;		/* current function number */
-short	curgrp;			/* current group */
-short	curinst;		/* current instrument number */
-short	curmop;			/* current MIDI output port */
-short	curpnt;			/* current point number (absolute) */
-short	curpos;			/* cursor pad position for current axis */
-short	cursbox;		/* currently selected box */
-short	curscor;		/* Current score number */
-short	cursect;		/* current section */
-short	curslim;		/* cursor type change point */
-short	curtun;			/* current tuning table */
-short	curvce;			/* current voice number */
-short	curwave;		/* current waveshape library slot */
-short	curwdth;		/* current waveshape cursor width */
-short	curwfnl;		/* current waveshape final value */
-short	curwhrm;		/* current waveshape harmonic number */
-short	curwhrv;		/* current waveshape harmonic value */
-short	curwoff;		/* current waveshape offset value */
-short	curwpnt;		/* current waveshape point number */
-short	curwslt;		/* current waveshape instrument slot */
-short	cvtime;			/* vertical cursor counter */
-short	cvwait;			/* veritcal cursor wait time */
-short	cxrate;			/* cursor x rate */
-short	cxval;			/* graphic cursor x value */
-short	cyrate;			/* cursor y rate */
-short	cyval;			/* graphic cursor y value */
-short	debugne;		/* debug flag for note entry */
-short	defect;			/* defect code */
-short	dferror;		/* error code from BIOS or XBIOS */
-short	dfsides;		/* number of sides */
-short	dftype;			/* disk type code */
-short	dsp_ok;			/* display update OK this cycle flag */
-short	dubsw;			/* overdub / replace switch */
-short	ebflag;			/* edit buffer data flag */
-short	editss;			/* edit panel switch state */
-short	editsw;			/* edit mode switch */
-short	endflg;			/* !end flag */
-short	ext_cv1;		/* CV-1 value */
-short	ext_cv2;		/* CV-2 value */
-short	ext_cv3;		/* CV-3 value */
-short	ext_cv4;		/* CV-4 value */
-short	ext_mod;		/* Aux Signal Mod value */
-short	gomode;			/* go to mode */
-short	grptran;		/* group translation value */
-short	gtmsel;			/* group transpose/map select */
-short	hitbox;			/* box we just hit */
-short	hitcx;			/* x of cursor when we hit the box */
-short	hitcy;			/* y of cursor when we hit the box */
-short	idcfsw;			/* copy / fetch menu switch */
-short	idimsw;			/* instrument display instrument menu switch */
-short	idintmp;		/* temporary for instrument number */
-short	idnamsw;		/* typewriter switch */
-short	idsrcsw;		/* source menu switch */
-short	idtdat;			/* current instrument vtyper data entry string */
-short	imflag;			/* instrument modified flag */
-short	initcfg;		/* initial configuration */
-short	insmode;		/* score insert mode */
-short	ismode;			/* instrument select mode */
-short	lampio;			/* LCD timeout disable switch state at I/O time */
-short	lampsw;			/* LCD timeout disable switch */
-short	lasgsw;			/* assignments store switch */
-short	lastam;			/* last assignment menu base */
-short	ldelsw;			/* delete switch */
-short	lderrsw;		/* error message displayed switch */
-short	ldidsiz;		/* getcat() did showsiz() switch */
-short	ldkind;			/* fetch file type */
-short	ldpass;			/* librarian load state variable */
-short	ldrow;			/* fetch select row */
-short	ldslot;			/* fetch select slot */
-short	legato;			/* execkey() "legato" mode switch */
-short	lksel;			/* librarian key slot selector */
-short	lmwtype;		/* librarian message window type */
-short	loadrow;		/* librarian row selected for load letter */
-short	loadsw;			/* panel "Load" mode state */
-short	lorchl;			/* load hi (TRUE) / lo (FALSE) orchestra */
-short	lorchsw;		/* hi orchestra (21 - 40) store switch */
-short	lorclsw;		/* lo orchestra (01 - 20) store switch */
-short	lpatsw;			/* patch table store switch */
-short	lrasw;			/* append (TRUE) / replace (FALSE) score */
-short	lscrsw;			/* score store switch */
-short	lselsw;			/* fetch select switch */
-short	lseqsw;			/* sequence table store switch */
-short	lstbgnc;		/* last note begin entry table index */
-short	lstendc;		/* last note end entry table index */
-short	lstflag;		/* last note list end switch */
-short	lstrsw;			/* store state switch */
-short	lstwoff;		/* last waveshape offset value */
-short	lstwpnt;		/* last waveshape point number */
-short	ltagged;		/* load tag switch */
-short	ltunsw;			/* tunings store switch */
-short	lwavsw;			/* waveshapes store switch */
-short	mascntr;		/* MIDI active sensing timeout counter */
-short	mdb1;			/* current MIDI data byte 1 */
-short	mdb2;			/* current MIDI data byte 2 */
-short	michan;			/* current MIDI channel */
-short	midiclk;		/* MIDI clock switch */
-short	midigo;			/* MIDI run switch */
-short	mistat;			/* current MIDI status */
-short	nchwait;		/* next chwait value */
-short	ncvwait;		/* next cvwait value */
-short	ndisp;			/* current display number */
-short	newflag;		/* new data entered while t_cur EQ t_ctr */
-short	nkdown;			/* number of keys down */
-short	notenum;		/* note number */
-short	noteop;			/* pending note operation code */
-short	notepit;		/* note pitch */
-short	notesel;		/* note selection state */
-short	npts;			/* number of points in function */
-short	nxtflag;		/* next score flag */
-short	oldltag;		/* previous load tag for tagslot */
-short	oldpk;			/* previous pkctrl state */
-short	oldsl;			/* previous sliders state */
-short	pchsw;			/* punch-in enable switch */
-short	pecase;			/* point edit case variable */
-short	pkctrl;			/* local performance key state */
-short	pntsv;			/* point selection state variable */
-short	prgchan;		/* MIDI program change channel  (port 1) */
-short	ps_dpth;		/* phase shifter -- depth */
-short	ps_intn;		/* phase shifter -- intensity */
-short	ps_rate;		/* phase shifter -- rate */
-short	pulsclk;		/* pulse clock state */
-short	recsw;			/* record / play switch */
-short	runit;			/* run switch for main scan loop */
-short	sbase;			/* score VSDD RAM scroll offset */
-short	scmctl;			/* score submenu control flag */
-short	scrlpot;		/* scroll pot state */
-short	sd;			/* score display direction */
-short	se;			/* score execution direction */
-short	sdmcol;			/* score menu - saved stccol */
-short	sdmctl;			/* score menu - control variable */
-short	sdmrow;			/* score menu - saved stcrow */
-short	secop;			/* pending score section operation */
-short	secopok;		/* section operation OK flag */
-short	sgcsw;			/* graphic cursor display switch */
-short	sgoflag;		/* section number relative column 0..3 */
-short	sharp;			/* sharp flag */
-short	sliders;		/* slider and switch state */
-short	soffset;		/* score scroll offset */
-short	ss_ptsw;		/* smooth scroll patch scroll switch */
-short	ss_sqsw;		/* smooth scroll sequence scroll switch */
-short	stccol;			/* score cursor col */
-short	stcrow;			/* score cursor row */
-short	stepclk;		/* note entry - step clock state */
-short	stepenb;		/* note entry - step enable flag */
-short	stepint;		/* note entry - note interval */
-short	stepwgt;		/* note entry - note weight */
-short	subj;			/* edited point number (relative) */
-short	submenu;		/* submenu active switch */
-short	swctrl;			/* scroll wheel 'srolling' flag */
-short	swdelta;		/* scroll wheel change while touched */
-short	swdir;			/* scroll wheel direction */
-short	swfiin;			/* scroll wheel fifo input pointer */
-short	swflag;			/* scroll wheel touched flag */
-short	swlast;			/* scroll wheel last value */
-short	swstop;			/* scroll wheel stop flag */
-short	swndx;			/* scroll wheel look back index */
-short	tagslot;		/* tagged load slot */
-short	tdnamsw;		/* tuning editor displaying typewriter */
-short	temax;			/* time upper limit */
-short	temin;			/* time lower limit */
-short	testing;		/* test level */
-short	tglclk;			/* clock on/off toggle flag */
-short	tglpch;			/* punch in/out toggle flag */
-short	thescore;		/* score selected from sqscan */
-short	timemlt;		/* time scaling */
-short	tkctrl;			/* trackball active flag */
-short	tmpomlt;		/* tempo multiplier */
-short	tmpoval;		/* tempo value */
-short	trkball;		/* trackball selected switch */
-short	ttcmdsv;		/* tuning editor edit state variable */
-short	ttsel1;			/* tuning editor key select variable 1 */
-short	ttsel2;			/* tuning editor key select variable 2 */
-short	ttsel3;			/* tuning editor key select variable 3 */
-short	tuneval;		/* fine tuning */
-short	tunmod;			/* tuning table modified */
-short	tunval;			/* tuning editor increment / transpose  value */
-short	txfiin;			/* trackball x fifo input pointer */
-short	txflag;			/* trackball x axis active flag */
-short	txlast;			/* trackball x axis last value */
-short	txstop;			/* trackball x axis filter counter */
-short	tyfiin;			/* trackball y fifo input pointer */
-short	tyflag;			/* trackball y axis active flag */
-short	tylast;			/* trackball y axis last value */
-short	tystop;			/* trackball y axis filter counter */
-short	velflag;		/* velocity display flag */
-short	verbose;		/* verbose output switch */
-short	vlbtype;		/* type of message window display */
-short	vrbw08;			/* score display video reset detail word */
-short	vrbw09;			/* score display video reset detail word */
-short	vrbw10;			/* score display video reset detail word */
-short	vrbw11;			/* score display video reset detail word */
-short	vrbw12;			/* score display video reset detail word */
-short	vrbw13;			/* score display video reset detail word */
-short	vrbw14;			/* score display video reset detail word */
-short	vrbw15;			/* score display video reset detail word */
-short	vrcw;			/* score display video reset control word */
-short	vtccol;			/* virtual typewriter cursor column */
-short	vtcrow;			/* virtual typewriter cursor row */
-char	vtdechr;		/* virtual typewriter data entry character */
-short	vtdecol;		/* virtual typewriter data entry column */
-short	vtpcol;			/* virtual typewriter column */
-short	vtprow;			/* virtual typewriter row */
-short	vtwcol;			/* virtual typewriter window left column */
-short	vtwrow;			/* virtual typewriter window top row */
-short	vtxval;			/* virtual typewriter cursor x value */
-short	vtyval;			/* virtual typewriter cursor y value */
-short	wcflag;			/* ws/cf menu select flag (cf=0, ws=1) */
-short	wcmcol;			/* ws/cf menu label column */
-short	wcmrow;			/* ws/cf menu label row */
-short	wcpage;			/* ws/cf menu page */
-short	wdupdfl;		/* waveshape display needs updated flag */
-short	wmcsel;			/* ws menu ws a/b select */
-short	wmctag;			/* ws/cf display update flag */
-short	wplast;			/* last point for interpolate operation */
-short	wpntsv;			/* waveshape point selection state variable */
-short	wshmax;			/* waveshape maximum value */
-short	wvlast;			/* last value for interpolate operation */
-short	xkcount;		/* cursor x key on count */
-short	xkstat;			/* cursor x key status */
-short	xycntr;			/* xy center for cursor pad */
-short	ykcount;		/* cursor y key on count */
-short	ykstat;			/* cursor y key status */
-
-short	anrs[8][16];			/* analog variable resolution */
-short	grp2prt[12][2];			/* group to port and channel table */
-short	sctctab[10][64];		/* score background color table */
-short	sigtab[128][2];			/* signals:  [0] = value, [1] = switch */
-short	tunlib[NTUNS][128];		/* tuning table library */
-short	varmode[8][16];			/* analog variable record mode */
-short	wsnmod[12][2];			/* waveshape number / data modified */
+extern	int16_t	*cratex;		/* cursor x rate table pointer */
+extern	int16_t	*cratey;		/* cursor x rate table pointer */
+
+int16_t	admctl;			/* assignment display submenu control variable */
+int16_t	adnamsw;		/* assignment display virtual typewriter flag */
+int16_t	aflag;			/* analog activity flag */
+int16_t	aform;			/* action buffer format */
+int16_t	amplval;		/* amplitude */
+int16_t	ancmsw;			/* analog variable r/p control source */
+int16_t	angroup;		/* analog variable group being shown */
+int16_t	asgfks;			/* first key selected */
+int16_t	asghit;			/* row hit / assignment in progress */
+int16_t	asgmod;			/* assignment number or table modified */
+int16_t	asig;			/* analog signal number */
+int16_t	asmode;			/* panel assignment mode */
+int16_t	astat;			/* analog signal status */
+int16_t	auxctl;			/* aux control flag */
+int16_t	aval;			/* analog signal value */
+int16_t	bform;			/* oscillator data buffer format */
+int16_t	catin;			/* catalog read in flag */
+int16_t	cents;			/* pitch to cents conversion buffer */
+int16_t	chtime;			/* horizontal cursor counter */
+int16_t	chwait;			/* horizontal cursor wait time */
+int16_t	cflag;			/* accidental flag */
+int16_t	clkctl;			/* clock control */
+int16_t	clkrun;			/* clock status */
+int16_t	clksrc;			/* clock source */
+int16_t	cmfirst;		/* first cursor motion switch */
+int16_t	cmtype;			/* cursor motion type */
+int16_t	cnote;			/* note value at cursor */
+int16_t	ctrsw;			/* scupd center update switch */
+int16_t	curasg;			/* current assignment table */
+int16_t	curfunc;		/* current function number */
+int16_t	curgrp;			/* current group */
+int16_t	curinst;		/* current instrument number */
+int16_t	curmop;			/* current MIDI output port */
+int16_t	curpnt;			/* current point number (absolute) */
+int16_t	curpos;			/* cursor pad position for current axis */
+int16_t	cursbox;		/* currently selected box */
+int16_t	curscor;		/* Current score number */
+int16_t	cursect;		/* current section */
+int16_t	curslim;		/* cursor type change point */
+int16_t	curtun;			/* current tuning table */
+int16_t	curvce;			/* current voice number */
+int16_t	curwave;		/* current waveshape library slot */
+int16_t	curwdth;		/* current waveshape cursor width */
+int16_t	curwfnl;		/* current waveshape final value */
+int16_t	curwhrm;		/* current waveshape harmonic number */
+int16_t	curwhrv;		/* current waveshape harmonic value */
+int16_t	curwoff;		/* current waveshape offset value */
+int16_t	curwpnt;		/* current waveshape point number */
+int16_t	curwslt;		/* current waveshape instrument slot */
+int16_t	cvtime;			/* vertical cursor counter */
+int16_t	cvwait;			/* veritcal cursor wait time */
+int16_t	cxrate;			/* cursor x rate */
+int16_t	cxval;			/* graphic cursor x value */
+int16_t	cyrate;			/* cursor y rate */
+int16_t	cyval;			/* graphic cursor y value */
+int16_t	debugne;		/* debug flag for note entry */
+int16_t	defect;			/* defect code */
+int16_t	dferror;		/* error code from BIOS or XBIOS */
+int16_t	dfsides;		/* number of sides */
+int16_t	dftype;			/* disk type code */
+int16_t	dsp_ok;			/* display update OK this cycle flag */
+int16_t	dubsw;			/* overdub / replace switch */
+int16_t	ebflag;			/* edit buffer data flag */
+int16_t	editss;			/* edit panel switch state */
+int16_t	editsw;			/* edit mode switch */
+int16_t	endflg;			/* !end flag */
+int16_t	ext_cv1;		/* CV-1 value */
+int16_t	ext_cv2;		/* CV-2 value */
+int16_t	ext_cv3;		/* CV-3 value */
+int16_t	ext_cv4;		/* CV-4 value */
+int16_t	ext_mod;		/* Aux Signal Mod value */
+int16_t	gomode;			/* go to mode */
+int16_t	grptran;		/* group translation value */
+int16_t	gtmsel;			/* group transpose/map select */
+int16_t	hitbox;			/* box we just hit */
+int16_t	hitcx;			/* x of cursor when we hit the box */
+int16_t	hitcy;			/* y of cursor when we hit the box */
+int16_t	idcfsw;			/* copy / fetch menu switch */
+int16_t	idimsw;			/* instrument display instrument menu switch */
+int16_t	idintmp;		/* temporary for instrument number */
+int16_t	idnamsw;		/* typewriter switch */
+int16_t	idsrcsw;		/* source menu switch */
+int16_t	idtdat;			/* current instrument vtyper data entry string */
+int16_t	imflag;			/* instrument modified flag */
+int16_t	initcfg;		/* initial configuration */
+int16_t	insmode;		/* score insert mode */
+int16_t	ismode;			/* instrument select mode */
+int16_t	lampio;			/* LCD timeout disable switch state at I/O time */
+int16_t	lampsw;			/* LCD timeout disable switch */
+int16_t	lasgsw;			/* assignments store switch */
+int16_t	lastam;			/* last assignment menu base */
+int16_t	ldelsw;			/* delete switch */
+int16_t	lderrsw;		/* error message displayed switch */
+int16_t	ldidsiz;		/* getcat() did showsiz() switch */
+int16_t	ldkind;			/* fetch file type */
+int16_t	ldpass;			/* librarian load state variable */
+int16_t	ldrow;			/* fetch select row */
+int16_t	ldslot;			/* fetch select slot */
+int16_t	legato;			/* execkey() "legato" mode switch */
+int16_t	lksel;			/* librarian key slot selector */
+int16_t	lmwtype;		/* librarian message window type */
+int16_t	loadrow;		/* librarian row selected for load letter */
+int16_t	loadsw;			/* panel "Load" mode state */
+int16_t	lorchl;			/* load hi (TRUE) / lo (FALSE) orchestra */
+int16_t	lorchsw;		/* hi orchestra (21 - 40) store switch */
+int16_t	lorclsw;		/* lo orchestra (01 - 20) store switch */
+int16_t	lpatsw;			/* patch table store switch */
+int16_t	lrasw;			/* append (TRUE) / replace (FALSE) score */
+int16_t	lscrsw;			/* score store switch */
+int16_t	lselsw;			/* fetch select switch */
+int16_t	lseqsw;			/* sequence table store switch */
+int16_t	lstbgnc;		/* last note begin entry table index */
+int16_t	lstendc;		/* last note end entry table index */
+int16_t	lstflag;		/* last note list end switch */
+int16_t	lstrsw;			/* store state switch */
+int16_t	lstwoff;		/* last waveshape offset value */
+int16_t	lstwpnt;		/* last waveshape point number */
+int16_t	ltagged;		/* load tag switch */
+int16_t	ltunsw;			/* tunings store switch */
+int16_t	lwavsw;			/* waveshapes store switch */
+int16_t	mascntr;		/* MIDI active sensing timeout counter */
+int16_t	mdb1;			/* current MIDI data byte 1 */
+int16_t	mdb2;			/* current MIDI data byte 2 */
+int16_t	michan;			/* current MIDI channel */
+int16_t	midiclk;		/* MIDI clock switch */
+int16_t	midigo;			/* MIDI run switch */
+int16_t	mistat;			/* current MIDI status */
+int16_t	nchwait;		/* next chwait value */
+int16_t	ncvwait;		/* next cvwait value */
+int16_t	ndisp;			/* current display number */
+int16_t	newflag;		/* new data entered while t_cur EQ t_ctr */
+int16_t	nkdown;			/* number of keys down */
+int16_t	notenum;		/* note number */
+int16_t	noteop;			/* pending note operation code */
+int16_t	notepit;		/* note pitch */
+int16_t	notesel;		/* note selection state */
+int16_t	npts;			/* number of points in function */
+int16_t	nxtflag;		/* next score flag */
+int16_t	oldltag;		/* previous load tag for tagslot */
+int16_t	oldpk;			/* previous pkctrl state */
+int16_t	oldsl;			/* previous sliders state */
+int16_t	pchsw;			/* punch-in enable switch */
+int16_t	pecase;			/* point edit case variable */
+int16_t	pkctrl;			/* local performance key state */
+int16_t	pntsv;			/* point selection state variable */
+int16_t	prgchan;		/* MIDI program change channel  (port 1) */
+int16_t	ps_dpth;		/* phase shifter -- depth */
+int16_t	ps_intn;		/* phase shifter -- intensity */
+int16_t	ps_rate;		/* phase shifter -- rate */
+int16_t	pulsclk;		/* pulse clock state */
+int16_t	recsw;			/* record / play switch */
+int16_t	runit;			/* run switch for main scan loop */
+int16_t	sbase;			/* score VSDD RAM scroll offset */
+int16_t	scmctl;			/* score submenu control flag */
+int16_t	scrlpot;		/* scroll pot state */
+int16_t	sd;			/* score display direction */
+int16_t	se;			/* score execution direction */
+int16_t	sdmcol;			/* score menu - saved stccol */
+int16_t	sdmctl;			/* score menu - control variable */
+int16_t	sdmrow;			/* score menu - saved stcrow */
+int16_t	secop;			/* pending score section operation */
+int16_t	secopok;		/* section operation OK flag */
+int16_t	sgcsw;			/* graphic cursor display switch */
+int16_t	sgoflag;		/* section number relative column 0..3 */
+int16_t	sharp;			/* sharp flag */
+int16_t	sliders;		/* slider and switch state */
+int16_t	soffset;		/* score scroll offset */
+int16_t	ss_ptsw;		/* smooth scroll patch scroll switch */
+int16_t	ss_sqsw;		/* smooth scroll sequence scroll switch */
+int16_t	stccol;			/* score cursor col */
+int16_t	stcrow;			/* score cursor row */
+int16_t	stepclk;		/* note entry - step clock state */
+int16_t	stepenb;		/* note entry - step enable flag */
+int16_t	stepint;		/* note entry - note interval */
+int16_t	stepwgt;		/* note entry - note weight */
+int16_t	subj;			/* edited point number (relative) */
+int16_t	submenu;		/* submenu active switch */
+int16_t	swctrl;			/* scroll wheel 'srolling' flag */
+int16_t	swdelta;		/* scroll wheel change while touched */
+int16_t	swdir;			/* scroll wheel direction */
+int16_t	swfiin;			/* scroll wheel fifo input pointer */
+int16_t	swflag;			/* scroll wheel touched flag */
+int16_t	swlast;			/* scroll wheel last value */
+int16_t	swstop;			/* scroll wheel stop flag */
+int16_t	swndx;			/* scroll wheel look back index */
+int16_t	tagslot;		/* tagged load slot */
+int16_t	tdnamsw;		/* tuning editor displaying typewriter */
+int16_t	temax;			/* time upper limit */
+int16_t	temin;			/* time lower limit */
+int16_t	testing;		/* test level */
+int16_t	tglclk;			/* clock on/off toggle flag */
+int16_t	tglpch;			/* punch in/out toggle flag */
+int16_t	thescore;		/* score selected from sqscan */
+int16_t	timemlt;		/* time scaling */
+int16_t	tkctrl;			/* trackball active flag */
+int16_t	tmpomlt;		/* tempo multiplier */
+int16_t	tmpoval;		/* tempo value */
+int16_t	trkball;		/* trackball selected switch */
+int16_t	ttcmdsv;		/* tuning editor edit state variable */
+int16_t	ttsel1;			/* tuning editor key select variable 1 */
+int16_t	ttsel2;			/* tuning editor key select variable 2 */
+int16_t	ttsel3;			/* tuning editor key select variable 3 */
+int16_t	tuneval;		/* fine tuning */
+int16_t	tunmod;			/* tuning table modified */
+int16_t	tunval;			/* tuning editor increment / transpose  value */
+int16_t	txfiin;			/* trackball x fifo input pointer */
+int16_t	txflag;			/* trackball x axis active flag */
+int16_t	txlast;			/* trackball x axis last value */
+int16_t	txstop;			/* trackball x axis filter counter */
+int16_t	tyfiin;			/* trackball y fifo input pointer */
+int16_t	tyflag;			/* trackball y axis active flag */
+int16_t	tylast;			/* trackball y axis last value */
+int16_t	tystop;			/* trackball y axis filter counter */
+int16_t	velflag;		/* velocity display flag */
+int16_t	verbose;		/* verbose output switch */
+int16_t	vlbtype;		/* type of message window display */
+int16_t	vrbw08;			/* score display video reset detail word */
+int16_t	vrbw09;			/* score display video reset detail word */
+int16_t	vrbw10;			/* score display video reset detail word */
+int16_t	vrbw11;			/* score display video reset detail word */
+int16_t	vrbw12;			/* score display video reset detail word */
+int16_t	vrbw13;			/* score display video reset detail word */
+int16_t	vrbw14;			/* score display video reset detail word */
+int16_t	vrbw15;			/* score display video reset detail word */
+int16_t	vrcw;			/* score display video reset control word */
+int16_t	vtccol;			/* virtual typewriter cursor column */
+int16_t	vtcrow;			/* virtual typewriter cursor row */
+int8_t	vtdechr;		/* virtual typewriter data entry character */
+int16_t	vtdecol;		/* virtual typewriter data entry column */
+int16_t	vtpcol;			/* virtual typewriter column */
+int16_t	vtprow;			/* virtual typewriter row */
+int16_t	vtwcol;			/* virtual typewriter window left column */
+int16_t	vtwrow;			/* virtual typewriter window top row */
+int16_t	vtxval;			/* virtual typewriter cursor x value */
+int16_t	vtyval;			/* virtual typewriter cursor y value */
+int16_t	wcflag;			/* ws/cf menu select flag (cf=0, ws=1) */
+int16_t	wcmcol;			/* ws/cf menu label column */
+int16_t	wcmrow;			/* ws/cf menu label row */
+int16_t	wcpage;			/* ws/cf menu page */
+int16_t	wdupdfl;		/* waveshape display needs updated flag */
+int16_t	wmcsel;			/* ws menu ws a/b select */
+int16_t	wmctag;			/* ws/cf display update flag */
+int16_t	wplast;			/* last point for interpolate operation */
+int16_t	wpntsv;			/* waveshape point selection state variable */
+int16_t	wshmax;			/* waveshape maximum value */
+int16_t	wvlast;			/* last value for interpolate operation */
+int16_t	xkcount;		/* cursor x key on count */
+int16_t	xkstat;			/* cursor x key status */
+int16_t	xycntr;			/* xy center for cursor pad */
+int16_t	ykcount;		/* cursor y key on count */
+int16_t	ykstat;			/* cursor y key status */
+
+int16_t	anrs[8][16];			/* analog variable resolution */
+int16_t	grp2prt[12][2];			/* group to port and channel table */
+int16_t	sctctab[10][64];		/* score background color table */
+int16_t	sigtab[128][2];			/* signals:  [0] = value, [1] = switch */
+int16_t	tunlib[NTUNS][128];		/* tuning table library */
+int16_t	varmode[8][16];			/* analog variable record mode */
+int16_t	wsnmod[12][2];			/* waveshape number / data modified */
 
 struct	EXFILE	mphead;		/* MIDAS-VII program header */
@@ -436,40 +436,40 @@
 struct	s_entry *seclist[N_SCORES][N_SECTS];	/* Section pointer table */
 
-unsigned	*asgob;		/* assignment display object pointer */
-unsigned	*consl;		/* constant slice pointer */
-unsigned	*cursl;		/* current (center) slice pointer */
-unsigned	*instob;	/* instrument object pointer */
-unsigned	*librob;	/* librarian display object pointer */
-unsigned	*menuob;	/* menu display object pointer */
-unsigned	*nxtsl;		/* next (right edge) slice pointer */
-unsigned	*obj0;		/* object  0 VSDD RAM pointer */
-unsigned	*obj1;		/* object  1 VSDD RAM pointer */
-unsigned	*obj2;		/* object  2 VSDD RAM pointer */
-unsigned	*obj3;		/* object  3 VSDD RAM pointer */
-unsigned	*obj4;		/* object  4 VSDD RAM pointer */
-unsigned	*obj5;		/* object  5 VSDD RAM pointer */
-unsigned	*obj6;		/* object  6 VSDD RAM pointer */
-unsigned	*obj7;		/* object  7 VSDD RAM pointer */
-unsigned	*obj8;		/* object  8 VSDD RAM pointer */
-unsigned	*obj9;		/* object  9 VSDD RAM pointer */
-unsigned	*obj10;		/* object 10 VSDD RAM pointer */
-unsigned	*obj11;		/* object 11 VSDD RAM pointer */
-unsigned	*obj12;		/* object 12 VSDD RAM pointer */
-unsigned	*obj13;		/* object 13 VSDD RAM pointer */
-unsigned	*obj14;		/* object 14 VSDD RAM pointer */
-unsigned	*obj15;		/* object 15 VSDD RAM pointer */
-unsigned	*prvsl;		/* previous (left edge) slice pointer */
-unsigned	*saddr;		/* score VSDD RAM base pointer */
-unsigned	*tunob;		/* tuning table display object pointer */
-unsigned	*vtobj;		/* virtual typewriter display object pointer */
-unsigned	*waveob;	/* waveshape display object pointer */
-
-unsigned	curintp;	/* current interpolate time (FPU format) */
-unsigned	scrl;		/* score VSDD object scroll register image */
-unsigned	vtbgval;	/* virtual typewriter data background color */
-unsigned	vtfgval;	/* virtual typewriter data foreground color */
-
-unsigned	dfbuf[4096];	/* track formatting buffer */
-unsigned	slices[896];	/* score display slices */
+uint16_t	*asgob;		/* assignment display object pointer */
+uint16_t	*consl;		/* constant slice pointer */
+uint16_t	*cursl;		/* current (center) slice pointer */
+uint16_t	*instob;	/* instrument object pointer */
+uint16_t	*librob;	/* librarian display object pointer */
+uint16_t	*menuob;	/* menu display object pointer */
+uint16_t	*nxtsl;		/* next (right edge) slice pointer */
+uint16_t	*obj0;		/* object  0 VSDD RAM pointer */
+uint16_t	*obj1;		/* object  1 VSDD RAM pointer */
+uint16_t	*obj2;		/* object  2 VSDD RAM pointer */
+uint16_t	*obj3;		/* object  3 VSDD RAM pointer */
+uint16_t	*obj4;		/* object  4 VSDD RAM pointer */
+uint16_t	*obj5;		/* object  5 VSDD RAM pointer */
+uint16_t	*obj6;		/* object  6 VSDD RAM pointer */
+uint16_t	*obj7;		/* object  7 VSDD RAM pointer */
+uint16_t	*obj8;		/* object  8 VSDD RAM pointer */
+uint16_t	*obj9;		/* object  9 VSDD RAM pointer */
+uint16_t	*obj10;		/* object 10 VSDD RAM pointer */
+uint16_t	*obj11;		/* object 11 VSDD RAM pointer */
+uint16_t	*obj12;		/* object 12 VSDD RAM pointer */
+uint16_t	*obj13;		/* object 13 VSDD RAM pointer */
+uint16_t	*obj14;		/* object 14 VSDD RAM pointer */
+uint16_t	*obj15;		/* object 15 VSDD RAM pointer */
+uint16_t	*prvsl;		/* previous (left edge) slice pointer */
+uint16_t	*saddr;		/* score VSDD RAM base pointer */
+uint16_t	*tunob;		/* tuning table display object pointer */
+uint16_t	*vtobj;		/* virtual typewriter display object pointer */
+uint16_t	*waveob;	/* waveshape display object pointer */
+
+uint16_t	curintp;	/* current interpolate time (FPU format) */
+uint16_t	scrl;		/* score VSDD object scroll register image */
+uint16_t	vtbgval;	/* virtual typewriter data background color */
+uint16_t	vtfgval;	/* virtual typewriter data foreground color */
+
+uint16_t	dfbuf[4096];	/* track formatting buffer */
+uint16_t	slices[896];	/* score display slices */
 
 /* 
@@ -479,28 +479,28 @@
 /* initialized variables */
 
-short	debugsw = DEBUGVAL;	/* debug output switch */
-
-short	swback  = SWBACK;	/* scroll wheel look back count */
-short	swthr   = SWTHR;	/* scroll wheel movement threshold */
-short	swtime  = SWTIME;	/* scroll wheel timer scan time */
-short	swwait	= SWWAIT;	/* scroll wheel wait count */
-
-short	tkback  = TKBACK;	/* trackball FIFO look back count */
-short	tkrmin  = TKRMIN;	/* trackball rate threshold */
-short	tkthr   = TKTHR;	/* trackball movement threshold */
-short	tktime  = TKTIME;	/* trackball timer scan time */
-short	tkwait	= TKWAIT;	/* trackball wait count */
-
-short	curhold = CURHOLD;	/* cursor hold time */
-short	hcwval  = HCWVAL;	/* graphics cursor X wait time */
-short	thcwval = THCWVAL;	/* text cursor H wait time */
-short	tvcwval = TVCWVAL;	/* text cursor V wait time */
-short	vcwval  = VCWVAL;	/* graphics cursor Y wait time */
-
-/* 
-
-*/
-
-short	tmultab[] = {		/* time multiplier table - indexed by voltage */
+int16_t	debugsw = DEBUGVAL;	/* debug output switch */
+
+int16_t	swback  = SWBACK;	/* scroll wheel look back count */
+int16_t	swthr   = SWTHR;	/* scroll wheel movement threshold */
+int16_t	swtime  = SWTIME;	/* scroll wheel timer scan time */
+int16_t	swwait	= SWWAIT;	/* scroll wheel wait count */
+
+int16_t	tkback  = TKBACK;	/* trackball FIFO look back count */
+int16_t	tkrmin  = TKRMIN;	/* trackball rate threshold */
+int16_t	tkthr   = TKTHR;	/* trackball movement threshold */
+int16_t	tktime  = TKTIME;	/* trackball timer scan time */
+int16_t	tkwait	= TKWAIT;	/* trackball wait count */
+
+int16_t	curhold = CURHOLD;	/* cursor hold time */
+int16_t	hcwval  = HCWVAL;	/* graphics cursor X wait time */
+int16_t	thcwval = THCWVAL;	/* text cursor H wait time */
+int16_t	tvcwval = TVCWVAL;	/* text cursor V wait time */
+int16_t	vcwval  = VCWVAL;	/* graphics cursor Y wait time */
+
+/* 
+
+*/
+
+int16_t	tmultab[] = {		/* time multiplier table - indexed by voltage */
 
 	0xFFFF, 0xFAFA, 0xF627, 0xF182, 0xED09, 	/*   0 */
@@ -531,5 +531,5 @@
 */
 
-short	crate0[] = {			/* cursor rate table 1 */
+int16_t	crate0[] = {			/* cursor rate table 1 */
 
 	 0,  0,  0,  0,  0,  0,  0,  0,		/* 0..7 */
@@ -543,5 +543,5 @@
 };
 
-short	crate1[] = {			/* cursor rate table 1 */
+int16_t	crate1[] = {			/* cursor rate table 1 */
 
 	 0,  0,  0,  0,  0,  0,  0,  0,		/* 0..7 */
@@ -555,5 +555,5 @@
 };
 
-short crate2[] = {			/* cursor rate table 2 */
+int16_t crate2[] = {			/* cursor rate table 2 */
 
 	  0,  0,  0,  0,  0,  0,  0,  0,	/* 0..7 */
@@ -571,5 +571,5 @@
 */
 
-short	loctab[9] = {
+int16_t	loctab[9] = {
 
 	0,		/* 0 - left */
@@ -598,5 +598,5 @@
 */
 
-short valof(short srcv)
+int16_t valof(int16_t srcv)
 {
 	switch (srcv) {
@@ -645,5 +645,5 @@
 void inismtb(void)
 {
-	register short i, oldi;
+	register int16_t i, oldi;
 
 	oldi = setipl(FPU_DI);
@@ -690,5 +690,5 @@
 void clrpfl(void)
 {
-	register short i;
+	register int16_t i;
 
 	memsetw(&pfents[0], 0, (NPFENTS * sizeof (struct pflent))/2);
@@ -713,6 +713,6 @@
 void im700(void)
 {
-	register short i, j, k;
-	register char *ioadr;
+	register int16_t i, j, k;
+	register int8_t *ioadr;
 	register struct instdef *ip;
 
