Index: emu/all.h
===================================================================
--- emu/all.h	(revision f51359cad4cdb056e52aae47198e502a43439d3a)
+++ emu/all.h	(revision 5475ecffc7e57c236384c2d970e1fea0538c9460)
@@ -66,7 +66,4 @@
 
 extern SDL_atomic_t run;
-
-extern uint32_t vid_win;
-extern uint32_t ser_win;
 
 extern void sdl_init(void);
@@ -163,4 +160,2 @@
 extern uint32_t kbd_read(uint32_t off, int32_t sz);
 extern void kbd_write(uint32_t off, int32_t sz, uint32_t val);
-
-extern void kbd_key(SDL_KeyboardEvent *ev, bool dn);
Index: emu/cpu.c
===================================================================
--- emu/cpu.c	(revision f51359cad4cdb056e52aae47198e502a43439d3a)
+++ emu/cpu.c	(revision 5475ecffc7e57c236384c2d970e1fea0538c9460)
@@ -82,5 +82,5 @@
 	{ 0x3b4001, 0x3b8001, 0, snd_init, snd_quit, snd_exec, snd_read, snd_write },
 	{ 0x3b8001, 0x3bc001, 0, led_init, led_quit, led_exec, led_read, led_write },
-	{ 0x3bc001, 0x3c0001, 3, kbd_init, kbd_quit, kbd_exec, kbd_read, kbd_write }
+	{ 0x3bc001, 0x3c0001, 0, kbd_init, kbd_quit, kbd_exec, kbd_read, kbd_write }
 };
 
Index: emu/kbd.c
===================================================================
--- emu/kbd.c	(revision f51359cad4cdb056e52aae47198e502a43439d3a)
+++ emu/kbd.c	(revision 5475ecffc7e57c236384c2d970e1fea0538c9460)
@@ -24,153 +24,4 @@
 int32_t kbd_verbose = 0;
 
