Keyboard driver does not work
Re:Keyboard driver does not work
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.
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
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.
Guest: Yes, i had set up the IDT.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard driver does not work
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 )
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
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
Now my kernel works well. Here you may get the source of my OS:
http://chong2.3322.net/myos/
Regards
Sysfree