Output (ASCII and SCAN code) when a is pressed |
The interrupt stores scan code in higher byte of accumulator and ASCII code in lower byte of accumulator.
8086 interrupt number 16h (hexadecimal) to read a keystroke from keyboard. The condition for this interrupt is that the higher byte of accumulator (AH) should be 00h.
#include<stdio.h>
#include<dos.h>
#include<conio.h>
void main()
{
union REGS inregs,outregs; //declaring 2 register files
clrscr();
inregs.h.ah=0x0; //pre-requisite for desired operation of interrupt 16h
int86(0x16,&inregs,&outregs); //calling interrupt 16h
printf("\nScan Code :%d\nASCII code:%d\n",outregs.h.ah,outregs.h.al);
getch();
}
No comments:
Post a Comment