You are on page 1of 8

Computer Organization and Assembly Language

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

Submitted By: Marina Shahid

(1854)

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

DEPARTMENT OF COMPUTER SCIENCE FACULTY OF ENGINEERING, TECHNOLOGY & MANAGEMENT SCIENCES LAHORE COLLEGE FOR WOMEN UNIVERSITY, LAHORE

Lahore Collage For Women University Page 1

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. The interrupt routine executes and normally returns to the interrupted procedure, which resumes its execution.

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. A device external to the processor causes a hardware interrupt. The two lines that can signal external interrupts are the NMI line (Non-Mask able Interrupt) and the interrupt request line (INTR). The NMI line is used to report memory and I/O parity errors. The INTR line report request from external devices such as timer, keyboard, serial port, fixed disk, and diskette drives, and parallel ports (interrupts 05H to 0Fh).

Software Interrupts:
Software interrupts are used by programs to request system services. 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. The software interrupts are also known as internal interrupts. The software interrupts are non-mask able and are used to access DOS procedures.

Processor Exception:
A processor exception arises when a condition arises inside the processor, such as divide over
Lahore Collage For Women University Page 2

flow, which requires special handling. Each condition corresponds to a unique interrupt type. For example, divide overflow is type 0, so when the overflow occurs in a divide instruction the 8088 automatically executes interrupt 0 to handle the overflow condition.

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. BIOS contain a set of input /output routines and tables that indicate the status of the systems devices. Both operating system and user programs can request BIOS routines for communication with devices attached to the system. The method of interfacing with the BIOS is by means of software interrupts. The interrupt types 0 to 1FH are known as BIOS interrupts. Since the BIOS routines offers its own services under a few different interrupt vector numbers. For example: INT 10H Video services INT 11H Equipment list INT 12H Conv. 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; MRCI hook

Lahore Collage For Women University Page 3

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). DOS is the acronym for Disk operating System. 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. The most useful is INT 21H which provides many functions for doing keyboard, video and file operations. 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, spooler, TSR control, other APIs) INT 31H DPMI DOS Protected Mode Interface Services.

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. The most useful is INT 21H, which provides many functions for doing keyboard, video, and file operations.

Lahore Collage For Women University Page 4

Interrupt 20h -- Program Terminate:


Interrupt 20h can be used by a program to return control to DOS. But because CS must be set to the program segment prefix before using INT 20h, it is more convenient to exit a program with INT 21H, function 4Ch.

Interrupt 21h -- Function Request:


This routine provides over 80 functions that maybe classified as character I/O, file access, memory management, disk access, networking, and miscellaneous. 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, year, month and date Sets the date Returns the time: hours, minutes, seconds, and hundredths Sets the time Obtains the address of an interrupt number from the IVT Creates the specified directory. Removes the specified directory.

Changes the current directory to the specified directory.

Lahore Collage For Women University Page 5

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. Allocates the requested number of paragraphs of memory Frees the specified allocated memory Terminates the current process and transfers control to the invoking process.

48h: Allocate Memory 49h: Free Allocated Memory

4Ch: Terminate a Process (EXIT)

Next, we briefly describe some of the DOS INT 21h functions.

Function 0BH -- Check keyboard buffer


Input: AH = 0BH Output: AL = 00H -- if the keyboard buffer is empty AL = FFH -- if the keyboard buffer is not empty

Function 0CH -- Clear keyboard buffer


Input: AH = 0BH AL = 01H, 06H, 07H, 08H, or 0AH Output: It clears the keyboard buffer and performs appropriate Function depending on AL content

Function 05H -- Print a character


Input: AH = 05H DL = ASCII code of the character to be printed Output: none

Function 2AH -- Get Date


Input: AH = 2AH Output: AL = Day of the week (0=SUN, 6=SAT) CX = Year (1980-2099) DH = Month (1-12)
Lahore Collage For Women University Page 6

DL = Day (1-31)

Function 2BH -- Set Date


Input: AH = 2BH CX = Year (1980-2099) DH = Month (1-12) DL = Day (1-31) Output: AL = 00h, if the date is valid FFh, if the date is not valid

Function 2CH -- Get Time


Input: AH = 2CH Output: CH = Hours (0-23) CL = Minutes (0-59) DH = Seconds (0-59) DL = Hundredths (0-99)

Function 2DH -- Set Time


Input: AH = 2DH CH = Hours (0-23) CL = Minutes (0-59) DH = Seconds (0-59) DL = Hundredths (0-99) Output: AL = 00h, if the time is valid FFh, if the time is not valid

Extended Keyboard Keys:


The IBM PC keyboard has several keys that are not the ASCII characters. These keys include the function keys, cursor arrows, Home, End, etc. These keys are called extended keys. When an extended key is pressed, the first byte placed in the keyboard buffer is 00H and the second byte is the keyboard scan code for the key.To read a character from the keyboard using DOS functions, extended keys require two function calls, as shown in the following procedure: Read the next character code into AL using INT 21h, 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, function 07h
Lahore Collage For Women University Page 7

AL = scan code (extended key character) end if

Interrupt 22h -- 26h:


Interrupt routines 22h-26h handle Ctrl-Break, critical errors, and direct disk access.

Interrupt 27h -- Terminate but Stay Resident:


Interrupt 27h allows programs to stay in memory after termination.

Lahore Collage For Women University Page 8

You might also like