Page 1 of 1
Keyboard driver does not work
Posted: Sat Aug 17, 2002 8:51 pm
by sysfree
[attachment deleted by admin]
Re:Keyboard driver does not work
Posted: Sun Aug 18, 2002 3:35 am
by Silenger
Is int21 not for dos interupts?
Some pascal code:
procedure WriteChr(Chr: Char);
begin
asm
PUSH Ax
MOV Al, Chr
MOV Ah, 0Eh
INT 10h
POP Ax
end;
end;
function ReadChr: Char;
var
Key: Char;
begin
asm
PUSH Ax
XOR Ax, Ax
INT 16h
{Result}
MOV Key, Al
POP Ax
end;
ReadChr := Key;
end;
This should work in real mode but i don't use protected mode yet.
Re:Keyboard driver does not work
Posted: Sun Aug 18, 2002 9:56 am
by guest
IDT defined?
Re:Keyboard driver does not work
Posted: Sun Aug 18, 2002 6:27 pm
by sysfree
Silenger: Maybe you misundstood me. What i wrote is my own OS, not in DOS. But thanks anyway!
Guest: Yes, i had set up the IDT.
Re:Keyboard driver does not work
Posted: Mon Aug 19, 2002 4:38 am
by Pype.Clicker
what does exactly set_intr do ? keep in mind that C code usually trash some registers such as eax & edx... so you should not declare your driver as a plain C function, but at least have an asm stub code that will
pusha
call handler
popa
iretd
by the by, C function also ignores it should return differently from a handler (it will perform a RET instead of an iretd )
Re:Keyboard driver does not work
Posted: Wed Aug 21, 2002 1:03 am
by sysfree
Thank you Clicker! What you said is absolutely right. I DID put my c code into the IDT directly, and that was the fault.
Now my kernel works well. Here you may get the source of my OS:
http://chong2.3322.net/myos/
Regards
Sysfree