Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CQgZQ-0004WD-SE for qemu-devel@nongnu.org; Sun, 07 Nov 2004 01:30:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CQgZQ-0004W1-E9 for qemu-devel@nongnu.org; Sun, 07 Nov 2004 01:30:36 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CQgZQ-0004Vy-Av for qemu-devel@nongnu.org; Sun, 07 Nov 2004 01:30:36 -0500 Received: from [142.58.120.21] (helo=rm-rstar.sfu.ca) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CQgQg-00087f-2I for qemu-devel@nongnu.org; Sun, 07 Nov 2004 01:21:34 -0500 Received: from cultus.sfu.ca (cultus.sfu.ca [142.58.101.5]) by rm-rstar.sfu.ca (8.12.10/8.12.5/SFU-5.0H) with ESMTP id iA76LUO2000415 for ; Sat, 6 Nov 2004 22:21:31 -0800 (PST) Message-Id: <200411070621.iA76LUO2000415@rm-rstar.sfu.ca> Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: binary MIME-Version: 1.0 From: Andry Date: Sat, 06 Nov 2004 22:21:30 -0800 Subject: [Qemu-devel] ps/2 mouse handler interrupt Reply-To: Andry , 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 Hello all, I'm trying to write a basic mouse interrupt handler for a simple kernel, but got stuck somewhere... Please, if anyone can tell me where I went wrong? This code is intended to run at the start of a kernel when we're still in real mode. The mouse type i'm trying to handle is the ps/2 mouse. Here's what I understand so far: 1) mouse events are reported to interrupt_vector_table entry number 0x000C (COM1). 2) data bytes from mouse can be read at io port 0x03f8 3) each mouse event generates 3 interrupts, so giving us 3 bytes with the following structure: Data packet format D7 D6 D5 D4 D3 D2 D1 D0 1. XV XV YS XS 1 0 R L 2. X7 X6 X5 X4 X3 X2 X1 X0 3. Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 L Left button state (1 = pressed down) R Right button state (1 = pressed down) X0-X7 Movement in X direction Y0-Y7 Movement in Y direction XS,YS Movement data sign bits (1 = negative) XV,YV Movement data overflow bits (1 = overflow has occured) (from http://www.hut.fi/~then/mytexts/mouse.html) The code I've written looks like this: ... ;init mouse mov ax, 0 int 0x33 ;replace mouse interrupt handler push word 0 pop ds cli mov [4 * MOUSE_INTERRUPT], word mouseHandler mov [4 * MOUSE_INTERRUPT + 2], cs sti jmp $ ... mouseHandler: call printSomething ... mov dx, 0x03f8 in al, dx ;get one mouse data byte ... The problem is that printSomething doesn't get called. So, am I using the wrong interrupt_vector_table entry? Also pls let me know if anything else is wrong with above code... i'm relatively new to x86 assembly language. Thanks, Andre