Reply 20 of 31, by superfury
I've just found some little bit of interesting information on the 8042: http://halicery.com/8042/8042_INTERN_TXT.htm
It describes the exact clock signalling and functionality of the 8042(how it handles the host reads/writes etc.). It also explains something the osdev article on the 8042 doesn't: The exact clock signal used by the chip(clock and data lines connected to the PS/2 keyboard, as well as the (hidden) support for XT keyboards! ). The osdev article(http://wiki.osdev.org/%228042%22_PS/2_Controller) doesn't even mention that information.
It also explains the way the ports are used by the controller, thus explaining the communication between the CPU and the 8042(which the osdev article only explains as a bare minimal).
Although, in my case, my 8042 controller commands, parameter and results(of the controller itself) now act like they're from the keyboard, thus timing it's input and output based on the PS/2 keyboard/mouse clock itself(instead of handling it internally). This has the benefit of using the emulated input/output buffers for the 8042 itself(thus making it fully software-compatible for software relying on it).
One thing I've changed, though, is the way the Compaq status register is read: instead of directly giving the resulting status register bits that are stored, it will now use a simple mask(which can mask any bits off) to simulate the 8042 output buffer full bit not reporting 1 when using the "special reed" command(which masks bit 0 off. Reading the byte from the buffer masks it back on, as well as any command byte sent).
The special reed command is also known as the Load security(A5h) command on the AT and PS/2 devices(loads data into the data port to load a password for comparing or storage).
Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io