Solved

Scancodes

Posted on 1998-11-30
5
282 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 100 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

Technology Partners: 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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

690 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