LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-03-2009, 12:49 PM   #1
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,224

Rep: Reputation: 167Reputation: 167
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

Last edited by smeezekitty; 10-03-2009 at 12:51 PM.
 
Old 10-03-2009, 08:59 PM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,224

Original Poster
Rep: Reputation: 167Reputation: 167
Hello World!
Lets all play drive over the BUMP
 
Old 10-03-2009, 10:30 PM   #3
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 101Reputation: 101
Quote:
Originally Posted by smeezekitty View Post
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.
 
Old 10-03-2009, 11:12 PM   #4
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,224

Original Poster
Rep: Reputation: 167Reputation: 167
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't read from the device driver using read() function. parthi_s Linux - Newbie 1 03-23-2009 06:16 AM
File read/write on /dev/ttyS0 is not working on kernel silent boot ganesha.ld Linux - Embedded & Single-board computer 0 12-23-2008 08:06 AM
kernel function working - readl() giri_blr Linux - Kernel 0 07-28-2008 04:08 AM
Help with the read() function in C smoothdogg00 Programming 4 09-25-2006 08:44 PM
keyboard and mouse stopped working completely in kernel 2.6.9-5.ELsmp Antony_wind Linux - Software 3 08-26-2005 01:56 PM


All times are GMT -5. The time now is 12:31 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration