Mouse driver ISR INT12

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
tracidor
Posts: 3
Joined: Thu Jul 02, 2015 3:54 am

Mouse driver ISR INT12

Post 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?
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Mouse driver ISR INT12

Post by gerryg400 »

Hi,

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

Gerry
If a trainstation is where trains stop, what is a workstation ?
tracidor
Posts: 3
Joined: Thu Jul 02, 2015 3:54 am

Re: Mouse driver ISR INT12

Post 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
Last edited by Candy on Fri Jul 03, 2015 12:36 am, edited 1 time in total.
Reason: Added code tags
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Mouse driver ISR INT12

Post by max »

Reformat your post and put code in the appropriate [ code ] tags.
tracidor
Posts: 3
Joined: Thu Jul 02, 2015 3:54 am

Re: Mouse driver ISR INT12

Post 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 
Post Reply