Page 1 of 1

Machine restarting when placing command 0xF4 on PS2 controll

Posted: Tue Jul 27, 2021 6:50 pm
by Patrick367
I'm trying out the idea of ​​creating a keyboard driver, but I have a problem:

Code: Select all


[bits 16]
[org 0x500]

jmp StartKeyboard

StartKeyboard:
	
	mov al, 0xf4
	mov dx, 0x64 
	out dx, al
	
	mov ah, 0x0E
	mov al, "P"
	int 10h
ret
This is the code, I'm sure it arrives on this label because I printed a letter as soon as I got to StartKeyboard (More was just for testing)


the problem is that when I run this code on qemu it keeps restarting all the time
but if I put the 0xED command in al, it works normal, I wanted to know why this is

Re: Machine restarting when placing command 0xF4 on PS2 cont

Posted: Wed Jul 28, 2021 9:09 am
by Octocontrabass
You're sending command 0xF4 to the keyboard controller, not the keyboard. Command 0xF4 is one of several commands that tells the keyboard controller to reset the CPU.

Re: Machine restarting when placing command 0xF4 on PS2 cont

Posted: Wed Jul 28, 2021 3:07 pm
by Patrick367
Octocontrabass wrote:You're sending command 0xF4 to the keyboard controller, not the keyboard. Command 0xF4 is one of several commands that tells the keyboard controller to reset the CPU.
And how would I send this command to the keyboard?, do I need this command to receive keyboard data?

Re: Machine restarting when placing command 0xF4 on PS2 cont

Posted: Wed Jul 28, 2021 3:28 pm
by Octocontrabass
Patrick367 wrote:And how would I send this command to the keyboard?
Assuming the keyboard is plugged into the first PS/2 port, all you need to do is write it to port 0x60.
Patrick367 wrote:do I need this command to receive keyboard data?
If you want to properly initialize the keyboard controller, you'll send several different commands to the keyboard. But you can't properly initialize the keyboard controller until after you initialize USB, so I wouldn't bother right now.