I've lately been busy writing a basic keyboard driver for my OS project. Yesterday I got as far as to get it to display the pressed key on screen. When tested in bochs this worked perfectly. It also worked perfectly on my main computer (Q6600, Asus P5B). However it does not work correctly on my testbed computer (Celeron 433 MHz). What happens is it takes the first key (sometimes) I press on the keyboard and then won't display any new key. I wonder if anyone else ever encountered problems alike. I include my code:
Code: Select all
key_board:
pushad
push ds
push es
push gs
call kbdriver
mov ax,0x10
mov ds,ax
mov byte[ds:0x000B8100],'K'
mov al,0x20
out 0xA0,al
out 0x20,al
pop gs
pop es
pop ds
popad
iret
Code: Select all
kbdriver:
cld
xor eax,eax
in al,0x60 ;Read Keyboard Input
cmp al,0x80 ;Is bit 7 low?
jae .keyr ;There was a key release
mov eax,[eax + keymap.standard + CORE] ;Convert to ASCII
jmp .movebuffer
.movebuffer:
mov byte[ds:0x000B8070],al
ret
.keyr:
ret
;-------------------------;
;Data Area ;
;-------------------------;
SHIFT db 0
CAPS db 0
CTRL db 0
ALT db 0
LED db 0
SCROLL db 0
NUM db 0

