Page 1 of 1
Can't even get mouse id
Posted: Fri Feb 02, 2007 12:57 am
by pcmattman
I'm trying to set up PS/2 Mouse support in my OS, but can't even get the mouse ID... All it returns is 0xFFFF, and I assume that means that there is a problem? Nasm code:
Code: Select all
; gets the mouse id and puts it into ax
GetMouseID:
mov al,0xF2 ; mouse ID command (8042)
call SendToChip ; send it
in ax,60h
ret
AX only holds 0xFFFF after this function. Any ideas?
Posted: Fri Feb 02, 2007 2:03 am
by os64dev
could you also post the code for SendToChip? it might give some additional info.
regards
Posted: Fri Feb 02, 2007 2:12 am
by pcmattman
The code (NASM):
Code: Select all
; sends a command to the 8042 microchip controller
SendToChip:
push cx
push ax
cli
xor cx,cx
scWaitEmpty:
in al,64h
test al,10b
loopnz scWaitEmpty
pop ax
out 64h,al
sti
pop cx
ret
It's all real-mode.
Posted: Fri Feb 02, 2007 5:03 am
by pcmattman
Update: I can now enable/disable the device and do tests on it. The problem is, I've put in code to set streaming mode on the mouse hardware. It should acknowledge with a 0xFA (ack) or a 0xFE (resend). The problem is, I seem to be getting information from the keyboard not from the mouse. Any ideas?
Posted: Sat Feb 03, 2007 8:45 am
by Seven11
you might need to wait some time before the keyboard/mouse replies, my code wait's up to 5 seconds (this was one of the problems I had with the mouse in bochs).
Posted: Sat Feb 03, 2007 1:40 pm
by xsix
i think you should check that controller has data before IN AX, 0x60