I have red the documentation, but I still don't get how it works.
There are four registers (input buffer, output buffer, status and command register), but only two ports(0x60 and 0x64) which can be used to access them. Yeah, I could use finished code, but usually I don't write something if I can't fully understand it. So please help.
Input and output ports are registers/pins connected to controller on keyboard?
Both are used to receive/send data, scan codes from the keyboard?
So obviously we need I/O ports to access them, but how do we read status register and how do we send command byte to cmd register?
Auugghh...it's confusing...
OK, say I want to send some command I will wright something like this:
mov al, cmd
out 0x64, cmd
right.... now when I want to read the status I have to use the same I/O port!?
in al, 0x64
But I have to address same I/O port if I want to read output port into al:
mov al, 0xD0
out 0x64, al
???
Please help, I won't go any further until I understand 8024.
Can't understand 8024
Re: Can't understand 8024
It is not that simple.
Reading port 0x64 always gets you the status. (RBIL calls this the "status port" -- RBIL Table P0399.)
Writing port 0x64 sets the "target" for port 0x60 writes, requests current settings, and can change some settings. See RBIL Table P0401. Doing this can often generate bytes and ACKs on port 0x60 that need to be read by you.
(NOTE: RBIL mistakenly has a 0xed LED setting command here, but this is actually a port 0x60 "keyboard target" special function -- not a port 0x64 command.)
Writing port 0x60 sends a byte to the "current target", set with port 0x64. The current target of port 0x60 may be output to the keyboard (default -- RBIL Table P0386), output to the mouse (RBIL Table P03867), setting the "mode" byte (RBIL Table P0383), or setting the "Compaq status" byte (RBIL Table P0403, P0404). Sending an output byte to each of these targets causes special functions to happen.
Input from port 0x60 always gets you bytes from the mouse or the keyboard. (Or bytes that are the result of port 0x64 commands that just look like they came from the kbd or mouse.) If there is a new byte available, you get that. If there is no new byte, you get a copy of the previous byte. This is the "input buffer".
I admit that this device has the worst-explained RBIL documentation of any device.
Reading port 0x64 always gets you the status. (RBIL calls this the "status port" -- RBIL Table P0399.)
Writing port 0x64 sets the "target" for port 0x60 writes, requests current settings, and can change some settings. See RBIL Table P0401. Doing this can often generate bytes and ACKs on port 0x60 that need to be read by you.
(NOTE: RBIL mistakenly has a 0xed LED setting command here, but this is actually a port 0x60 "keyboard target" special function -- not a port 0x64 command.)
Writing port 0x60 sends a byte to the "current target", set with port 0x64. The current target of port 0x60 may be output to the keyboard (default -- RBIL Table P0386), output to the mouse (RBIL Table P03867), setting the "mode" byte (RBIL Table P0383), or setting the "Compaq status" byte (RBIL Table P0403, P0404). Sending an output byte to each of these targets causes special functions to happen.
Input from port 0x60 always gets you bytes from the mouse or the keyboard. (Or bytes that are the result of port 0x64 commands that just look like they came from the kbd or mouse.) If there is a new byte available, you get that. If there is no new byte, you get a copy of the previous byte. This is the "input buffer".
I admit that this device has the worst-explained RBIL documentation of any device.
Re: Can't understand 8024
Thank you bewing.
I'm still a bit confused, so I'll do more reading.
I'm still a bit confused, so I'll do more reading.
____
Dario
Dario