[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] qemu kbd emulation
From: |
Rafał Cygnarowski |
Subject: |
Re: [Qemu-devel] qemu kbd emulation |
Date: |
Wed, 28 Jun 2006 19:27:39 +0200 |
User-agent: |
KMail/1.9.1 |
Dnia środa, 28 czerwca 2006 16:28, Jim C. Brown napisał:
> 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.
Value recived from port 0x60 in interrupt function should
always be the same.
While I'm not sure if this is clear, here is sample code
for testing:
-- BEGIN test.pas --
program time; {$M 2048,0,0}
uses crt, dos;
var oldkbd : procedure;
procedure kbd; interrupt;
begin
Write(' 1. '); Write(Port[$60]);
Write(' 2. '); Write(Port[$60]);
Write(' 3. '); Writeln(Port[$60]);
inline($9c); oldkbd;
end;
begin
getintvec($9, addr(oldkbd));
setintvec($9, @kbd);
keep(0);
end.
-- END test.pas --
kbd function works fine on qemu for keys which fill ps2_queue
to q->count == 1 (like letters). It works in this case becouse
after reading first value from queue q->count is equal 0 and
then last key is returned.
For 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
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
pointer to next value.)
--
Rafał Cygnarowski
address@hidden