You are on page 1of 8

Computer Organization and Assembly Language

Bachelors of Science (Computer Science) Session (2010-2014)

Submitted By: Marina Shahid


Submitted To: Mam Ayesha Afzal Date: 21, Oct, 2011 Section: A


Lahore Collage For Women University Page 1

A device external to the processor causes a hardware interrupt. The software interrupts are non-mask able and are used to access DOS procedures. Software Interrupts: Software interrupts are used by programs to request system services. Types of Interrupts: The interrupts can be classified into three types depending on the origin of the interrupts Hardware Interrupt Software Interrupt Processor exception Hardware Interrupts: Hardware interrupts are also called “External Interrupts”. The interrupt routine executes and normally returns to the interrupted procedure. which resumes its execution. The two lines that can signal external interrupts are the NMI line (Non-Mask able Interrupt) and the interrupt request line (INTR). such as divide over Lahore Collage For Women University Page 2 . The software interrupts are also known as internal interrupts. The NMI line is used to report memory and I/O parity errors. fixed disk. The INTR line report request from external devices such as timer. and diskette drives. keyboard. and parallel ports (interrupts 05H to 0Fh). serial port. A software interrupt occurs when a program calls an interrupt routine using INT instruction. For example the interrupt number for doing I/O operations s INT 21H. Processor Exception: A processor exception arises when a condition arises inside the processor.Question no1: What are the Interrupts? What are the types of the Interrupts? Interrupts: An interrupt is a routine that interrupts the execution of a program so that the system can take special actions.

memory size INT 13H Disk I/O INT 14H Serial port I/O INT 15H AT services. APM INT 16H Keyboard I/O INT 17H Printer I/O INT 18H ROM-BASIC INT 19H Bootstrap INT 1aH Time I/O. For example: INT 10H Video services INT 11H Equipment list INT 12H Conv. so when the overflow occurs in a divide instruction the 8088 automatically executes interrupt 0 to handle the overflow condition. MRCI hook Lahore Collage For Women University Page 3 . Each condition corresponds to a unique interrupt type.flow. For example. divide overflow is type 0. BIOS contain a set of input /output routines and tables that indicate the status of the system’s devices. The interrupt types 0 to 1FH are known as BIOS interrupts. Question no 2: What is difference between BIOS and DOS Interrupts? BIOS Interrupt: BIOS refer to (Basic Input Output System) it is responsible for booting of your system. Both operating system and user programs can request BIOS routines for communication with devices attached to the system. which requires special handling. Since the BIOS routines offers its own services under a few different interrupt vector numbers. The method of interfacing with the BIOS is by means of software interrupts.

