Friends please tell me what happens internally when we press any key on keyboard
i know that it saves the value of certai registers and taKES ON INTERRUPT handler. upto this point its ok. what happen after that???????
What is interrupt handler instructed to do???????????
Thanks
|
Banned
|
|
| 9Aug2009,19:27 | #2 |
|
anyone know what he/she is telling ?
|
|
Go4Expert Member
|
|
| 9Aug2009,19:38 | #3 |
|
yaar i am asking u how the operatring system knows which key has been pressed and what to do when a particular key is pressed
|
|
Mentor
|
![]() |
| 9Aug2009,23:36 | #4 |
|
Which OS?
|
|
Go4Expert Member
|
|
| 10Aug2009,06:55 | #5 |
|
Any oerating system. Ok take your own example (of OS) and please explain
|
|
Security Expert
|
|
| 10Aug2009,08:19 | #6 |
|
Input > Process > Output. THere is a RUBBER NOTCH beneath ur keyboard key. When u push the key the NOTCH is pushed and the circuit on the keyboard is completed, which send a msg to CPU [PROCESSOR] and the key is recorded, and output on application along with monitor
.
|
|
Go4Expert Member
|
|
| 10Aug2009,17:37 | #7 |
|
Thankyou friend for ur reply but I am asking in terms of interrupt. Would you please explain
|
|
Go4Expert Member
|
|
| 20Feb2013,12:33 | #8 |
|
Quote:
Originally Posted by anchitjindal07 To my mind it would be good to give an answer with a full exact code, to be at a concrete level. Unfortunately this is impossible, because we have too much code. Is it really? This question is easy because it don't specify any kernel by name. So, I can use my own! I did write it 1994 when Intel 386, protected mode, was new. It is small and simple enough (some 1000-1500 c-code whole thing). I tested it also taking a connection to a server by the serial line modem (telnet port at server). Code:
char KBDSub()
{ static short code;
static short xl, xh;
static char scan[]={ /* Scan code conversion table for most usual codes */
0,033,'1','2','3','4','5','6','7','8','9','0','+','x','\b','\t',
'q','w','e','r','t','y','u','i','o','p','?',012,015,015,
'a','s','d','f','g','h','j','k','l','&','?',0,
'\\',',','z','x','c','v','b','n','m',',','.','-','/',0,' ',' ',' ',' '};
code = inportb(0x060) ;
xh = xl = inportb(0x061); /* Read scan code*/
xl = xl | 0x080 ;
outportb( 0x61 , xl) ;
outportb( 0x061, xh) ;
if(code >=0 && code <=0x040 ) return(scan[ code]);
else return( 0);
}
void KBDIntHandler()
{ outportb(PIC1_CMND,PIC_EOI);
Send(0,KBD_BOX,KBDSub()); // send message to mailbox- hopefully keyboard task is waiting!
}
Outside the question presented: Yes, saving on entry must be done: Code:
#define Save() asm volatile ("pusha");
#define Restore() asm ("popa;leave;iret;");
Interrupt call gate. Code:
void InterruptHandler()
{
short store;
Save();
enter_int_gate(store);
KBDIntHandler();
leave_int_gate(store);
Restore();
}
Code:
(#define leave_int_gate(STORE) asm("movw %0,%%bx;movw %%bx,%%ds;"\
:\
:"m"(STORE));)
A KBD task: Code:
void main(void) {
while(TRUE) {
................
kbd_char = receive(KBD_BOX,TIMEOUT);
................
}
}
and so on................................I used mainly c and some inline assembly, only floppy disk (see history of computers) boot sector was written using assembly........... |


.
