logging in or signing up Lec2 wasifgc Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 19 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: October 20, 2009 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Interrupt Mechanism : Interrupt Compared With Procedures Call MyProc A= Addition(4,5); Printf(“hello world”); Interrupt Mechanism Slide 2: Int 21h Int 10h Int3 Slide 3: Main Call proc1() Call proc1() Proc1() Proc2() Int 21h Int 10h Interrupt Vector Table : Interrupt Vector Table INT0 INT1 INTFF 0000:0000 0000:03FFH 0000:0004 Slide 5: INT 0 0000:0001 0000:0003 0000:0004 0000:0007 INT 1 ISR’s are Routines Resident in Memory : ISR’s are Routines Resident in Memory F000:0000 Slide 7: Address Name Size Type ------- -------- ------ ------ 000000 000400 Interrupt Vector 000400 000100 ROM Communication Area 000500 000200 DOS Communication Area 000700 IO 000370 System Data CON System Device Driver AUX System Device Driver PRN System Device Driver CLOCK$ System Device Driver COM1 System Device Driver LPT1 System Device Driver LPT2 System Device Driver LPT3 System Device Driver COM2 System Device Driver COM3 System Device Driver COM4 System Device Driver 000A70 MSDOS 001670 System Data 0020E0 IO 002110 System Data KBD 000CE0 System Program HIMEM 0004E0 DEVICE= XMSXXXX0 Installed Device Driver 000490 FILES= 000090 FCBS= 000200 LASTDRIVE= 0007D0 STACKS= 004200 COMMAND 000A20 Program 004C30 MSDOS 000070 -- Free -- 004CB0 COMMAND 000410 Environment 0050D0 MEM 000350 Environment 005430 MEM 0174E0 Program 01C920 MSDOS 0836C0 -- Free -- 09FFF0 SYSTEM 029000 System Program 0C9000 IO 003100 System Data MOUSE 0030F0 System Program 0CC110 MSDOS 000330 -- Free -- 0CC450 MSCDEXNT 0001D0 Program 0CC630 REDIR 000A70 Program 0CD0B0 DOSX 0087A0 Program 0D5860 DOSX 000080 Data 0D58F0 MSDOS 00A700 -- Free -- 655360 bytes total conventional memory 655360 bytes available to MS-DOS 633776 largest executable program size 1048576 bytes total contiguous extended memory 0 bytes available contiguous extended memory 941056 bytes available XMS memory MS-DOS resident in High Memory Area Interrupt Invocation : 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. Slide 9: -d 0:84 0000:0080 7C 10 A7 00-4F 03 55 05 8A 03 55 05 |...O.U...U. 0000:0090 17 03 55 05 86 10 A7 00-90 10 A7 00 9A 10 A7 00 ..U............. 0000:00A0 B8 10 A7 00 54 02 70 00-F2 04 74 CC B8 10 A7 00 ....T.p...t..... 0000:00B0 B8 10 A7 00 B8 10 A7 00-40 01 21 04 50 09 AB D4 ........@.!.P... 0000:00C0 EA AE 10 A7 00 E8 00 F0-B8 10 A7 00 C4 23 02 C9 .............#.. 0000:00D0 B8 10 A7 00 B8 10 A7 00-B8 10 A7 00 B8 10 A7 00 ................7 0000:00E0 B8 10 A7 00 B8 10 A7 00-B8 10 A7 00 B8 10 A7 00 ................ 0000:00F0 B8 10 A7 00 B8 10 A7 00-B8 10 A7 00 B8 10 A7 00 ................ 0000:0100 8A 04 10 02 .... -q Slide 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=0100 NV UP EI PL NZ NA PO NC 0AF1:0100 CD21 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 90 NOP -d ss:ffe8 0AF1:FFE0 02 01 F1 0A 02 F2 00 00 0AF1:FFF0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 Parameter Passing to S/W interrupts : Parameter Passing to S/W interrupts S/W Interrupts Invocation : S/W Interrupts Invocation Psuedo Variables AX, BX, CX, DX _AX = 0x1234H a = _BX Slide 13: geninterrupt ( 0 x int# ) Interrupt 21/09 Description : Interrupt 21/09 Description Int # 21 Service # 9 Inputs AH = 0x09 DS = Segment Address of string DX = Offset Address of string Output Display a String Example: : 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); } Union REGS : Union REGS struct full { unsigned int ax; unsigned int bx; unsigned int cx; unsigned int dx; } typedef union tagREGS { struct full x; struct half h; }REGS; struct half { unsigned char al; unsigned char ah; unsigned char bl; unsigned char bh; unsigned char cl; unsigned char ch; unsigned char dl; unsigned char dh; } Union Description : Union Description #include<DOS.H> REGS regs; regs.h.al = 0x55; regs.h.ah = 0x99; printf (“%x”,regs.x.ax); output 9955 Int86 : Int86 #include<DOS.H> int86 (0x21, ®s, ®s) Example: : 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,®s,®s); } Interrupt 21/42H Description : Interrupt 21/42H Description Int # 21 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 Slide 21: BOF cp EOF Animation ------------------- -------------------- You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
Lec2 wasifgc Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 19 Category: Entertainment License: All Rights Reserved Like it (0) Dislike it (0) Added: October 20, 2009 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Interrupt Mechanism : Interrupt Compared With Procedures Call MyProc A= Addition(4,5); Printf(“hello world”); Interrupt Mechanism Slide 2: Int 21h Int 10h Int3 Slide 3: Main Call proc1() Call proc1() Proc1() Proc2() Int 21h Int 10h Interrupt Vector Table : Interrupt Vector Table INT0 INT1 INTFF 0000:0000 0000:03FFH 0000:0004 Slide 5: INT 0 0000:0001 0000:0003 0000:0004 0000:0007 INT 1 ISR’s are Routines Resident in Memory : ISR’s are Routines Resident in Memory F000:0000 Slide 7: Address Name Size Type ------- -------- ------ ------ 000000 000400 Interrupt Vector 000400 000100 ROM Communication Area 000500 000200 DOS Communication Area 000700 IO 000370 System Data CON System Device Driver AUX System Device Driver PRN System Device Driver CLOCK$ System Device Driver COM1 System Device Driver LPT1 System Device Driver LPT2 System Device Driver LPT3 System Device Driver COM2 System Device Driver COM3 System Device Driver COM4 System Device Driver 000A70 MSDOS 001670 System Data 0020E0 IO 002110 System Data KBD 000CE0 System Program HIMEM 0004E0 DEVICE= XMSXXXX0 Installed Device Driver 000490 FILES= 000090 FCBS= 000200 LASTDRIVE= 0007D0 STACKS= 004200 COMMAND 000A20 Program 004C30 MSDOS 000070 -- Free -- 004CB0 COMMAND 000410 Environment 0050D0 MEM 000350 Environment 005430 MEM 0174E0 Program 01C920 MSDOS 0836C0 -- Free -- 09FFF0 SYSTEM 029000 System Program 0C9000 IO 003100 System Data MOUSE 0030F0 System Program 0CC110 MSDOS 000330 -- Free -- 0CC450 MSCDEXNT 0001D0 Program 0CC630 REDIR 000A70 Program 0CD0B0 DOSX 0087A0 Program 0D5860 DOSX 000080 Data 0D58F0 MSDOS 00A700 -- Free -- 655360 bytes total conventional memory 655360 bytes available to MS-DOS 633776 largest executable program size 1048576 bytes total contiguous extended memory 0 bytes available contiguous extended memory 941056 bytes available XMS memory MS-DOS resident in High Memory Area Interrupt Invocation : 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. Slide 9: -d 0:84 0000:0080 7C 10 A7 00-4F 03 55 05 8A 03 55 05 |...O.U...U. 0000:0090 17 03 55 05 86 10 A7 00-90 10 A7 00 9A 10 A7 00 ..U............. 0000:00A0 B8 10 A7 00 54 02 70 00-F2 04 74 CC B8 10 A7 00 ....T.p...t..... 0000:00B0 B8 10 A7 00 B8 10 A7 00-40 01 21 04 50 09 AB D4 ........@.!.P... 0000:00C0 EA AE 10 A7 00 E8 00 F0-B8 10 A7 00 C4 23 02 C9 .............#.. 0000:00D0 B8 10 A7 00 B8 10 A7 00-B8 10 A7 00 B8 10 A7 00 ................7 0000:00E0 B8 10 A7 00 B8 10 A7 00-B8 10 A7 00 B8 10 A7 00 ................ 0000:00F0 B8 10 A7 00 B8 10 A7 00-B8 10 A7 00 B8 10 A7 00 ................ 0000:0100 8A 04 10 02 .... -q Slide 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=0100 NV UP EI PL NZ NA PO NC 0AF1:0100 CD21 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 90 NOP -d ss:ffe8 0AF1:FFE0 02 01 F1 0A 02 F2 00 00 0AF1:FFF0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 Parameter Passing to S/W interrupts : Parameter Passing to S/W interrupts S/W Interrupts Invocation : S/W Interrupts Invocation Psuedo Variables AX, BX, CX, DX _AX = 0x1234H a = _BX Slide 13: geninterrupt ( 0 x int# ) Interrupt 21/09 Description : Interrupt 21/09 Description Int # 21 Service # 9 Inputs AH = 0x09 DS = Segment Address of string DX = Offset Address of string Output Display a String Example: : 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); } Union REGS : Union REGS struct full { unsigned int ax; unsigned int bx; unsigned int cx; unsigned int dx; } typedef union tagREGS { struct full x; struct half h; }REGS; struct half { unsigned char al; unsigned char ah; unsigned char bl; unsigned char bh; unsigned char cl; unsigned char ch; unsigned char dl; unsigned char dh; } Union Description : Union Description #include<DOS.H> REGS regs; regs.h.al = 0x55; regs.h.ah = 0x99; printf (“%x”,regs.x.ax); output 9955 Int86 : Int86 #include<DOS.H> int86 (0x21, ®s, ®s) Example: : 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,®s,®s); } Interrupt 21/42H Description : Interrupt 21/42H Description Int # 21 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 Slide 21: BOF cp EOF Animation ------------------- --------------------