--- 8086tiny.c.orig	2014-02-20 12:02:50.000000000 +0800
+++ 8086tiny.c	2014-02-21 08:56:42.122875000 +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
@@ -565,11 +570,11 @@
 					regs16[REG_SP] += i_data0
 			OPCODE 20: // MOV r/m, immed
 				R_M_OP(op_from_addr[mem], =, i_data2)
 			OPCODE 21: // IN AL/AX, DX/imm8
 				io_ports[0x3DA] ^= 9;
-				io_ports[0x20] = 0; // PIC EOI
+				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[0x40]; // PIT channel 0 read placeholder
 				scratch_uint = extra ? regs16[REG_DX] : (unsigned char)i_data0;
 				scratch_uint == 0x60 && (io_ports[0x64] = 0); // Scancode read flag
 				scratch_uint == 0x3D5 && (io_ports[0x3D4] >> 1 == 7) && (io_ports[0x3D5] = ((mem[0x49E]*80 + mem[0x49D]) & (io_ports[0x3D4] & 1 ? 0xFF : 0xFF00)) >> (io_ports[0x3D4] & 1 ? 0 : 8)); // CRT cursor position
 				R_M_OP(regs8[REG_AL], =, io_ports[scratch_uint]);
@@ -708,10 +713,11 @@
 						cga_pixels[i] = cga_colors[(i & 12) >> 2] + (cga_colors[i & 3] << 16); // CGA -> RGB332
 						herc_pixels[i] = 0xFF*(((i & 1) << 24) + ((i & 2) << 15) + ((i & 4) << 6) + ((i & 8) >> 3)); // Hercules -> RGB332
 					}
 					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
