LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   function to read keyboard from withen my kernel not working (https://www.linuxquestions.org/questions/programming-9/function-to-read-keyboard-from-withen-my-kernel-not-working-759442/)

smeezekitty 10-03-2009 12:49 PM

function to read keyboard from withen my kernel not working
 
for some reason that i can not see when i call read_keyboard()
it locks the machine in both the debugger and bootloaded
here is the disassembley:
Code:

push  bp
 mov    bp,sp
 sub    sp,0002
 xor    ax,ax
 int    16
 mov    ah,00
 mov    [bp-02],ax
 mov    al,[bp-02]
 jmp    j0001
 j0001:
 mov    sp,bp
 pop    bp
 ret

original C:
Code:

unsigned char read_keyboard(){
int al;
_AX = 0;
asm {int 16h}
al=_AL;
return al;
}

it does not make sense
i am positive this is how you read from the keyboard

smeezekitty 10-03-2009 08:59 PM

Hello World!
Lets all play drive over the BUMP

lutusp 10-03-2009 10:30 PM

Quote:

Originally Posted by smeezekitty (Post 3706320)
for some reason that i can not see when i call read_keyboard()
it locks the machine in both the debugger and bootloaded
here is the disassembley:
Code:

push  bp
 mov    bp,sp
 sub    sp,0002
 xor    ax,ax
 int    16
 mov    ah,00
 mov    [bp-02],ax
 mov    al,[bp-02]
 jmp    j0001
 j0001:
 mov    sp,bp
 pop    bp
 ret

original C:
Code:

unsigned char read_keyboard(){
int al;
_AX = 0;
asm {int 16h}
al=_AL;
return al;
}

it does not make sense
i am positive this is how you read from the keyboard

It is. But first you have to check the keyboard buffer to see if there are any characters available. It seems the routine is waiting for you to hit a key, and won't return until you do. Naturally enough this locks up the entire machine.

You may want to delay the promised release date for your replacement for Linux.

smeezekitty 10-03-2009 11:12 PM

i never said it was a replacement to linux
and i want it to wait for a key
the thing is it never returns even if you press a key
i had i working for a second then it stopped


All times are GMT -5. The time now is 04:21 AM.