Beruflich Dokumente
Kultur Dokumente
Objective: students will learn how to write program using the interrupts. INT 21H
and INT 10H is used in this program.
Lab Work:
The following programme firstly it clears the screen then set cursor position (in this
example row=5 column=8). After setting cursor, it displays some message.
; ----------------------------------------------------------------------------------
CLEAR MACRO
MOV AX,0600H
MOV BH,07
MOV CX,0000
MOV DX,184FH
INT 10H
ENDM
; ------------------------------------------- ---------------------------------------
CURSOR MACRO Col, Row
MOV AH,02
MOV BH,00
MOV DL,Col
MOV DH,Row
INT 10H
ENDM
; ----------------------------------------------------------------------------------
DISP MACRO MES
MOV AH,09
MOV DX,OFFSET MES
INT 21H
ENDM
; ----------------------------------------------------------------------------------
.MODEL SMALL
.STACK 64H
.DATA
MES1 DB 'There is a message for yo u'
DB ' To read it enter R','$'
MES2 DB 'Hi! This lab is about '
DB ' BIOS and DOS Interrupts ' ,'$'
MES3 DB ' No more message for you','$'
.CODE
MAIN: MOV AX,@DATA
MOV DS, AX
CLEAR
CURSOR 05,08
DISP MES1
MOV AH, 07
INT 21H
CMP AL,'R'
JZ NEXT
CMP AL, 'r'
JZ NEXT
CURSOR 05,09
DISP MES3
JMP EXIT
NEXT: CURSOR 05,09
DISP MES2
EXIT: MOV AH, 4CH
INT 21H
END MAIN
H.W. 5
1. Write a programme that it will read some numbers from the keyboard, if we input a random number
then corresponding message should be the output from the following messages:
If the number <50 fail
If the number >50 and <60 satisfactory
If the number >60 and <70 good
If the number >70 and <80 very good
If the number >80 and < 99 excellent
When the input is a letter then the program must be terminated, all the messages will be Output at the
center of the screen. When a new number has been entered the screen should be cleared before
displaying the new message.
org 100h
CLEAR MACRO
MOV AX, 0600H
MOV BH, 07
MOV CX, 0000
MOV DX, 184FH
INT 10H
ENDM
CURSOR MACRO Col, Row
MOV AH, 02
MOV BH, 00
MOV DL, Col
MOV DH, Row
INT 10H
ENDM
DISP MACRO MES
MOV AH, 09
MOV DX, OFFSET MES
INT 21H
ENDM
.MODEL SMALL
.DATA
MES1 DB 'Enter the tenth position of a number between 00-99 ','$'
MES2 DB 'Enter the unit position of a number between 00-99 ','$'
MES3 DB 'Fail', '$'
MES4 DB 'Pass','$'
MES5 DB 'Good','$'
MES6 DB 'Very Good','$'
MES7 DB 'Excellent','$'
.CODE
MAIN: MOV AX,@DATA
MOV DS, AX
CLEAR
CURSOR 06, 10
DISP MES1
MOV AH, 07
INT 21H
MOV BL, AL
CURSOR 06, 11
DISP MES2
MOV AH, 07
INT 21H
MOV BH, AL
MOV AL, BL
CMP AL, '0'
JB EXIT
CMP AL, '4'
JA LABEL1
CURSOR 06, 12
DISP MES3
LABEL1: CMP AL, '5'
JNZ LABEL2
CURSOR 06, 12
DISP MES4
LABEL2: CMP AL, '6'
JNZ LABEL3
CURSOR 06, 12
DISP MES5
LABEL3: CMP AL, '7'
JNZ LABEL4
CURSOR 06, 12
DISP MES6
LABEL4: CMP AL, '8'
JNZ LABEL5
CURSOR 06, 12
DISP MES7
LABEL5: CMP AL, '9'
JNZ EXIT
CURSOR 06, 12
DISP MES7
EXIT: MOV AH, 4CH
INT 21H
END MAIN
Ret
.MODEL SMALL
.DATA
MES1 DB 'Enter the tenth position of a number between 00-99 ','$'
MES2 DB 'Enter the unit position of a number between 00-99 ','$'
MES3 DB 'Fail', '$'
MES4 DB 'Pass','$'
MES5 DB 'Good','$'
MES6 DB 'Very Good','$'
MES7 DB 'Excellent','$'
DATA1 DB 3,?,3 DUP(?)
.CODE
MAIN: MOV AX,@DATA
MOV DS, AX
CLEAR
CURSOR 06, 10
DISP MES1
MOV AH, 0AH
MOV DX,OFFSET DATA1
INT 21H
MOV BP,DX
MOV BX,[BP+2]
;CURSOR 06, 11
; DISP MES2
; MOV AH, 07
; INT 21H
; MOV BH, AL
MOV AL, BL
CMP AL, '0'
JB EXIT
CMP AL, '4'
JA LABEL1
CURSOR 06, 12
DISP MES3
LABEL1: CMP AL, '5'
JNZ LABEL2
CURSOR 06, 12
DISP MES4
LABEL2: CMP AL, '6'
JNZ LABEL3
CURSOR 06, 12
DISP MES5
LABEL3: CMP AL, '7'
JNZ LABEL4
CURSOR 06, 12
DISP MES6
LABEL4: CMP AL, '8'
JNZ LABEL5
CURSOR 06, 12
DISP MES7
LABEL5: CMP AL, '9'
JNZ EXIT
CURSOR 06, 12
DISP MES7
EXIT: MOV AH, 4CH
INT 21H
END MAIN
ret
2. Develop an assembly language program to read the following test message from the data segment
Vertical Text Test and display the message from up to down. The display device is assumed to be in
the text mode with 25 x 80 resolution.
Hint: INT 10H AH=02 sets cursor location and assumes row in DH and column in DL.
INT 21H AH=02 outputs a character to the monitor. Assumes the character in DL (ASCII).
Function
Function Parameters Return
code