I have some problems with my keyboard driver.
Code: Select all
keyboard:
scancode db 0
push rax
xor rax, rax
in al,60h
cmp al,1 ; check for Esc key
je reboot
include "keyboard.asm"
add rcx, 000001h ; rcx - address of video memory
mov [scancode], al
mov bl, [kbd_t + scancode]
mov [rcx], bl ; moves asciicode to video memory
add rcx, 000001h
mov bl, 21h
mov [rcx], bl
; finish of keyboard driver
in al,61h ; give finishing information
out 61h,al ; to keyboard...
mov al,20h
out 20h,al ; ...and interrupt controller
pop rax
iretq
Code: Select all
key_f1 equ 0xC0
key_f2 equ 0xC1
key_f3 equ 0xC2
key_f4 equ 0xC3
key_f5 equ 0xC4
key_f6 equ 0xC5
key_f7 equ 0xC6
key_f8 equ 0xC7
key_f9 equ 0xC8
key_f10 equ 0xC9
key_f11 equ 0xCa
key_f12 equ 0xCb
key_up equ 0xD0
key_down equ 0xD1
key_left equ 0xD2
key_right equ 0xD3
key_home equ 0xD4
key_end equ 0xD5
key_pgup equ 0xD6
key_pgdn equ 0xD7
key_insert equ 0xD8
key_delete equ 0xD9
kbd_t: db 0, 0x1B, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0x08
db 0x09, 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 0x0D
db 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', 0x27, 0x60
db 0, 0x5C, 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 0, '*', 0, ' ', 0
db key_f1, key_f2, key_f3, key_f4, key_f5, key_f6, key_f7, key_f8, key_f9
db key_f10, 0, 0, key_home, key_up, key_pgup, '-', key_left, 0
db key_right, '+', key_end, key_down, key_pgdn, key_insert, key_delete
db 0, 0, 0, key_f11, key_f12, 0, 0, 0, 0x0D, 0, 0, 0, 0, 0, 0, 0, 0
db '/', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7F
db 0, 0, 0, 0, 0, 0
Help me, please! What's wrong with my keyboard driver?
P.S This is Long Mode 64-bit code. For FASM.