/* * DOS interrupt 09h handler (IRQ1 - KEYBOARD) * * Copyright 1999 Ove Kåven * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "windef.h" #include "winbase.h" #include "wingdi.h" #include "winuser.h" #include "miscemu.h" #include "wine/debug.h" #include "dosexe.h" WINE_DEFAULT_DEBUG_CHANNEL(int); #define QUEUELEN 31 static struct { BYTE queuelen,queue[QUEUELEN],ascii[QUEUELEN]; } kbdinfo; /********************************************************************** * DOSVM_Int09Handler * * Handler for int 09h. */ void WINAPI DOSVM_Int09Handler( CONTEXT86 *context ) { BYTE ascii, scan = DOSVM_Int09ReadScan(&ascii); BYTE ch[2]; int cnt, c2; TRACE("scan=%02x\n",scan); if (!(scan & 0x80)) { if (ascii) { /* we already have an ASCII code, no translation necessary */ ch[0] = ascii; cnt = 1; } else { UINT vkey = MapVirtualKeyA(scan&0x7f, 1); BYTE keystate[256]; GetKeyboardState(keystate); cnt = ToAscii(vkey, scan, keystate, (LPWORD)ch, 0); } if (cnt>0) { for (c2=0; c2