--- 8086tiny.c	2014-03-19 16:04:54.000000000 +0800
+++ 8086tiny.qhack.c	2014-03-20 13:57:15.363400100 +0800
@@ -7,13 +7,18 @@
 
 #include <time.h>
 #include <sys/timeb.h>
 #include <memory.h>
 
-#ifndef _WIN32
+#if defined(__MINGW32__) || !defined(_WIN32)
 #include <unistd.h>
+#endif
+
+#ifndef _WIN32
 #include <fcntl.h>
+#else
+#include <conio.h>
 #endif
 
 #ifndef NO_GRAPHICS
 #include "SDL.h"
 #endif
@@ -570,10 +575,11 @@
 				else if (!i_d) // RET|RETF imm16
 					regs16[REG_SP] += i_data0
 			OPCODE 20: // MOV r/m, immed
 				R_M_OP(mem[op_from_addr], =, i_data2)
 			OPCODE 21: // IN AL/AX, DX/imm8
+				io_ports[0x340] = io_ports[0x341] = io_ports[0x3E0] = io_ports[0x3E1] = io_ports[0x24F] = io_ports[0x924F] = io_ports[0x927F] = io_ports[0x27F] = 0xFF; // quickfix for misdetecting ACER Pattern Card
 				io_ports[0x20] = 0; // PIC EOI
 				io_ports[0x42] = --io_ports[0x40]; // PIT channel 0/2 read placeholder
 				io_ports[0x3DA] ^= 9; // CGA refresh
 				scratch_uint = extra ? regs16[REG_DX] : (unsigned char)i_data0;
 				scratch_uint == 0x60 && (io_ports[0x64] = 0); // Scancode read flag
@@ -719,10 +725,11 @@
 					for (int i = 0; i < GRAPHICS_X * GRAPHICS_Y / 4; i++)
 						vid_addr_lookup[i] = i / GRAPHICS_X * (GRAPHICS_X / 8) + (i / 2) % (GRAPHICS_X / 8) + 0x2000*(mem[0x4AC] ? (2 * i / GRAPHICS_X) % 2 : (4 * i / GRAPHICS_X) % 4);
 
 					SDL_Init(SDL_INIT_VIDEO);
 					sdl_screen = SDL_SetVideoMode(GRAPHICS_X, GRAPHICS_Y, 8, 0);
+					SDL_WM_SetCaption("8086tiny","8086tiny");
 					SDL_EnableUNICODE(1);
 					SDL_EnableKeyRepeat(500, 30);
 				}
 
 				// Refresh SDL display from emulated graphics card video RAM