-#define BUF_SZ 16
-
-static int32_t buf_hd = 0;
-static int32_t buf_tl = 0;
-static uint8_t buf[BUF_SZ];
-
-static uint8_t reg = 0;
-static bool irq = false;
-
-static void xmit(void)
-{
-	ver2("kbd xmit %d %d", buf_tl, buf_hd);
-
-	if (buf_tl >= buf_hd) {
-		return;
-	}
-
-	reg = buf[buf_tl % BUF_SZ];
-	irq = true;
-	ver2("kbd xmit 0x%02x", reg);
-
-	++buf_tl;
-
-	if (buf_tl >= BUF_SZ) {
-		buf_hd -= BUF_SZ;
-		buf_tl -= BUF_SZ;
-		ver2("kbd adj %d %d", buf_tl, buf_hd);
-	}
-}
-
-static void out(uint8_t c)
-{
-	ver2("kbd out %d %d 0x%02x", buf_tl, buf_hd, c);
-
-	if (SDL_LockMutex(cpu_mutex) < 0) {
-		fail("SDL_LockMutex() failed: %s", SDL_GetError());
-	}
-
-	if (buf_hd >= buf_tl + BUF_SZ) {
-		err("keyboard port losing data");
-	}
-	else {
-		buf[buf_hd % BUF_SZ] = c;
-		++buf_hd;
-
-		if (!irq) {
-			xmit();
-		}
-	}
-
-	if (SDL_UnlockMutex(cpu_mutex) < 0) {
-		fail("SDL_UnlockMutex() failed: %s", SDL_GetError());
-	}
-}
-
-static void but_on(int32_t sig)
-{
-	out((uint8_t)(0x80 | sig));
-	out(0x01);
-}
-
-static void but_off(int32_t sig)
-{
-	out((uint8_t)(0x80 | sig));
-	out(0x00);
-}
-
-static void key_touch(int32_t sig, int32_t val)
-{
-	out((uint8_t)(0x80 | sig));
-	out(0x01);
-	out((uint8_t)val);
-}
-
-static void key_off(int32_t sig)
-{
-	out((uint8_t)(0x80 | sig));
-	out(0x00);
-}
-
-#if defined NOT_YET
-static void pot_128(int32_t sig, int32_t val)
-{
-	out((uint8_t)(0x80 | sig));
-	out((uint8_t)val);
-}
-
-static void pot_256(int32_t sig, int32_t val)
-{
-	out((uint8_t)(0x80 | sig));
-	out((uint8_t)((val >> 7) & 0x01));
-	out((uint8_t)(val & 0x7f));
-}
-#endif
-
-void kbd_key(SDL_KeyboardEvent *ev, bool dn)
-{
-	if ((ev->keysym.mod & KMOD_SHIFT) != 0 &&
-			ev->keysym.sym >= SDLK_a && ev->keysym.sym <= SDLK_x) {
-		int32_t i = ev->keysym.sym - SDLK_a;
-		ver2("kbd key %d %s", i, dn ? "dn" : "up");
-
-		if (dn) {
-			key_touch(1 + i, 0x7f);
-		}
-		else {
-			key_off(1 + i);
-		}
-
-		return;
-	}
-
-	int32_t sig;
-
-	if (ev->keysym.sym >= SDLK_0 && ev->keysym.sym <= '9') {
-		int32_t i = ev->keysym.sym - SDLK_0;
-		ver2("kbd dat %d %s", i, dn ? "dn" : "up");
-		sig = 60 + i;
-	}
-	else {
-		switch (ev->keysym.sym) {
-		case SDLK_x:
-			ver2("kbd x %s", dn ? "dn" : "up");
-			sig = 70;
-			break;
-
-		case SDLK_e:
-			ver2("kbd e %s", dn ? "dn" : "up");
-			sig = 71;
-			break;
-
-		case SDLK_m:
-			ver2("kbd m %s", dn ? "dn" : "up");
-			sig = 72;
-			break;
-
-		default:
-			return;
-		}
-	}
-
-	if (dn) {
-		but_on(sig);
-	}
-	else {
-		but_off(sig);
-	}
-}
-
 void kbd_init(void)
 {
@@ -186,5 +37,5 @@
 {
 	ver3("kbd exec");
-	return irq;
+	return false;
 }
 
@@ -192,15 +43,5 @@
 {
 	ver2("kbd rd %u:%d", off, sz * 8);
-
-	if (sz != 1 || off > 0) {
-		fail("invalid kbd rd %u:%d", off, sz * 8);
-	}
-
-	irq = false;
-	uint32_t res = reg;
-
-	xmit();
-
-	return res;
+	return 0;
 }
 
@@ -208,4 +49,3 @@
 {
 	ver2("kbd wr %u:%d 0x%0*x", off, sz * 8, sz * 2, val);
-	fail("invalid kbd wr %u:%d", off, sz * 8);
 }
Index: emu/sdl.c
===================================================================
--- emu/sdl.c	(revision f51359cad4cdb056e52aae47198e502a43439d3a)
+++ emu/sdl.c	(revision 5475ecffc7e57c236384c2d970e1fea0538c9460)
@@ -67,5 +67,4 @@
 
 	bool rel_mod = false;
-	uint32_t win = 0;
 
 	while (SDL_AtomicGet(&run) != 0) {
@@ -102,11 +101,4 @@
 				SDL_AtomicSet(&run, 0);
 				continue;
-			}
-
-			if (ev.type == SDL_WINDOWEVENT) {
-				if (ev.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) {
-					ver("sdl ev win %u", ev.window.windowID);
-					win = ev.window.windowID;
-				}
 			}
 
@@ -146,9 +138,5 @@
 			if (ev.type == SDL_TEXTINPUT) {
 				ver("sdl ev text input %d", ev.text.text[0]);
-
-				if (win == ser_win) {
-					ser_text(&ev.text);
-				}
-
+				ser_text(&ev.text);
 				continue;
 			}
@@ -156,22 +144,5 @@
 			if (ev.type == SDL_KEYDOWN) {
 				ver("sdl ev key down %d", (int32_t)ev.key.keysym.sym);
-
-				if (win == ser_win) {
-					ser_key(&ev.key);
-				}
-				else if (win == vid_win) {
-					kbd_key(&ev.key, true);
-				}
-
-				continue;
-			}
-
-			if (ev.type == SDL_KEYUP) {
-				ver("sdl ev key up %d", (int32_t)ev.key.keysym.sym);
-
-				if (win == vid_win) {
-					kbd_key(&ev.key, false);
-				}
-
+				ser_key(&ev.key);
 				continue;
 			}
Index: emu/ser.c
===================================================================
--- emu/ser.c	(revision f51359cad4cdb056e52aae47198e502a43439d3a)
+++ emu/ser.c	(revision 5475ecffc7e57c236384c2d970e1fea0538c9460)
@@ -63,6 +63,4 @@
 
 static SDL_Window *win;
-uint32_t ser_win;
-
 static SDL_Renderer *ren;
 static SDL_atomic_t frame;
@@ -479,10 +477,4 @@
 	}
 
-	ser_win = SDL_GetWindowID(win);
-
-	if (ser_win == 0) {
-		fail("SDL_GetWindowID() failed: %s", SDL_GetError());
-	}
-
 	ren = SDL_CreateRenderer(win, -1, 0);
 
Index: emu/vid.c
===================================================================
--- emu/vid.c	(revision f51359cad4cdb056e52aae47198e502a43439d3a)
+++ emu/vid.c	(revision 5475ecffc7e57c236384c2d970e1fea0538c9460)
@@ -50,5 +50,4 @@
 #define OD0_CB 0x0800
 
-#define AT_UND 0x0100
 #define AT_CG 0x8000
 
@@ -81,6 +80,4 @@
 
 static SDL_Window *win;
-uint32_t vid_win;
-
 static SDL_Renderer *ren;
 static SDL_Texture *tex;
@@ -126,14 +123,6 @@
 				int32_t fg = (at & 0x00f0) >> 4;
 
-				int32_t bits;
-
-				if ((at & AT_UND) != 0 && line == 1) {
-					bits = 0xff;
-				}
-				else {
-					uint16_t *cg = (at & AT_CG) != 0 ? cg0 : cg1;
-					bits = cg[256 * line + ch];
-				}
-
+				uint16_t *cg = (at & AT_CG) != 0 ? cg0 : cg1;
+				int32_t bits = cg[256 * line + ch];
 				int32_t mask = 0x01;
 
@@ -236,10 +225,4 @@
 	if (win == NULL) {
 		fail("SDL_CreateWindow() failed: %s", SDL_GetError());
-	}
-
-	vid_win = SDL_GetWindowID(win);
-
-	if (vid_win == 0) {
-		fail("SDL_GetWindowID() failed: %s", SDL_GetError());
 	}
 
