?
Solved

Scancodes

Posted on 1998-11-30
5
Medium Priority
?
283 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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

752 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