Here is an example of Assembly Language code for 8085. This example illustrates how addition of two 8 bit numbers using Immediate Addressing Mode is done.
DATA SEGMENT // start of the logical segment
FI_NO DB 05H // this instruction directs the
assembler to reserve one
memory location and initialize
it with the value of 05 in
hexadecimal for the variable
named FI_NO.
assembler to reserve one
memory location and initialize
it with the value of 05 in
hexadecimal for the variable
named FI_NO.
SE_NO DB 03H
AV_SUM DB ? // this instruction directs the
assembler to reserve one
memory location and leave
it uninitialized it for the variable named AV_SUM.
assembler to reserve one
memory location and leave
it uninitialized it for the variable named AV_SUM.
DATA ENDS // end of the logical segment
CODE SEGMENT // start of the logical segment
ASSUME CS:CODE DS:DATA // this instruction will inform
the assembler that CS and DS will be assumed names
for the code and data logical
segments respectively.
the assembler that CS and DS will be assumed names
for the code and data logical
segments respectively.
START: MOV AX DATA // data segment is initiallised
MOV DS AX
MOV AL FI_NO // this instruction will get the
first number in accumulator
first number in accumulator
MOV BL SE_NO // this instruction will get the
second number in B register.
second number in B register.
ADD AL BL // this instruction will add both
numbers and will move the
result to the accumulator
numbers and will move the
result to the accumulator
MOV AV_SUM AL // this instruction will move
the result from the accumulator
to the memory location which
was left uninitialized with the
variable named AV_SUM.
the result from the accumulator
to the memory location which
was left uninitialized with the
variable named AV_SUM.
CODE ENDS // end of the logical segment
END START // end of the program