x86 Assembly

Moderators: None (Apply to moderate this forum)
Number of threads: 4556
Number of posts: 16011

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Keyboard Interrupt to detect Space, right and left arrow keys Posted by erencan144 on 2 Dec 2011 at 3:53 PM
Hello. I have a homework. My development environment: Turbo C++ 3.0
and programming Language Assembly, ANSI C. I have to detect when the user press Space or right or left arrow keys. It is forbidden that using "dos.h" and "int 21H"
I have found this information but I could not understand how to implement it :

When a key is pressed on keyboard, an interrupt along with a scan code named “make code” is produced and when the key released a “break code” is produced by the keyboard controller. On a PC, keyboard is controlled by a chip and assigned to port numbers 60h and 61h. When a key is pressed on keyboard, scan value is put in register at 60h. You can get this scan code with the following command: in al,60h After getting the scan code, you have to reset the keyboard programming the command register of the chip at 61h with following commands: in al,61h or al,82h out 61h,al and al,7fh out 61h,al At the end of every interrupt service routine, you clear PIC service bit, sending End Of Interrupt (EOI) command, 20h to PIC port at address 20h. mov al,20h out 20h,al



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.