Page 1 of 1

Mouse driver ISR INT12

Posted: Thu Jul 02, 2015 8:49 am
by tracidor
Hello
I was working on a PS/2 mouse driver in NASM assembly for PC.
All is good, ACK 0xFA returned.
The PIC is initialized with the classic procedure.
The bit b5 is cleared.
Int12 is never thrown in Bochs emulator.
Instead IRQ1 for keyboard works perfectly.
What did I miss?

Re: Mouse driver ISR INT12

Posted: Thu Jul 02, 2015 2:08 pm
by gerryg400
Hi,

Did you enable 'data reporting' by sending 0xf4 and enable the mouse interrupts by setting b1 in the config byte ?

Gerry

Re: Mouse driver ISR INT12

Posted: Thu Jul 02, 2015 2:23 pm
by tracidor
Hello
I did all this:
Here is the init

Code: Select all

Mouse_Enable:
xor eax,eax
.disable_aux:
    waitBeforeWrite
    mov al,0xA7 ; DISABLE_AUX      
      out 0x64, al
       waitBeforeWrite
.read_status:
waitBeforeWrite
      mov al,0x20 ;READ_STATUS_BYTE (KBC)s
      out 0x64, al
       waitBeforeWrite
waitBeforeRead
      in al,0x60 ;MOUSE_DATA_PORT
      or al,0x02 ;INIT_MOUSE int
     and al,1101111b
      
 waitBeforeWrite
.writestatus:
      push eax
     mov al,0x60
      out 0x64 , al ; Write command byte
      waitBeforeWrite
    pop eax
mov al,0x47
      out 0x60,al ;PORT_COMMAND
waitBeforeWrite
       mov al,0xA8 ; ENABLE_AUX
    
      out 0x64, al  
 waitBeforeWrite
; mov al, 0xF6 ;DEFAULT 
  ;   call send_command
call send_reset
 waitBeforeWrite  
   mov al, 0xF4 ;ENABLE_PACKET_STREAMING
     call send_command
 waitBeforeWrite 

waitBeforeWrite and waitBeforeRead are macros testing b1 and bo on port 0x64.
Here is the procedure send_command:
;Send a command, the command is in al
send_command:    
    push eax
waitBeforeWrite
    mov al, 0xD4 ;PRECOMMAND
    out    0x64, al
     
 waitBeforeWrite
     pop eax
     out 0x60,al
     ;wait ack 
   
waitBeforeRead
     in al,0x60
     cmp al,0xFA ; ACK
      jnz error
     ret
  error:
        call abort_for_error 
  ret
I tried send_reset instead of command 0xF6 and the response is 0xAA, so OK.

As I don't have floppy reader I use Bochs and the result is the same I enable or not mouse in conf file.
Perhaps can you see something wrong from the outside or did you already test mouse.
Thanks

Re: Mouse driver ISR INT12

Posted: Thu Jul 02, 2015 3:28 pm
by max
Reformat your post and put code in the appropriate [ code ] tags.

Re: Mouse driver ISR INT12

Posted: Thu Jul 02, 2015 3:40 pm
by tracidor
Hello I'm new on forum.
I put the code in code tags but it is not changed.

Code: Select all

Mouse_Enable:
xor eax,eax
.disable_aux:
waitBeforeWrite
mov al,0xA7 ; DISABLE_AUX 
out 0x64, al
waitBeforeWrite
.read_status:
waitBeforeWrite
mov al,0x20 ;READ_STATUS_BYTE (KBC)s
out 0x64, al
waitBeforeWrite
waitBeforeRead
in al,0x60 ;MOUSE_DATA_PORT
or al,0x02 ;INIT_MOUSE int
and al,1101111b

waitBeforeWrite
.writestatus:
push eax
mov al,0x60
out 0x64 , al ; Write command byte
waitBeforeWrite
pop eax
mov al,0x47
out 0x60,al ;PORT_COMMAND
waitBeforeWrite
mov al,0xA8 ; ENABLE_AUX

out 0x64, al 
waitBeforeWrite
; mov al, 0xF6 ;DEFAULT 
; call send_command
call send_reset
waitBeforeWrite 
mov al, 0xF4 ;ENABLE_PACKET_STREAMING
call send_command
waitBeforeWrite