Presentation is loading. Please wait.

Presentation is loading. Please wait.

Interrupt Mechanism Interrupt Compared With Procedures Call MyProc

Similar presentations


Presentation on theme: "Interrupt Mechanism Interrupt Compared With Procedures Call MyProc"— Presentation transcript:

1 Interrupt Mechanism Interrupt Compared With Procedures Call MyProc
A= Addition(4,5); Printf(“hello world”);

2 Int 21h Int 10h Int3

3 Main Call proc1() Int 21h Proc1() Int 10h Proc2()

4 Interrupt Vector Table
0000:0000 INT1 0000:0004 INTFF 0000:03FFH

5 LO(0) LO(1) HI(0) HI(1) 0000:0001 INT 0 0000:0003 0000:0004 INT 1
0000:0007

6 ISR’s are Routines Resident in Memory
IO.SYS Device Driver Command. COM USER PROGRAM Rom Bios F000:0000

7 004CB0 COMMAND 000410 Environment 0050D0 MEM 000350 Environment
Address Name Size Type Interrupt Vector ROM Communication Area DOS Communication Area IO System Data CON System Device Driver AUX System Device Driver PRN System Device Driver CLOCK$ System Device Driver COM System Device Driver LPT System Device Driver LPT System Device Driver LPT System Device Driver COM System Device Driver COM System Device Driver COM System Device Driver 000A MSDOS System Data 0020E IO System Data KBD CE System Program HIMEM E DEVICE= XMSXXXX Installed Device Driver FILES= FCBS= LASTDRIVE= 0007D STACKS= COMMAND A Program 004C MSDOS Free -- 004CB COMMAND Environment 0050D MEM Environment MEM E0 Program 01C MSDOS C Free -- 09FFF SYSTEM System Program 0C IO System Data MOUSE F System Program 0CC MSDOS Free -- 0CC MSCDEXNT D0 Program 0CC REDIR A Program 0CD0B DOSX A0 Program 0D DOSX Data 0D58F MSDOS A Free -- bytes total conventional memory bytes available to MS-DOS largest executable program size bytes total contiguous extended memory 0 bytes available contiguous extended memory bytes available XMS memory MS-DOS resident in High Memory Area

8 Interrupt Invocation Push Flags, CS, IP Registers, Clear Interrupt Flag Use (INT#)*4 as Offset and Zero as Segment This is the address of interrupt Vector and not the ISR Use lower two bytes of interrupt Vector as offset and move into IP Use the higher two bytes of Vector as Segment Address and move it into CS=0:[offset+2] Branch to ISR and Perform I/O Operation Return to Point of Interruption by Popping the 6 bytes i.e. Flags CS, IP.

9 -d 0:84 0000: C 10 A7 00-4F A |...O.U...U. 0000: A A7 00 9A 10 A U 0000:00A0 B8 10 A F CC B8 10 A T.p...t..... 0000:00B0 B8 10 A7 00 B8 10 A AB D4 0000:00C0 EA AE 10 A7 00 E8 00 F0-B8 10 A7 00 C C #.. 0000:00D0 B8 10 A7 00 B8 10 A7 00-B8 10 A7 00 B8 10 A 0000:00E0 B8 10 A7 00 B8 10 A7 00-B8 10 A7 00 B8 10 A 0000:00F0 B8 10 A7 00 B8 10 A7 00-B8 10 A7 00 B8 10 A 0000: A -q

10 -a 0AF1:0100 int 21 0AF1:0102 -r AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=0AF1 ES=0AF1 SS=0AF1 CS=0AF1 IP= NV UP EI PL NZ NA PO NC 0AF1:0100 CD INT 21 -t AX=0000 BX=0000 CX=0000 DX=0000 SP=FFE8 BP=0000 SI=0000 DI=0000 DS=0AF1 ES=0AF1 SS=0AF1 CS=00A7 IP=107C NV UP DI PL NZ NA PO NC 00A7:107C NOP -d ss:ffe8 0AF1:FFE F1 0A 02 F 0AF1:FFF

11 Parameter Passing to S/W interrupts

12 S/W Interrupts Invocation
Psuedo Variables AX, BX, CX, DX _AX = 0x1234H a = _BX

13 geninterrupt ( 0 x int# )

14 Interrupt 21/09 Description
Int # Service # 9 Inputs AH = 0x09 DS = Segment Address of string DX = Offset Address of string Output Display a String

15 Example: #include<stdio.h> #include<BIOS.H>
#include<DOS.H> char st[80] ={"Hello World$"}; void main() { _DX = (unsigned int) st; _AH = 0x09; geninterrupt(0x21); }

16 Union REGS struct half struct full { { unsigned char al;
unsigned char ah; unsigned char bl; unsigned char bh; unsigned char cl; unsigned char ch; unsigned char dl; unsigned char dh; } struct full { unsigned int ax; unsigned int bx; unsigned int cx; unsigned int dx; } typedef union tagREGS struct full x; struct half h; }REGS;

17 Union Description output #include<DOS.H> REGS regs;
regs.h.al = 0x55; regs.h.ah = 0x99; printf (“%x”,regs.x.ax); output 9955

18 Int86 #include<DOS.H> int86 (0x21, &regs, &regs)

19 Example: #include<stdio.h> #include<BIOS.H>
#include<DOS.H> char st[80] ={"Hello World$"}; void main() { REGS regs; regs.x.dx = (unsigned int) st; regs.h.ah = 0x09; int86(0x21,&regs,&regs); }

20 Interrupt 21/42H Description
Int # Service # 42H Inputs AL = Move Technique BX = File Handle CX-DX = No of Bytes File to be moved AH = Service # = 42H Output DX-AX = No of Bytes File pointer actually moved

21 Animation BOF cp EOF


Download ppt "Interrupt Mechanism Interrupt Compared With Procedures Call MyProc"

Similar presentations


Ads by Google