Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FvdpP-0005rh-3a for qemu-devel@nongnu.org; Wed, 28 Jun 2006 13:27:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FvdpM-0005rQ-N4 for qemu-devel@nongnu.org; Wed, 28 Jun 2006 13:27:50 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FvdpM-0005rN-Gp for qemu-devel@nongnu.org; Wed, 28 Jun 2006 13:27:48 -0400 Received: from [213.25.173.251] (helo=ns.pers.pl) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1Fve1i-0003Ne-VN for qemu-devel@nongnu.org; Wed, 28 Jun 2006 13:40:35 -0400 Received: from localhost ([127.0.0.1]) by ns.pers.pl with esmtp (Exim 4.61) (envelope-from ) id 1FvdpJ-0005wa-7M for qemu-devel@nongnu.org; Wed, 28 Jun 2006 19:27:45 +0200 Received: from ns.pers.pl ([127.0.0.1]) by localhost (ns.pers.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 19927-18 for ; Wed, 28 Jun 2006 19:27:42 +0200 (CEST) Received: from aow214.internetdsl.tpnet.pl ([83.17.130.214] helo=[10.0.0.21]) by ns.pers.pl with esmtpsa (SSLv3:AES256-SHA:256) (Exim 4.61) (envelope-from ) id 1FvdpG-0005wT-Iy for qemu-devel@nongnu.org; Wed, 28 Jun 2006 19:27:42 +0200 From: =?utf-8?q?Rafa=C5=82_Cygnarowski?= Subject: Re: [Qemu-devel] qemu kbd emulation Date: Wed, 28 Jun 2006 19:27:39 +0200 References: <200606281027.31617.zswi@pers.pl> <200606281416.57021.zswi@pers.pl> <20060628142851.GA16101@jbrown.mylinuxbox.org> In-Reply-To: <20060628142851.GA16101@jbrown.mylinuxbox.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <200606281927.39125.zswi@pers.pl> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Dnia =C5=9Broda, 28 czerwca 2006 16:28, Jim C. Brown napisa=C5=82: > On Wed, Jun 28, 2006 at 02:16:56PM +0200, Rafa?? Cygnarowski wrote: > > So now I have to find out: > > - where those fake keycodes were dropped, > > - why after loading my test program those two 8s are displayed > > (there is some unneeded interrupt generated - am I right?). > > > > Honestly, I don't know where I should start looking... > > Not sure if this is the cause, but I believe that ps2_read_data remembers > the last key pressed and returns it if there is no new key to be read (to > make it work with EMM386 it seems). And it's ok while reading port 0x60 should return last key. What I can say is that I found 1st REAL bug.=20 Value recived from port 0x60 in interrupt function should=20 always be the same.=20 While I'm not sure if this is clear, here is sample code=20 for testing: =2D- BEGIN test.pas -- program time; {$M 2048,0,0} uses crt, dos; var oldkbd : procedure; =20 procedure kbd; interrupt; begin Write(' 1. '); Write(Port[$60]); Write(' 2. '); Write(Port[$60]); Write(' 3. '); Writeln(Port[$60]); inline($9c); oldkbd;=09 end; =20 begin getintvec($9, addr(oldkbd)); setintvec($9, @kbd); keep(0); end. =2D- END test.pas -- kbd function works fine on qemu for keys which fill ps2_queue=20 to q->count =3D=3D 1 (like letters). It works in this case becouse=20 after reading first value from queue q->count is equal 0 and then last key is returned.=20 =46or keys which are suppressed by 0xe0 for example this code fails. ps2_read_data is used to recive Port[$60] value and every use of=20 this function decrease q->count (and moves pointer to next value) which is wrong in this case while this action should take place after exiting my "kbd" function. Any idea how to fix it? (I'm not familiar with qemu src code and I don't know where to put the code which should move ps2_queue=20 pointer to next value.) =2D-=20 Rafa=C5=82 Cygnarowski rafi@pers.pl