The most useful is INT 21H. spooler. video. Question no 3: Briefly describe the INT 21H of DOS with its functions? Interrupt 21H and Its Functions: The interrupt types 20h-3Fh are serviced by DOS routines that provide high-level service to hardware as well as system resources such as files and directories. which provides many functions for doing keyboard. DOS is the acronym for Disk operating System. and file operations. The most useful is INT 21H which provides many functions for doing keyboard. video and file operations. other APIs) INT 31H DPMI DOS Protected Mode Interface Services. Lahore Collage For Women University Page 4 . TSR control. The interrupt types 20H-3FH are serviced by DOS routines that provide high-level service to hardware as well as system resources such as files and directories.DOS Interrupt: DOS (Disk Operating System) is an operating system that user uses by entering commands in command prompt (to open in windows press starter). Following are the DOS interrupts: INT 20H Terminate a program INT 21H DOS Services INT 22H Terminate address INT 23H Control-Break address INT 24H Critical Error Handler address INT 25H/26H Absolute Disk Read/Write INT 27H Terminate but Stay Resident INT 28H DOS Idle (safe to pop up) INT 29H DOS Internal Fast Screen Write INT 2eH Perform DOS Command INT 2fH Multiplex (DoubleSpace.

memory management. But because CS must be set to the program segment prefix before using INT 20h. Removes the specified directory. it is more convenient to exit a program with INT 21H. function 4Ch. Changes the current directory to the specified directory.Interrupt 20h -. and miscellaneous. minutes. and hundredths Sets the time Obtains the address of an interrupt number from the IVT Creates the specified directory. seconds. month and date Sets the date Returns the time: hours. Interrupt 21h -. disk access.Program Terminate: Interrupt 20h can be used by a program to return control to DOS. Lahore Collage For Women University Page 5 . The following table summarizes some of these functions: Function 0h: Program Terminate 1h: Keyboard Input with Echo 2h: Display Output 5h: Printer Output 8h: Keyboard Input without Echo 9h: Print String 0Ah: Read String 25h: Set Vector 2Ah: Get Date 2Bh: Set Date 2Ch: Get Time 2Dh: Set Time 35h: Get Vector 39h: Create Subdirectory (MKDIR) 3Ah: Remove Subdirectory (RMDIR) 3Bh: Change the Current Directory (CHDIR) Description Terminates the execution of a program Read a character from the keyboard into AL with echo Display the character in DL to the screen Outputs the character in DL to the printer Read a character from the keyboard into AL without echo Display the string characters addressed by DX to the screen Read a string from the keyboard into buffer addressed by DX Sets the address of an interrupt number in the IVT Returns the day of the week. networking. year.Function Request: This routine provides over 80 functions that maybe classified as character I/O. file access.

6=SAT) CX = Year (1980-2099) DH = Month (1-12) Lahore Collage For Women University Page 6 . 07H.Print a character Input: AH = 05H DL = ASCII code of the character to be printed Output: none Function 2AH -. or 0AH Output: It clears the keyboard buffer and performs appropriate Function depending on AL content Function 05H -.Get Date Input: AH = 2AH Output: AL = Day of the week (0=SUN.if the keyboard buffer is not empty Function 0CH -.if the keyboard buffer is empty AL = FFH -. 48h: Allocate Memory 49h: Free Allocated Memory 4Ch: Terminate a Process (EXIT) Next.Clear keyboard buffer Input: AH = 0BH AL = 01H. Allocates the requested number of paragraphs of memory Frees the specified allocated memory Terminates the current process and transfers control to the invoking process.Check keyboard buffer Input: AH = 0BH Output: AL = 00H -. 06H. 08H. we briefly describe some of the DOS INT 21h functions.3Ch: Create a File 3Dh: Open a File 3Eh: Close a File Handle 3Fh: Read from a File 40h: Write to a File 41h: Delete a File from a Specified Directory Creates a new file Opens a file Closes the specified file handle Transfers the specified number of bytes from a file to a buffer Transfers the specified number of bytes from a buffer into a file Removes a directory entry associated with a file name 47h: Get Current Directory Places the full path name of the current directory in the area pointed by DS:SI. Function 0BH -.

if the time is not valid Extended Keyboard Keys: The IBM PC keyboard has several keys that are not the ASCII characters. Home. if the date is not valid Function 2CH -. When an extended key is pressed. function 08h if (AL<>0) then AL = ASCII code (ASCII character) else read the scan code of the extended key into AL using INT 21h. if the date is valid FFh.Set Date Input: AH = 2BH CX = Year (1980-2099) DH = Month (1-12) DL = Day (1-31) Output: AL = 00h. These keys include the function keys. function 07h Lahore Collage For Women University Page 7 . if the time is valid FFh. These keys are called extended keys.DL = Day (1-31) Function 2BH -.Set Time Input: AH = 2DH CH = Hours (0-23) CL = Minutes (0-59) DH = Seconds (0-59) DL = Hundredths (0-99) Output: AL = 00h. etc. the first byte placed in the keyboard buffer is 00H and the second byte is the keyboard scan code for the key. as shown in the following procedure: Read the next character code into AL using INT 21h. End. cursor arrows. extended keys require two function calls.To read a character from the keyboard using DOS functions.Get Time Input: AH = 2CH Output: CH = Hours (0-23) CL = Minutes (0-59) DH = Seconds (0-59) DL = Hundredths (0-99) Function 2DH -.

26h: Interrupt routines 22h-26h handle Ctrl-Break. Interrupt 27h -. and direct disk access. Lahore Collage For Women University Page 8 . critical errors.AL = scan code (extended key character) end if Interrupt 22h -.Terminate but Stay Resident: Interrupt 27h allows programs to stay in memory after termination.