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,958 of 4,255   
   Robert Pengelly to wolfgang kern   
   Re: Does a PS/2 mouse get detected if pl   
   19 Nov 23 03:49:15   
   
   From: robertapengelly@gmail.com   
      
   On Sunday, 19 November 2023 at 11:36:01 UTC, wolfgang kern wrote:   
   > On 19/11/2023 11:42, Robert Pengelly wrote:   
   > > On Sunday, 19 November 2023 at 10:32:47 UTC, wolfgang kern wrote:   
   > >> On 19/11/2023 10:40, Robert Pengelly wrote:   
   > >>> 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   
   >   
   > >> WHY use A9 at all ? (see below)   
   >   
   > >>>>>> 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"   
   > >>> That code works, at least in qemu.   
   > >> QEMU may just ignore your code and work it's own instead.   
   > >>> 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   
   >   
   > >> (Table P0406)   
   > >> Values for keyboard/mouse test result on PORT 0060h:   
   > >> 00h no error   
   > >> 01h keyboard clock line stuck low   
   > >> 02h keyboard clock line stuck high   
   > >> 03h keyboard data line is stuck low   
   > >> 04h keyboard data line stuck high   
   > >> 05h (Compaq only) diagnostic feature   
   > >>   
   > >> A7 Disable mouse port   
   > >> A8 Enable mouse port   
   > >> A9 MCA test mouse port see Table P0406.   
   > >> A9 AMI set internal flag "good write cache"   
   > >> AD Disable keybd port   
   > >> AE Enable keybd port   
   > >>   
   > >> D4 F4 enable mouse (stream mode)   
   > >> D4 F5 disable mouse (default after reset)   
   > >>> 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.   
   > >> for early tests, I'd inline these few bytes and avoid calls.   
   > > Just re-ran the test on the laptop and I'm definitely getting 0x9C instead   
   of any of the ones you sent but I have no idea what 9C means.   
   > 9C have the four lower bits all set. KEYBOARD stuck?? No idea wha you   
   > get here.   
   > WHY use cmd A9 at all ? I can't remember to have ever tried that one.   
   > __   
   > wolfgang   
   I'm a little confused by "9C have the four lower bits all set." 9C as binary   
   is 1001 1100 so how are all the lower bits set?   
      
   --- 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