Index: ram/instdsp.c
===================================================================
--- ram/instdsp.c	(revision a4bd34f8abea97fe66b81d5b1c3062236264c44d)
+++ ram/instdsp.c	(revision f70aaad283907a81833976b54017ada93d1a9a41)
@@ -186,5 +186,4 @@
 	register struct instpnt *pt1, *pt2;
 	register int16_t i, npt1, npt2, xp;
-	register uint16_t color;
 	int16_t np, ptx, pty, ptc;
 
@@ -201,7 +200,4 @@
 	pt1 = &ip->idhpnt[fp->idfpt1];		/* left endpoint of line */
 	pt2 = pt1 + 1;				/* right endpoint of line */
-
-	color = exp_c(pen);	/* replicate 4 bit 'pen' for 16 bit 'color' */
-
 
 	ptx = ttox(timeto(fn, npt1), wn);
@@ -257,5 +253,5 @@
 			lseg(ttox(timeto(fn, npt1), wn),
 				vtoy((pt1->ipval >> 5), wn),
-				ptx, pty, color);
+				ptx, pty, pen);
 
 			if (wn EQ 12) {
@@ -349,9 +345,9 @@
 void dosync(int16_t vce)
 {
-	register int16_t sync;
-	register struct instdef *ip;
+	uint16_t sync;
+	struct instdef *ip;
 
 	ip = &vbufs[vce];
-	sync = ip->idhcfg << 8;
+	sync = (uint16_t)ip->idhcfg << 8;
 
 	if (ip->idhos1c & OC_SYN)
@@ -364,5 +360,5 @@
 		sync |= 0x8000;
 
-	*(io_fpu + vce + (int32_t)FPU_OCFG) = sync;
+	*(io_fpu + vce + FPU_OCFG) = sync;
 }
 
@@ -413,9 +409,9 @@
 
 			cnvc2p(idbuf, (frq >> 1));
-			idbuf[0] += '0';
-			idbuf[1] += 'A';
+			idbuf[0] = (int8_t)(idbuf[0] + '0');
+			idbuf[1] = (int8_t)(idbuf[1] + 'A');
 			idbuf[2] = sfdsp[idbuf[2]];
-			idbuf[3] += '0';
-			idbuf[4] += '0';
+			idbuf[3] = (int8_t)(idbuf[3] + '0');
+			idbuf[4] = (int8_t)(idbuf[4] + '0');
 			idbuf[5] = '\0';
 			break;
@@ -442,5 +438,5 @@
 
 		x = 382 + (i >> 1);
-		y = 348 - ((ws[i] ^ 0x8000) / 676);
+		y = 348 - ((int16_t)(ws[i] ^ 0x8000) / 676);
 
 		idpoint(x, y, pen);
@@ -459,5 +455,6 @@
 	int8_t *s1;
 	int32_t tt, sc;
-	register int16_t cx, pnt, par;
+	uint16_t cx;
+	register int16_t pnt, par;
 	register struct instdef *ip;
 	register struct idfnhdr *fp;
@@ -477,7 +474,5 @@
 	pp = &ip->idhpnt[curpnt];
 
-	cx = idbox[n][5];
-	cx |= cx << 4;
-	cx |= cx << 8;
+	cx = exp_c(idbox[n][5]);
 
 	/* first, fill the box with the background color */
@@ -550,6 +545,6 @@
 		sc = 1000L;
 		tt = timeto(curfunc, subj);
-		th = tt / sc;
-		tl = tt - (th * sc);
+		th = (int16_t)(tt / sc);
+		tl = (int16_t)(tt - (th * sc));
 
 		sprintf(bfs, "%02d.%03d", th, tl);
