Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Struglling to finish polling basic protected mode keyboard driver

Status
Not open for further replies.

acer888

Programmer
Nov 25, 2007
1
0
0
GB
Hi,

I have made a very small console like OS , going through various guides , I have been fine learning about the gdt and such things but before I move onto getting C into my kernel I need to get better at Nasm assembly and keyboard IO in protected mode

Heres my current code:
kbRead:
xor eax,eax;
.rd
in al, 64h ; Read Status byte
and al, 10b ; Test IBF flag (Status<1>)
loop I refer2>jz .rd ; Wait for IBF = 1
in al, 60h ; Read input buffer
;------------------------------------------------
mov ecx,p64;
call Puts32b
;-------------------------------------This part above prints an ascii code but never does it when I place the lines as above in the loop , so I never get it this loop, going over various pages again and again the above code all except the part encased in - signs is exact aand im starting to think theres something else up

.kbWrite
in al, 64h ; Read Status byte
and al, 01b ; Test OBF flag (Status<0>)
jnz .kbWrite ; Wait for OBF = 0
out 60h,al ; Write data to output buffer
ret


check this page code is exact, and although I havent dealt with the make code at the end well I should be exiting the first loop but I am not, any ideas?? Its like the input buffer isnt filling even when I press keys so Im never getting out the loop yet the code on


is supposed to work, any idea whats going wrong? (By the way the ascii code I print has zero to do with the in out instructions I just wasnt getting anywhere so I in effect am printing a char to signify whether I am getting out of the first loop , which I am not. It seems the input buffer never fills even with my key pressed, I realise I still need to translate make codes into ascii chars but first I need to figure out where Im going wrong at the start that I am not getting out the loop

I am really really stuck with this, I have read the art of assembly keyboard io in chapter 20 and alot of other excerts but I have never come across any protected mode code that Ive been able to get working :-( all I want to do is print a single keypress to its ascii value, I aint that worried about the cursor as its on a new line initially so once I get the letter printed I actually have routines to move through graphics memmoory and move the cursor, these have previously worked for direct putting strings in graphics mem but getting my keyboard to do anything is proving terribly annoying :-(

Very much round the bend with this problem and would greatly appreciate any input :-(

my kb is a trust ps 2 keyboard kb1300
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top