Professional Documents
Culture Documents
Lec 4 New
Lec 4 New
#include<BIOS.H>
Example:
#include<DOS.H>
char st[80] ={"Hello World$"};
char st1[80] ={"Hello Students!$"};
void interrupt (*oldint65)( );
void interrupt newint65( );
void main()
{
oldint65 = getvect(0x65);
setvect(0x65, newint65);
keep(0, 1000);
}
Continued:
void interrupt newint65( )
{
if (( _AH ) = = 0)
{
_AH = 0x09;
_DX = (unsigned int) st;
geninterrupt (0x21);
}
else
{
if (( _AH ) = = 1)
{
_AH = 0x09;
_DX = (unsigned int) st1;
geninterrupt (0x21);
}
}
}
2nd Program:
#include<BIOS.H>
#include<DOS.H>
void main()
{
_AH = 1;
geninterrupt (0x65);
_AH = 0;
geninterrupt (0x65);
}
Interrupt
Interception
Hooks/Stealing
Execution Interrupted
ISR Perform I/O
New Routine
Original Routine
Interrupt Interception
Original Routine
New Routine
Timer Interrupt
Hardware Interrupts
Invoked by Means of
Hardware
Approximately occurs
18.2 times per second
40:17H
Insert key
Ctrl Key
Alt Key
#include <dos.h>
void Interrupt (*old)();
void Interrupt new();
Char far *scr=(char far* ) 0x00400017;
Void main()
{
old=getvect(0x08);
Setvect(0x08,new);
Keep(0,1000);
}
Void interrupt new (){
*scr=64;
(*old)();
}
New Routine
Original Routine
Interrupt Interception
Memory Mapped
Isolated I/O
Isolated I/O
IN
M
I/O
OUT
MOV
I/O
B8OO:0002
B8OO:0003
fore color
Blink
X X X X X X X X
Back Color
Bold
Color
000
100
010
001
111
Black
Red
Gree
n
Blue
Whit
e