home bbs files messages ]

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,950 of 4,255   
   Robert Pengelly to wolfgang kern   
   Re: Does a PS/2 mouse get detected if pl   
   19 Nov 23 01:40:56   
   
   From: robertapengelly@gmail.com   
      
   On Sunday, 19 November 2023 at 09:28:53 UTC, wolfgang kern wrote:   
   > On 19/11/2023 08:30, Robert Pengelly wrote:   
   > ...   
   > >>>> After I do:   
   > >>>> mov al, HEX (AB)   
   > >>>> call ps2_write_command_read_data   
   >   
   > >>>> on real hardware, I get 0x9C in al. Any ideas what the 9C means? I've   
   tried googling it but I can't seem to find anything.   
   > >>> you might read from keyboard instead of mouse, but as long I don't know   
   > >>> what this call does in detail I can only guess.   
   > >>> how about the other issues? are mice still jumping around ? :)   
   > >> No I got slightly different code now:   
   >   
   > >> ps2_handler:   
   > IRQ_12 handler: or else   
   > >> push ax   
   > >> push bx   
   > >> push cx   
   > >> push dx   
   > >> push si ;what's wrong with using BX ?   
   > >> mov si, cs:[ps2_index]   
   >   
   > >> in al, HEX (64)   
   > >> test al, HEX (20)   
   > >> jz ps2_handler.done   
   > this three above are somehow redundant because when IRQ_12 occur then   
   > port 60 holds data ready to read.   
   >   
   > >> in al, HEX (60)   
   >   
   > TEST AL,8   
   > jz skip_init   
   > ...   
   > >> mov cs:[ps2_buffer + si], al   
   > >> inc word ptr cs:[ps2_index]   
   > >>   
   > >> cmp si, 2   
   > >> jb ps2_handler.done   
   >   
   > >> ps2_handler.got_all:   
   > so you again have the mouse-update within the IRQ, not best choice.   
   > you get there only when the packet is complete ***   
   > >> mov word ptr cs:[ps2_index], 0   
   > >> xor ax, ax   
   > >> xor dx, dx   
   > >> xor cx, cx   
   > >>   
   > >> mov bx, offset ps2_buffer   
   > >> mov al, cs:[bx]   
   > ***   
   > >> test al, HEX (08)   
   > >> jz ps2_handler.done   
   > ***   
   > >> mov cl, 3   
   > >> shl al, cl   
   > something went wrong down there, no my trousers aren't wet.   
   > PS/2 reports 9 bit signed X/Y movement values   
   >   
   > >> sbb dh, dh   
   > when did DX get data apart from zero?   
   > >> cbw   
   > >> mov dl, cs:[bx + 2]   
   > >> neg dx   
   > >> add cs:[mouse_y], dx   
   > >> mov al, cs:[bx + 1]   
   > >> add cs:[mouse_x], ax   
   > >>   
   > >> ps2_handler.done:   
   > >> mov al, HEX (20)   
   > >> out HEX (A0), al   
   > >> out HEX (20), al   
   > >>   
   > >> pop si   
   > >> pop dx   
   > >> pop cx   
   > >> pop bx   
   > >> pop ax   
   > >> iret   
   >   
   > >> and it's been working great so far   
   > I don't believe that this code above work at all.   
   > >> just can't get IRQ12 working on a laptop due to that 0x9C issue. Forgot   
   to add that even:   
   > >>   
   > >> mov al, HEX (A9)   
   > >> call ps2_write_command_read_data   
   > >   
   > >> gives me 0x9C. So both keyboard and mouse aren't detected but they were   
   working when I had the INT 15h stuff implemented.   
   > > I messed that last part up sorry. I meant the keyboard works with int 16h   
   which I'm still using and the mouse worked with the int 15h stuff implemented   
   but for some reason neither the mouse nor keyboard are getting detected for   
   the IRQ's.   
   > show us the code in "ps2_write_command_read_data"   
   > __   
   > wolfgang   
   That code works, at least in qemu.  I haven't been able to test on real   
   hardware due to the 0x9C thing:   
      
   ps2_write_command:   
      
       call    ps2_disable   
       call    ps2_wait_input   
      
       out     HEX (64),   al   
       call    ps2_enable   
      
       ret   
      
   ps2_write_command_read_data:   
      
       call    ps2_write_command   
       call    ps2_read_data   
      
       ret   
      
   ps2_read_data:   
      
       call    ps2_wait_output   
      
       in      al,     HEX (60)   
       ret   
      
   That's the three main functions (besides the disable and enable ones).  You   
   already helped me with ps2_wait input and I used some of the changes to fix   
   ps2_wait_output.   
      
   --- 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