EXPERIMENT 1-8 K
EXPERIMENT 1-8 K
EXPERIMENT 1-8 K
MAHSA UNIVERSITY
BEE 3013
LAB MANUAL
Year 3
Semester 1
Doc No:
MAHSA/ENG/FM/09
Date:
Procedure:
1. Turn on the microprocessor Simulator
2. Run the following assembly language
ADDRESS MNEMONICS
2003 LXI H 2000
2006 MOV A, M
2007 INX H
2008 ADD M
2009 INX H
200A MOV M, A
200B HLT
1|Page
HLT Halt the program Execute
PROBLEM
02H + 03H = 05H
CODE FLOWCHART
2|Page
Figure (2) Store data 03H in address 2001H in the accumulator
3|Page
Figure (4) Get the stored data back to A
4|Page
Figure (6) Add the content of M to the Accumulator
5|Page
DISCUSSION
In this experiment, to perform addition using microprocessor 8085 simulator,
normally, the microprocessor fetches, decodes, and executes one instruction after another in
this experiment before an HLT (halt) instruction is executed. The program is an instruction
cycle that consists of several instruction sets, such as read or writes operations between the
processor and memory, registers, or input/output machines, as well as the fetching, encoding,
and execution of a single instruction.
The program starts initializing the first data and the second data and stores them in
sequential addresses, then, load and initiate the program starting from the first address, the
program begins by using the LXI instruction to set the address in the memory pointer (HL) to
2000, then bring the stored data back to A, then performs an addition operation between two
numbers. The memory pointer's address is then expanded by one. The contents of the operand
(register or memory) are added to the contents of the accumulator, and the output is saved in
the accumulator, with the address being raised by one. The STA instruction copies and store
the contents of the source register from address 2002H into the destination register without
changing the contents of the source register, and at the end of the program, the contents of the
HL registers specify the location of one of the operands if it is a memory location, the result
is (05H + 02H = 07H).
CONCLUSION
In summary, for the objective of this experiment, to understand how to run an
assembly program to perform addition using microprocessor 8085 simulators, the program is
used to store data and perform arithmetical operations, the above code used to add to the
number and store the data at a specified address, by providing two hexadecimal numbers and
store them in the memory for processing, the data that has been processed is stored at the
registers (Accumulator), then executing the program.
___________________________________________________________________________
___________________________________________________________________________
Experiment 1.2 for 8085 Microprocessor Simulator
6|Page
Objective:
To write an assembly program to subtract two numbers using microprocessor 8085 simulator
Equipment required:
1. 8085 Microprocessor Simulator
Procedure:
1. Turn on the microprocessor Simulator
2. Write the assembly code to subtract two numbers starting at address 3003 and
increment the address accordingly.
3. Capture and discuss the result in the lab report
PROBLEM
1ST COMPLEMENT
05H - 02H = 03H
2ND COMPLEMENT
03H - 05H = -02H
7|Page
CODE FLOWCHART
8|Page
Figure (2) Store data 02H in address 2001H in the accumulator
9|Page
Figure (4) Get the stored data back to A
10 | P a g e
Figure (6) Subtract content of M to the Accumulator
DISCUSSION
11 | P a g e
In this experiment, to write an assembly program to subtract two numbers using
microprocessor 8085 simulators, the experiment runs to absorb a subtraction of two given
numbers, by providing the MIV which moves immediate data 05H and 02H to the
accumulator sequentially, at address 2000H and 2001H sequentially, which is resulting in a
positive number which has a first complement binary number (05H – 02H = 03H), and the
sign flag and the carry flag was disabled and state high = 0.
By providing different operand, it will move immediate data 02H and 05H to the
accumulator sequentially, which will be resulting in a negative number that has a second
complement binary number (02H – 05H = -03H), and both sign flag and carry flag will be
enabled and state high = 1, at address 2000H and 2001H sequentially, the output of this
experiment is always stored at the accumulator (A), at address 2003, this program used the
first complement so the hexadecimal result is (05H – 02H = 03H).
CONCLUSION
In summary, for the objective of this experiment, to write an assembly program to
subtract two numbers using microprocessor 8085 simulators, the program runs to subtract to
given operand and obtain the value at the accumulator, the result stored at the accumulator
has second complement binary number, if the output number in a positive sign, carry and sign
flags will be disabled state, and if the output number in a negative sign, carry and sign flags
will be enabled state, All the condition code flags are affected depending upon the result, the
actual result is (05H – 02H = 03H).
12 | P a g e