Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.os.development    |    Operating system development chatter    |    4,255 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 3,937 of 4,255    |
|    Robert Pengelly to wolfgang kern    |
|    Re: Does a PS/2 mouse get detected if pl    |
|    16 Nov 23 22:37:10    |
      From: robertapengelly@gmail.com              On Friday, 17 November 2023 at 03:37:08 UTC, wolfgang kern wrote:       > On 16/11/2023 14:39, Robert Pengelly wrote:       > > On Thursday, 16 November 2023 at 06:35:59 UTC, wolfgang kern wrote:       > >> On 15/11/2023 09:27, Robert Pengelly wrote:       > >> ...       > >>> Right, I rewrite all the IRQ12 related stuff and it seems to work as I       get an A printed in the handler when I capture the mouse with qemu, how do I       tell the controller that I've got the data? I've tried:       > >>>       > >>> in al, 0x20       > >>> out 0x20, al       > >>>       > >>> in al, 0x60       > >>> out 0x60, al       > >>>       > >>> and       > >>>       > >>> in al 0x64       > >>> out 0x64, al       > >>>       > >>> and nothing happens as I only get the A printed once       > >> END of INTERRUPT(IRQ12):       > >> MOV AL, 0xA0       > >> OUT 0xA0,AL ;release IRQ 12       > >> OUT 0x20,AL ;and the cascaded IRQ0..7       > >>       > >> END OF INTERRUPT(IRQ4):       > >> MOV AL,0x20       > >> OUT 0x20,AL       > >>       > >> but if the mouse is out of sync it may need a reset       > >> __       > >> wolfgang       > > Right, I have:       >       > > ps2_handler:       > > push ax       > > in al, HEX (60)       > OK this releases the IRQ-pin       > > mov al, 'A'       > > call writechr       > hope this call doesn't alter any SEGreg, IE-bit or rely on PIC timer.       >       > **; mov al, HEX (A0)       >       > MOV AL,0x20       >       > > out HEX (A0), al       >       > **; mov al, HEX (20)       >       > it is still 0x20       > > out HEX (20), al       > >       > > pop ax       > > iret       >       > > and I get three A's printed every time I move the mouse so that's a good       sign. Looking at the PS/2 packets on https://roborooter.com/post/serial-mice/       it has:       >       > > D7 D6 D5 D4 D3 D2 D1 D0       > > Byte 1 XV XV YS XS 1 M R L       > > Byte 2 X7 X6 X5 X4 X3 X2 X1 X0       > > Byte 3 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0       > >       > > L Left button state (1 = pressed down)       > > M Middle 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 occurred)       > >       > > Is the D3 the status bit? Also, what is the XV/YV for? It says overflow       bit but I'm a little confused as to what I do with it.       > in case of overflow discard movement data and read again.       > someone tried to use OV-bits for movement expansion but worked rare.       > __       > wolfgang       Okay, I have:              ps2_handler:               push ds        push ax        push bx        push cx        push dx               mov ax, cs        mov ds, ax               in al, HEX (60)               test al, HEX (08)        jz ps2_handler.skip_init               xor bx, bx        mov cx, 3               mov [count], cl        mov [index], bx              ps2_handler.skip_init:               mov bx, offset buffer        add bx, [index]               mov [bx], al               inc word ptr [index]        dec byte ptr [count]               mov al, HEX (20)        out HEX (A0), al        jnz ps2_handler.done              ps2_handler.got_all:               xor ax, ax        xor dx, dx        xor cx, cx               mov bx, offset buffer        mov al, [bx]               test al, HEX (08)        jz ps2_handler.done               mov cl, 3        shl al, cl               sbb dh, dh        cbw               mov dl, [bx + 2]        neg dx        add [mouse_y], dx               mov al, [bx + 1]        add [mouse_x], ax              ps2_handler.done:               mov al, HEX (20)        out HEX (20), al               pop dx        pop cx        pop bx        pop ax        pop ds        iret              which works but the mouse can be a little jumpy sometimes, am I doing       something wrong? Also, where would I disregard the movement if there's       overflow? I'm guessing in ps2_handler.got_all but let me know if I'm mistaken.              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca