problem in ps\2 mouse driver
Posted: Sat Dec 13, 2003 10:13 am
I'm trying to write a ps2 mouse driver.Ps\2 mouse uses IRQ 12.So i need to reprograme slave pic chip .In the following code i've tried to reprograme master and slave pic chips
so that 70h is for irq 0 on master pic and 08h is for irq 0 on slave pic.
Has i set everything correctly in the following code?
After reprogramming pic ,i've initialized the ps\2 mouse and set the handler so that a character 'm' is printed when it recieves the interrupt from mouse.
But nothing is printed .
Please tell me where i'm making mistake.
i've attached the complete source code so that you can identify if i'm making mistake anywhere else.
[attachment deleted by admin]
so that 70h is for irq 0 on master pic and 08h is for irq 0 on slave pic.
Has i set everything correctly in the following code?
Code: Select all
;;;;;icw1;;;;;;;
mov al,00010001b
out 20h,al
out 0A0h,al
;;;;;;;icw2;;;;;;;
mov al,70h
out 21h,al
mov al,08h
out 0A1h,al
;;;;;;;icw3;;;;;;;;
mov al,00000100b
out 21h,al
mov al,2h
out 0A1h,al
;;;;;;icw4;;;;;;;
mov al,00000001b
out 21h,al
out 0A1h,al
;;;;ocw1;;;;
mov al,11111111b
out 21h,al
mov al,11110111b
out 0A1h,al
But nothing is printed .
Please tell me where i'm making mistake.
Code: Select all
;;;;;;;;;;;;;;;;;;;;;;ps\2 mouse;;;;;
mov bl,0x60
call write_controller
mov bl,0x3
call write_command
mov bl,0xa8
call write_controller
mov bl,0xd4
call write_controller
mov bl,0xfa
call write_command
hang:
jmp hang
;;;;;;;;;;;;;;;;;;;;
write_controller:
wait1:
in al,0x64
and al,0x02
cmp al,0
jne wait1
mov al,bl
mov dx,0x64
out dx,al
ret
;;;;;;;;;;;;;;;;;;;
write_command:
wait2:
in al,0x64
and al,0x02
cmp al,0
jne wait2
mov al,bl
mov dx,0x60
out dx,al
ret
;;;;;;;;handler;;;;;;;;;;;
mouse:
mov ax,LINEAR_SEL
??????mov gs,ax
??????mov byte[gs:0xB8000],'M'
mov dx,0xa0
mov al,0x20
out dx,al
mov dx,0x20
mov al,0x20
out dx,al
iret
Code: Select all