[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Scancodes

Posted on 1998-11-30
5
Medium Priority
?
285 Views
Last Modified: 2010-04-01
How can I get keyboard input in msdos wich get pressed keys to the keyboard buffer where I could read them afterwards? some kind of interrupt without delay? not in asm please..
0
Comment
Question by:miikkal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 2

Expert Comment

by:pjmaze
ID: 1178905
can you use Asm ?


0
 
LVL 1

Expert Comment

by:MatthewL
ID: 1178906
Hi Miikkal;

By delay, do you mean the routine waits for the key to be pressed?


if so then int 16H, AH=1 will do the trick ( after the call AL= scan code, AH = ascii if ZF is set )

e.g.

char readChar( void )
{
    char temp= (char) 0;  // return zero if no key pressed

    asm {
                   mov ah,0x01
                   int 0x16
                   jnz skip
                   mov temp,al
           }
 
   skip:

   return( temp );
}


Matt

0
 

Author Comment

by:miikkal
ID: 1178907
Edited text of question
0
 

Author Comment

by:miikkal
ID: 1178908
Edited text of question
0
 

Accepted Solution

by:
Mithander earned 200 total points
ID: 1178909
#include<conio.h>

void main(void)
{
char ch=0;
int count = 0;
while(ch!='\n')
{
if(kbhit())
{
  ch=getch();
  cout << "You pressed the " << ch << " key." << endl;
}
cout << count << endl;
}
}

Let me know if you need something else
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question