get char from port 60h
Posted: Thu May 26, 2011 9:04 am
hi guys,
coz my kernel is running in long mode, i have to access the keyboard through port 60h,
however, it doesn't seem to run:
it loops forever at the ".read_port".
any body knows what's happening?
coz my kernel is running in long mode, i have to access the keyboard through port 60h,
however, it doesn't seem to run:
Code: Select all
;=============================================================================
; Get a character from keyboard below 128 (meaning 0..7Fh)
; @return CL The character ASCII code mapped from scancode
;=============================================================================
get_char: pushfq
push rax
push rbp
;get scancode, if >128, wait
.read_port: in al,60h
cmp al,128
jge .read_port
;convert scancode in AL to ASCII code
;and store this ASCII code into CL
.to_ascii: lea rbp,[scancode]
and rax,0ffh
add rbp,rax
mov cl,[rbp]
.finish: pop rbp
pop rax
popfq
ret
any body knows what's happening?