#include <studio.h>
#include <dos.h>
void interrupt (*int9save) (void)
void interrupt eliminate_multiple_press(void)
{
int9save=getvect(9);
setvect(9,eliminate_multiple_press);
asm {
MOV AH,0
int 16h
MOV scan_temp,AH
CMP ZF,0
}
}
void interrupt uneliminate_multiple_press()
{
setvect(9,int9save);
}
void main(void)
{
char str[100];
int check=1;
char scan_temp;
unsigned int scan_code ;
eliminate_multiple_press();
printf("enter a word\n");
scanf("%s",str);
scan_code=(unsigned int) scan_temp;
printf("the word is:\n");
printf("%s",str);
uneliminate_multiple_press();
return ;
}
hey i'm writing an assembly code .. i'm trying to solve an interrupt question which asks me to make a long button treated like one button and i`m stucked here !! so please somebody can help me or give me a direcion how continue... when i press the button ZF==0 and when i leave the button ZF==1 this may help thanks alot
In your own keyboard interrupt handler you can have something like this (this is in YASM/NASM syntax, not tested):
Edit: rewrote the code, added comments and links.
The main code (does not belong to interrupt controller):
Some useful links:
OSDev: Interrupts: a useful article about interrupts.
OSDev: "8042" PS/2 Controller: useful information about keyboard handling.
OSDev: 8259 PIC: information about 8259 Programmable Interrupt Controller.