Exp 2
Exp 2
Experiment 2: DOS and BIOS Interrupts Programming NAME: ___________________________ STUDENT ID: ____________
Objective To examine and become familiar with the DOS and BIOS Interrupts for the 8086 processor
Step 6 State the purpose of the following program, which is for a monochrome monitor. MOV AH,2 MOV BH,0 MOV DX,0 __________________________________ INT 10H __________________________________ MOV AH,9 __________________________________ MOV BH,0 __________________________________ MOV AL,23H MOV CX,14 MOV BL,0F0H INT 10H
Exercises
Use DOS and BIOS interrupts function calls to carry out the following tasks: 1. Write a program that displays the current time on the screen. (Time Format: HH : MM : SS) Ignore the fractions of seconds. 2. Write a program that define and call three subroutines: clear the screen, center the position of the cursor on the display, and display a text on the monitor. 3. Write a program to create a new writable file called File1, and then ask the user to enter a string of characters, save the string into the file and then close it. 4. Write a program to: Clear the screen. Set the mode CGA of 640 X 200 resolution, and lastly draw a red horizontal line starts at point 50,100 and ends at point 50,200
Since interrupts are numbered 00 to FF, this gives a total of 256interrupts in 80x86 microprocessors. Of these 256 interrupts, two are the most widely used: INT10 and INT 21. each one can perform many functions. You can find a list of these interrupts in textbooks or on the web. Before the service of INT 10H or INT 21H is requested, certain registers must have specific values in them, depending the function being requested. Various functions of INT 21H and INT 10H are selected by the value put in the AH register. BIOS interrupt: INT 10H subroutines are burned into the ROM BIOS of the 8086 based and compatibles and are used to communicate with the computer user screen video. Much of the manipulation of screen text or graphics is done through INT 10H. Among them are changing the color of characters or background, clearing screen, and changing the locations of cursor. Below are two examples that use BIOS interrupts. 1. Clearing the screen: MOV AX, 0600H ;scroll entire screen MOV BH, 07 ;normal attribute ;start at 00,00 MOV CX, 0000 MOV DX, 184FH ;end at 18, 4F INT 10H ;invoke the interrupt 2. Setting the cursor position: MOV AH,02 ;set cursor option MOV BH, 00 ;page 0 MOV DL, 25 ;column position MOV DH,15 ;row position INT 10H DOS interrupts: INT 21h is provided by DOS. When MS-DOS is loaded into the computer, INT 21H can be invoked to perform some extremely useful functions. These functions are commonly referred to as DOS INT 21H function calls. Data input and output through the keyboard and monitor are the most commonly used functions. Below are two examples that use DOS interrupts. 1. display the message defined with variable DATA_ASC DB the earth is but one country,$ MOV AH,09 ;option 9 to display string of data MOV DX, OFFSET DATA_ASC ;DX= offset address of data INT 21H ; invoke the interrupt 2. Inputting a single character, with echo. MOV AH, 01 ;option 01 to input one character INT 21H ;invoke the interrupt