Questions : 1. Explain the process of writing assembly language program with the help of example. 2. What do you mean by hand assembly ? Explain with the help of example.
Assembly Language Program
Let
us define a program statement as 'write an assembly language program to add two
numbers'. The three tasks are involved in this program :
•
Load two hex numbers
•
Add numbers and
•
Store the result in the memory
These
tasks can be symbolically presented as flow chart, as shown in the Fig. 2.4.1.
Next
job is to find the suitable 8085 assembly language instruction/s for each task.
These instructions are as follows :
Task
1 instructions :
MVI
A, 20H ; Load 20H as a first
number in register A
MVI
B, 40H ; Load 40H as a second
number in register B
Task
2 instruction :
ADD
B ; Add two numbers and save result in register A
Task
3 instruction :
STA
2200H ; Store the result in memory location 2000H
HLT
; Stop the program execution
We
want to execute three tasks in a sequence, thus writing corresponding
instructions in the same sequence constitutes program.
Once
the assembly language program is ready, it is necessary to convert it in the
machine language program. It is possible to do this by referring the proper hex
code for each assembly instruction from the 8085 instruction set manual. This
process is known as hand assembly and the resulted machine language program is
also known as hex code. Let us see the hex code for our program.
Mnemonics Hex
code
MVI
A, 20H 3EH ← Opcode
20H ← Operand
MVI
B, 40H 06H ← Opcode
40H ← Operand
ADD
B 80H ← Opcode
STA
2200H 32H ← Opcode
00H ← Operand (lower byte of address)
22H ← Operand (higher byte of
address)
HLT
76H ← Opcode
Review Questions
1. Explain the process
of writing assembly language program with the help of example.
2. What do you mean by hand assembly ? Explain with the help of example.
Microprocessors and Microcontrollers: Unit II: (a) 8085 Instruction Set and ALP : Tag: : - Assembly Language Program
Microprocessor and Microcontroller
EE3404 MCU 4th Semester EEE Dept | 2021 Regulation | 4th Semester EEE Dept 2021 Regulation