• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 599
  • Last Modified:

How do set up a Keyboard Interupt

I would like to set up a Keyboard Interupt using interupt 9 and reading the value from port 60h so that I can detect which key is being pressed.
0
nostromo7
Asked:
nostromo7
  • 2
  • 2
1 Solution
 
craig_capelCommented:
For Windows Or Dos?

Dos is easy

Windows is even easier
0
 
nostromo7Author Commented:
I would like to know how to set it up in dos, please
0
 
imladrisCommented:
The proper method for setting an interrupt vector in DOS is through a DOS function call using function number 0x25. The interface to DOS requires assembly language. You may be able to inline it with your compiler, or a dosfunction call method may be provided with your libraries. To do a DOS call you must set AL to the function number (0x25 in this case) place any arguments in the registers designated by the DOS call and execute an interrupt 0x21,like:

INT 21

The argument for Set Interrupt Vector is a 4 byte address contained in DS:DX.
0
 
nostromo7Author Commented:
it looks like you know what your on about, but at the moment this kind of technique is out of my league, I have not tried linking assembly language with my c progs so although your answer answers my question I am still stuck with the problem.

What the best way to learn assembly with c progs?
0
 
imladrisCommented:
What compiler are you using? In the Microsoft compilers, for instance, there is a function call provided by the library: int86x that does most of the dirty work for you.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now