Index: ram/ptdkey.c
===================================================================
--- ram/ptdkey.c	(revision 494d8ff4f4bb8c9810829308fd317401507e1edb)
+++ ram/ptdkey.c	(revision 3ac8e1ba43940eb45fc50206a4aaaedeec234cf7)
@@ -267,5 +267,5 @@
 
 		if (spec EQ PA_OSC)
-			ptedata = ptedat1 + 4;
+			ptedata = (int16_t)ptedat1 + 4;
 		else
 			ptedata = dtabl9[ptedat1];
@@ -394,5 +394,5 @@
 
 						sprintf(buf2, "%02d", 1 + chan);
-						buf[0] = key + '0';
+						buf[0] = (int8_t)(key + '0');
 						UpdVid(7, n ? 25 : 12, buf2, PTDATR);
 					}
@@ -401,11 +401,11 @@
 
 					if (n)
-						ptestm = (ptestm & 0xE7FF) | (port << 11);
+						ptestm = (ptestm & 0xE7FF) | ((uint16_t)port << 11);
 					else
-						ptedef = (ptestm & 0xE7FF) | (port << 11);
+						ptedef = (ptestm & 0xE7FF) | ((uint16_t)port << 11);
 
 				} else {
 
-					buf[0] = key + '0';
+					buf[0] = (int8_t)(key + '0');
 				}
 
@@ -436,6 +436,6 @@
 			if (inrange(stccol, dsdecol[1][n][0], dsdecol[1][n][1])) {
 
-				ptdebuf[stccol] = key + '0';
-				buf[0] = key + '0';
+				ptdebuf[stccol] = (int8_t)(key + '0');
+				buf[0] = (int8_t)(key + '0');
 				buf[1] = '\0';
 
@@ -462,6 +462,6 @@
 					return;
 
-				ptdebuf[stccol] = key + '0';
-				buf[0] = key + '0';
+				ptdebuf[stccol] = (int8_t)(key + '0');
+				buf[0] = (int8_t)(key + '0');
 				buf[1] = '\0';
 
@@ -526,9 +526,9 @@
 							buf[0] = 'L';
 						else
-							buf[0] = key + '0';
+							buf[0] = (int8_t)(key + '0');
 
 					} else {
 
-						buf[0] = key + '0';
+						buf[0] = (int8_t)(key + '0');
 					}
 
