Sunteți pe pagina 1din 13

Southeast University

Course:Microprocessor Design and Assembly Language Programming Lab


Course Code: CSE 3014
Section: 51
Submitted By
Ataur rahman
ID: 2011000500021
DEPT: EEE
BATCH: 4TH
Exp. Number: 01
Name of the program
A program that uses ADD command to do the multiplication of 12H and 7H.
(Hint: Multiplication can be performed by iterative addition)
Objective
Learning how to multiply two hexa-decimal number by using ADD command
(iterative addition) and how to use loop function.
PROGRAM
.MODEL SMALL
.STACK 64H
.DATA
X DW 12H
Y DW 7H
MULTIFICATION DW ?
.CODE
MAIN: MOV AX,@DATA
MOV DS,AX
MOV BX,OFFSET X
MOV AX,Y
MOV CX,Y
MOV AX,00
ALOOP: ADD AX,[BX]
DEC CX
JNZ ALOOP
MOV MULTIFICATION,AX
MOV AH,4CH
INT 21H
END MAIN
OUTPUT
MULTIFICATION: 007EH
DISCUSSION
First I defined these two number into DB
Then I think how use the loop instruction
Then I take a counter cx.
Last of all, I took a jump instruction (JNZ) for cx
Then I got my result
Conclusion
From that experiment, I learned different types multiplication system, I also
learned use of loop instruction , and adding system.
Exp. Number: 02
Name of the program
An assembly program that finds the lowest value in the following array of
numbers:GRADES DB 19H, 93H, 69H, 55H, 99H
Program
.MODEL SMALL
.STACK 64H
.DATA
GRADES DB 19H, 93H, 69H, 55H, 99H
LOWEST DB ?
.CODE
MAIN: MOV AX,@DATA
MOV DS, AX
MOV BX, OFFSET GRADES
MOV CX, 05
YELLOW: MOV AL, [BX]
GREEN: CMP [BX], AL
JBYELLOW
INC BX
LOOP GREEN
MOV LOWEST, AL
MOV AH, 4CH
INT 21H
END MAIN
Output
LOWEST: 19H
DISCUSSION
First I was defined all data, then I was defined a byte DB.
Then I was thinking how to use loop and to use offset of grades
Then I was thinking about counter cx
Last of all, I took a CMP & jump instruction (JB)
Then I got my result
Conclusion
From that experiment, I have learned how to find out lowest number, use
CMP&loop. And I also learned about comparison between two number.
Exp. Number: 03
Name of the program
A program that finds the result of the following formula. Check the program for
the given value and write down your obtained results as well.
X1= 3, X2=6, X3=9
Objective
Learning how to add, multiply & divide between numbers and how to solve any
equation
Program
.MODEL SMALL
.STACK 64H
.DATA
X1 DB 3
X2 DB 6
X3 DB 9
A DB ?;A=X1*X2
B DB ?;B=X2*X3
C DB ?;C=X3*X2
D DB ?;D=X1+X2+X3
E DB ?;E=A+B+C
F DB ?;ANS
G DB ?;REMINDER
.CODE
MAIN: MOV AX,@DATA
MOV DS,AX
MOV AL,X1
MUL X2
MOV A,AL
MOV AL,X2
MUL X3
MOV B,AL
MOV AL,X3
MUL X1
MOV C,AL
MOV AL,X1
ADD AL,X2
ADD AL,X3
MOV D,AL
MOV AL,A
ADD AL, B
ADD AL, C
MOV E,AL
MOV AL,E
DIV D
MOV F,AL
MOV G,AH
MOV AH,4CH
INT 21H
END MAIN
OUTPUT
F=05H
G =09H
DISCUSSION
First I was thinking how to separate every part of the equation
Then I was thinking about output
Which part of output will go higher byte and which part go lower byte
And what would be if I use 16 bit register
Then I got my result
Conclusion
From that experiment, I have learned how to solve an equation. And I also
learned multiplication , addition ,and division instruction ,
Exp. Number: 04
Name of the program
A program to change the following name to lowercase and, the surname into
uppercase. AlBeRtEiNsTeIn
Objective
Learning how to convert upper case letter to lower case letter and lower case
letter to upper case letter.
Program
.DATA
MIXED DB 'AlBErTEnSTEIN'
F DB 14 DUP(?)
L DB 14 DUP ?
.CODE
MAIN: MOV AX,@DATA
MOV DS,AX
MOV SI,OFFSET MIXED
MOV BX,OFFSET F
MOV CX,8
BACK: MOV AL,[SI]
CMP AL,41H
JB OVER
CMP AL,5AH
JA OVER
add AL,20H
OVER: MOV [BX],AL
INC SI
INC BX
LOOP BACK
MOV SI,OFFSET MIXED
MOV BX,OFFSET L
MOV CX,14
BACK1: MOV AL,[SI+7]
CMP AL,61H
JB OVER1
CMP AL,7AH
JA OVER1
SUB AL,20H
OVER1: MOV [BX],AL
INC SI
INC BX
LOOP BACK1
MOV AH,4CH
INT 21H
END MAIN
Output
DISCUSSION
This was really so hard program for me but after doing this program I feel
good
First I was concerned about separating two parts of the name
AlBeRtEiNsTeIn.
Then I put first name in one place and surname in other place
Then I use counter and loop
For higher case ,I used SUB AL,20H and for lower case I used ADD
AL,20H
Then I got my result
Conclusion
From that experiment, I have learned how to change upper class to lower class
and lower class to upper class conversion.
Exp. Number: 05
Name of the program
A program 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
Objective
Learning how to display massage and take input from keyboard and use that data
for logical function.
Program
Output
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
DISCUSSION
This is so interesting program
First I was concerned about taking input from keyboard.
After taking input from keyboard ,I stored them and I used them for my
logical function
Then I used counter and loop
Then I got my result
Conclusion
From that experiment, I have learned about displaying massage and taking input
from keyboard and use them for logical function.

S-ar putea să vă placă și