EL - 224 Microprocessor Based Systems: Experiment# 04
EL - 224 Microprocessor Based Systems: Experiment# 04
EL - 224 Microprocessor Based Systems: Experiment# 04
Experiment# 04
Performed on
Student Name:
Roll Number:
Marks Obtained
Experiment evaluated by
Sample Program:
.MODEL SMALL
.STACK 100H
.DATA
BIODATA DB "USMAN INTITUTE OF TECHNOLOGY",0DH,0AH
DB "*********MY BIODATA*********",0DH,0AH
DB "NAME: ",0DH,0AH
DB "DEPT:", 0DH,0AH
DB "ROLL NUMBER:", 0DH,0AH
DB "C.G.P.A: ", 0DH,0AH
DB "ENROLLMENT NUMBER: ", 0DH,0AH
DB "BLOOD GROUP: ",'$'
.CODE
.STARTUP
MOV AH,09H
MOV DX, OFFSET BIODATA
INT 21H
.EXIT
END
.MODEL SMALL
.STACK 100H
.DATA
CHAR DB ?
.CODE
.STARTUP
.EXIT
END
Sample Program
.MODEL SMALL
.STACK 100H
.DATA
UIT:
MAXKEY DB 50
CHARINPUT DB ?
BUFFER DB 50 DUP('$'); USE $ TO TERMINATE STRING
.CODE
.STARTUP
MOV AH,0AH
MOV DX, OFFSET UIT
INT 21H
MOV CH, CHARINPUT
MOV AX,0
.EXIT
END
Output Function
02h; Character input
DOS function 2 sends a character to standard output advance the cursor 1 position,
input AH = 2 dl contain the character
Sample Program
.MODEL SMALL
.STACK 100H
.DATA
MSG1 DB 0DH,0AH,"PRESS ANY KEY ",0DH,0AH,'$'
MSG2 DB 0DH,0AH,"YOU HAVE PRESSED: ",'$'
NUM DB ?
.CODE
.STARTUP
MOV AH,09H
MOV DX, OFFSET MSG1
INT 21H
MOV AH, 01H
INT 21H
MOV NUM, AL
MOV AH, 09H
MOV DX, OFFSET MSG2
INT 21H
MOV DL, NUM
MOV AH, 02H
INT 21H
.EXIT
END
Sample Program
.MODEL SMALL
.STACK 100H
START:
MOV AH,01H
INT 21H
MOV USER_INPUT,AL
MOV AL, USER_INPUT
CMP AL,'1'
JE EE
CMP AL,'2'
JE CE
CMP AL,'3'
JE TE
CMP AL,'4'
JE IE
CMP AL,'5'
JE BS
CMP AL,'E'
JE EXIT
CMP AL,'R'
JE START
JMP START
EE:
MOV AH, 09H
MOV DX, OFFSET EE1
INT 21H
.EXIT
END
AAA
The AAA (ASCII adjustment after addition) instruction adjusts the binary result of an
ADD instruction. It makes the result in AL consistent with ASCII digit representation.
The will hold in AX.
Sample Program
.MODEL SMALL
.STACK 100H
.DATA
MSG1 DB 0DH, 0AH, "ENTER FIRST NUMBER:",0DH,0AH,'$'
MSG2 DB 0DH, 0AH, "ENTER SECOND NUMBER:",0DH,0AH,'$'
OP1 DB ?
OP2 DB ?
.CODE
.STARTUP
;FIRST OPERAND
MOV AH, 09H
MOV DX, OFFSET MSG1
INT 21H
MOV AH, 01H
AAS
The AAS (ASCII adjust after subtraction) instruction adjust the binary result of an SUB
instruction. It makes the result in AL consistent with ASCII digit representation. The
ASCII will hold in AX.
Sample Program:
.MODEL SMALL
.STACK 100H
.DATA
MSG1 DB 0DH, 0AH, "ENTER FIRST NUMBER:",0DH,0AH,'$'
MSG2 DB 0DH, 0AH, "ENTER SECOND NUMBER:",0DH,0AH,'$'
OP1 DB ?
OP2 DB ?
.CODE
.STARTUP
;FIRST OPERAND
MOV AH, 09H
MOV DX, OFFSET MSG1
INT 21H
MOV AH, 01H
INT 21H
MOV OP1, AL
;SECOND OPERAND
MOV AH, 09H
MOV DX, OFFSET MSG2
INT 21H
MOV AH, 01H
INT 21H
MOV OP2, AL