Interrupt Mechanism Interrupt Compared With Procedures Call MyProc

Slides:



Advertisements
Similar presentations
Register In computer architecture, a processor register is a small amount of storage available on the CPU whose contents can be accessed more quickly than.
Advertisements

DOS and BIOS Interrupts DOS and BIOS interrupts are used to perform some very useful functions, such as displaying data to the monitor, reading data from.
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 2 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
More about procedures and Video Processing. Lesson plan Review existing concepts More about procedures and boolean expression Video processing.
Lect 3: Instruction Set and Addressing Modes. 386 Instruction Set (3.4) –Basic Instruction Set : 8086/8088 instruction set –Extended Instruction Set :
Flow Diagram: Push flags, CS, IP Pop IP,CS,flags Push AX,BX,CX,DX,ES,DS,SI,DI,BP POP BP,DI,SI,DS,ES,DX,CX,BX,AX.
BY Kamran Yousaf Application of Computer Graphics and Animation Using C++ Language.
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
CS2422 Assembly Language & System Programming November 2, 2006.
8.7 Memory management Program E Program D System memory DOS INT 21, function 48H: Allocate Memory Specification: allocates a number of memory paragraphs.
Interrupt Processing Haibo Wang ECE Department
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
The 8086 Microprocessor The 8086, announced in 1978, was the first 16-bit microprocessor introduced by Intel Corporation 8086 is 16-bit MPU. Externally.
Lect 4: Instruction Set and Addressing Modes. 386 Instruction Set (3.4)  Basic Instruction Set : 8086/8088 instruction set  Extended Instruction Set.
An Introduction to 8086 Microprocessor.
1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory.
Chapter 3 Examining Computer Memory and Executing Instructions.
Types of Registers (8086 Microprocessor Based)
CSNB374: Microprocessor Systems Chapter 5: Procedures and Interrupts.
Strings, Procedures and Macros
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
Video systems. Lesson plan Review the code for the previous exercise Video systems Review for midterm exam.
10H Interrupt. Option 0H – Sets video mode. Registers used: – AH = 0H – AL = Video Mode. 3H - CGA Color text of 80X25 7H - Monochrome text of 80X25 Ex:
Microprocessors used in Personal Computers. The Memory Map of a Personal Computers Transient Program Area (TPA): Holds the operating system (interrupt.
University of Sargodha, Lahore Campus Prepared by Ali Saeed.
BITS Pilani Pilani Campus Pawan Sharma Lecture /12/ EEE /INSTR/CS F241 ES C263 Microprocessor Programming and Interfacing.
File Operations. FILE PROCESSING For the purposes of the following discussion, reading means copying all or part of an existing file into memory Writing.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Intel MP Organization. Registers - storage locations found inside the processor for temporary storage of data 1- Data Registers (16-bit) AX, BX, CX, DX.
7-Nov Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Oct lecture23-24-hll-interrupts 1 High Level Language vs. Assembly.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
ΜComputer Structure μProcessor Memory Bus System I/O Ports.
Format of Assembly language
1st prog! Q: Read a char – from a keyboard & display it at the beginning of the next line! ====== A.
Microprocessor and Assembly Language
Programming the I/O Hardware
Introduction to 8086 Microprocessor
Assembly Language Programming Part 3
8086 MICROPROCESSOR ARCHITECTURE & SEGMENTATION
8086 Microprocessor.
Computer Organization & Assembly Language Chapter 3
Instruction Execution Cycle
ADDRESSING MODES.
Basic Microprocessor Architecture
ADDRESSING MODES.
Intel 8088 (8086) Microprocessor Structure
Example 21H/42H: handle = open("c:\\abc.txt",O_RDONLY);
Microprocessor and Assembly Language
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
Introduction to Assembly Language
Programming the I/O Hardware
Intel 8088 (8086) Microprocessor Structure
8086 Registers Module M14.2 Sections 9.2, 10.1.
اصول اساسی برنامه نویسی به زبان اسمبلی
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
CS 301 Fall 2002 Computer Organization
The Microprocessor & Its Architecture
Symbolic Instruction and Addressing
CNET 315 Microprocessor & Assembly Language
Unit:08 Software Interrupts
Computer Architecture CST 250
Unit-I 80386DX Architecture
Chapter 6 –Symbolic Instruction and Addressing
Process.
Intel 8086.
Presentation transcript:

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

Int 21h Int 10h Int3

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

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

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

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

004CB0 COMMAND 000410 Environment 0050D0 MEM 000350 Environment 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 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.

-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

-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

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

geninterrupt ( 0 x int# )

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: #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 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;

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

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

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); }

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

Animation BOF cp EOF ------------------- --------------------