I'm having a problem reading keys from I/O port 0x60. I'm not sure where the problem is since I don't use an emulator with a debugger.
I'm using Geezer's read_kbd code to grab scancodes, and my own little bootloader to get everything else done. My intention is to be able to write a small keyboard driver that can grab all alphabetic keys in less than 510 bytes.
EDIT: I'm pretty sure the problem is in the reading of the keyboard.
Attached is the assembly code, 16-bit, and it boots.
Reading the keyboard from port 0x60
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Reading the keyboard from port 0x60
- Attachments
-
- kbd_noint.asm
- Interrupt-free keyboard driver that boots.
- (896 Bytes) Downloaded 75 times
Last edited by Troy Martin on Mon Sep 01, 2008 5:00 pm, edited 1 time in total.
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Re: Reading the keyboard from port 0x60
...maybe telling us what the problem is might help....
-JL
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Reading the keyboard from port 0x60
Heh, right.
I did some extra testing by doing "mov 00h, al out 64h, al" on .r. Didn't work, so now I know that the reading of the keyboard is the problem.
I did some extra testing by doing "mov 00h, al out 64h, al" on .r. Didn't work, so now I know that the reading of the keyboard is the problem.
Re: Reading the keyboard from port 0x60
Hi,
The problem is that the BIOS has it's own keyboard handling IRQ (when a key is pressed IRQ 1 occurs and the BIOS probably gets the scancode before you can).
Have you considered just using the BIOS functions? I can guarantee that it won't have all the bugs that your code does (you'd need to handle make codes, break codes and extended codes, but currently just assume everything is a make code).
I'd also assume that a simple BIOS function call will fit in 510 bytes easier; and to be honest you've got nothing to lose because your code relies on the BIOS's keyboard controller initialization, the BIOS's keyboard detection, and (potentially) the BIOS's "PS/2 keyboard emulation for USB keyboards" SMM code.
Cheers,
Brendan
The problem is that the BIOS has it's own keyboard handling IRQ (when a key is pressed IRQ 1 occurs and the BIOS probably gets the scancode before you can).
Have you considered just using the BIOS functions? I can guarantee that it won't have all the bugs that your code does (you'd need to handle make codes, break codes and extended codes, but currently just assume everything is a make code).
I'd also assume that a simple BIOS function call will fit in 510 bytes easier; and to be honest you've got nothing to lose because your code relies on the BIOS's keyboard controller initialization, the BIOS's keyboard detection, and (potentially) the BIOS's "PS/2 keyboard emulation for USB keyboards" SMM code.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Reading the keyboard from port 0x60
Hey,
I'm going to pmode, that's why I need to lose the interrupts.
Also, I threw in a CLI at the start, after the data segment setup, and everything works now.
I'm going to pmode, that's why I need to lose the interrupts.
Also, I threw in a CLI at the start, after the data segment setup, and everything works now.