Can't even get mouse id

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
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Can't even get mouse id

Post 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?
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Post by os64dev »

could you also post the code for SendToChip? it might give some additional info.

regards
Author of COBOS
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post 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.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post 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?
Seven11
Member
Member
Posts: 25
Joined: Mon Oct 30, 2006 12:48 pm

Post 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).
xsix
Member
Member
Posts: 59
Joined: Tue Oct 24, 2006 10:52 am

Post by xsix »

i think you should check that controller has data before IN AX, 0x60
Post Reply