@@ -553,6 +553,6 @@
 				if (inrange(stccol, 36, 37)) {
 
-					ptdebuf[stccol] = key + '0';
-					buf[0] = key + '0';
+					ptdebuf[stccol] = (int8_t)(key + '0');
+					buf[0] = (int8_t)(key + '0');
 					buf[1] = '\0';
 
@@ -574,6 +574,6 @@
 						return;
 
-					ptdebuf[stccol] = key + '0';
-					buf[0] = key + '0';
+					ptdebuf[stccol] = (int8_t)(key + '0');
+					buf[0] = (int8_t)(key + '0');
 					buf[1] = '\0';
 
@@ -591,6 +591,6 @@
 						return;
 
-					ptdebuf[stccol] = key + 'A';
-					buf[0] = key + 'A';
+					ptdebuf[stccol] = (int8_t)(key + 'A');
+					buf[0] = (int8_t)(key + 'A');
 					buf[1] = '\0';
 
@@ -605,6 +605,6 @@
 				if (inrange(stccol, 32, 33)) {
 
-					ptdebuf[stccol] = key + '0';
-					buf[0] = key + '0';
+					ptdebuf[stccol] = (int8_t)(key + '0');
+					buf[0] = (int8_t)(key + '0');
 					buf[1] = '\0';
 
@@ -631,6 +631,6 @@
 						return;
 
-					ptdebuf[stccol] = key + '0';
-					buf[0] = key + '0';
+					ptdebuf[stccol] = (int8_t)(key + '0');
+					buf[0] = (int8_t)(key + '0');
 					buf[1] = '\0';
 
@@ -648,6 +648,6 @@
 						return;
 
-					ptdebuf[stccol] = key + '0';
-					buf[0] = key + '0';
+					ptdebuf[stccol] = (int8_t)(key + '0');
+					buf[0] = (int8_t)(key + '0');
 					buf[1] = '\0';
 
@@ -664,5 +664,5 @@
 				if (inrange(stccol, 39, 40)) {
 
-					vg = (ptesuba >> 8) & 0x00FF;
+					vg = (int16_t)(ptesuba >> 8) & 0x00FF;
 
 					if (stccol EQ 39) {
@@ -682,5 +682,5 @@
 
 							ptesuba = (ptesuba & 0x00FF) |
-								  (vg << 8);
+								  ((uint16_t)vg << 8);
 
 						} else {
@@ -707,9 +707,9 @@
 
 						ptesuba = (ptesuba & 0x00FF) |
-							  (vg << 8);
+							  ((uint16_t)vg << 8);
 					}
 
-					ptdebuf[stccol] = val;
-					buf[0] = val;
+					ptdebuf[stccol] = (int8_t)val;
+					buf[0] = (int8_t)val;
 					buf[1] = '\0';
 
@@ -752,5 +752,5 @@
 
 				if ((key EQ 0) OR (key EQ 1))
-					buf[0] = key + '0';
+					buf[0] = (int8_t)(key + '0');
 				else
 					return;
@@ -761,5 +761,5 @@
 			case 46:	/* 0..9 */
 
-				buf[0] = key + '0';
+				buf[0] = (int8_t)(key + '0');
 				break;
 
@@ -790,5 +790,5 @@
 				return;
 
-			buf[0] = key + '0';
+			buf[0] = (int8_t)(key + '0');
 			buf[1] = '\0';
 			ptdebuf[stccol] = buf[0];
@@ -859,5 +859,5 @@
 			case 46:
 
-				buf[0] = key + '0';
+				buf[0] = (int8_t)(key + '0');
 				break;
 
@@ -898,9 +898,9 @@
 					return;
 				else
-					buf[0] = key + '0';
+					buf[0] = (int8_t)(key + '0');
 
 			} else {
 
-				buf[0] = key + '0';
+				buf[0] = (int8_t)(key + '0');
 			}
 
@@ -924,5 +924,5 @@
 			case 44:
 
-				buf[0] = key +'0';
+				buf[0] = (int8_t)(key +'0');
 				break;
 
@@ -963,5 +963,5 @@
 			case 45:
 
-				buf[0] = key + '0';
+				buf[0] = (int8_t)(key + '0');
 				break;
 
@@ -996,5 +996,5 @@
 					return;
 
-				buf[0] = key + 'A';
+				buf[0] = (int8_t)(key + 'A');
 				break;
 
@@ -1016,5 +1016,5 @@
 			case 46:
 
-				buf[0] = key + '0';
+				buf[0] = (int8_t)(key + '0');
 				break;
 			}
@@ -1132,5 +1132,5 @@
 			case 44:
 
-				buf[0] = key + '0';
+				buf[0] = (int8_t)(key + '0');
 				break;
 
@@ -1157,5 +1157,5 @@
 				return;
 
-			buf[0] = key + '0';
+			buf[0] = (int8_t)(key + '0');
 			ptdebuf[stccol] = buf[0];
 			buf[1] = '\0';
@@ -1178,5 +1178,5 @@
 				return;
 
-			buf[0] = key + '0';
+			buf[0] = (int8_t)(key + '0');
 			buf[1] = '\0';
 			ptdebuf[stccol] = buf[0];
@@ -1200,5 +1200,5 @@
 				return;
 
-			buf[0] = key + '0';
+			buf[0] = (int8_t)(key + '0');
 			buf[1] = '\0';
 			ptdebuf[stccol] = buf[0];
@@ -1221,5 +1221,5 @@
 				return;
 
-			buf[0] = key + '0';
+			buf[0] = (int8_t)(key + '0');
 			buf[1] = '\0';
 			ptdebuf[stccol] = buf[0];
@@ -1242,5 +1242,5 @@
 				return;
 
-			buf[0] = key + '0';
+			buf[0] = (int8_t)(key + '0');
 			buf[1] = '\0';
 			ptdebuf[stccol] = buf[0];
@@ -1260,5 +1260,5 @@
 				return;
 
-			buf[0] = key + '0';
+			buf[0] = (int8_t)(key + '0');
 			buf[1] = '\0';
 			ptdebuf[stccol] = buf[0];
Index: ram/ptselbx.c
===================================================================
--- ram/ptselbx.c	(revision 494d8ff4f4bb8c9810829308fd317401507e1edb)
+++ ram/ptselbx.c	(revision 3ac8e1ba43940eb45fc50206a4aaaedeec234cf7)
@@ -27,32 +27,32 @@
 #define	HT_OFF	0x00	/* no submenu highlighted */
 
-int16_t	ptegood;		/* pte buffer -- entire entry valid flag */
-
-int16_t	ptedfok;		/* pte buffer -- def valid flag */
-int16_t	ptestok;		/* pte buffer -- stm valid flag */
-int16_t	ptedsok;		/* pte buffer -- destination valid flag */
-int16_t	ptedtok;		/* pte buffer -- datum valid flag */
-
-int16_t	ptedef;			/* pte buffer -- definer number */
-int16_t	ptestm;			/* pte buffer -- stimulus number */
-int16_t	ptespec;		/* pte buffer -- address type */
-int16_t	ptesuba;		/* pte buffer -- sub-address */
-int16_t	ptedat1;		/* pte buffer -- data word 1 */
-int16_t	ptedat2;		/* pte buffer -- data word 2 */
-
-int16_t	ptedftp;		/* definer / stimulus entry flag */
-
-int16_t	ptedfst;		/* current definer/stimulus data entry format */
-int16_t	ptedest;		/* current destination data entry format */
-int16_t	ptedata;		/* current datum data entry format */
-
-int16_t	ptemenu;		/* current submenu highlighting */
-
-int16_t	pteset;			/* pte buffer setup flag */
-int16_t	ptbflag;		/* pdbuf setup flag */
-
-int16_t	ptecpos;		/* current patch entry index */
-int16_t	ptepred;		/* predecessor entry index */
-int16_t	ptesucc;		/* successor entry index */
+int16_t		ptegood;	/* pte buffer -- entire entry valid flag */
+
+int16_t		ptedfok;	/* pte buffer -- def valid flag */
+int16_t		ptestok;	/* pte buffer -- stm valid flag */
+int16_t		ptedsok;	/* pte buffer -- destination valid flag */
+int16_t		ptedtok;	/* pte buffer -- datum valid flag */
+
+uint16_t	ptedef;		/* pte buffer -- definer number */
+uint16_t	ptestm;		/* pte buffer -- stimulus number */
+uint16_t	ptespec;	/* pte buffer -- address type */
+uint16_t	ptesuba;	/* pte buffer -- sub-address */
+uint16_t	ptedat1;	/* pte buffer -- data word 1 */
+uint16_t	ptedat2;	/* pte buffer -- data word 2 */
+
+int16_t		ptedftp;	/* definer / stimulus entry flag */
+
+int16_t		ptedfst;	/* current definer/stimulus data entry format */
+int16_t		ptedest;	/* current destination data entry format */
+int16_t		ptedata;	/* current datum data entry format */
+
+int16_t		ptemenu;	/* current submenu highlighting */
+
+int16_t		pteset;		/* pte buffer setup flag */
+int16_t		ptbflag;	/* pdbuf setup flag */
+
+int16_t		ptecpos;	/* current patch entry index */
+int16_t		ptepred;	/* predecessor entry index */
+int16_t		ptesucc;	/* successor entry index */
 
 struct patch	ptebuf;		/* pte buffer -- patch table format */
Index: ram/ptselbx.x
===================================================================
--- ram/ptselbx.x	(revision 494d8ff4f4bb8c9810829308fd317401507e1edb)
+++ ram/ptselbx.x	(revision 3ac8e1ba43940eb45fc50206a4aaaedeec234cf7)
@@ -39,8 +39,8 @@
 extern	struct	patch	ptebuf;
 extern	int16_t		ptecpos;
-extern	int16_t		ptedat1;
-extern	int16_t		ptedat2;
+extern	uint16_t	ptedat1;
+extern	uint16_t	ptedat2;
 extern	int16_t		ptedata;
-extern	int16_t		ptedef;
+extern	uint16_t	ptedef;
 extern	int16_t		ptedest;
 extern	int16_t		ptedfok;
@@ -53,8 +53,8 @@
 extern	int16_t		ptepred;
 extern	int16_t		pteset;
-extern	int16_t		ptespec;
-extern	int16_t		ptestm;
+extern	uint16_t	ptespec;
+extern	uint16_t	ptestm;
 extern	int16_t		ptestok;
-extern	int16_t		ptesuba;
+extern	uint16_t	ptesuba;
 extern	int16_t		ptesucc;
 extern	int8_t		*rawdata[];
