Binary Pattern: Program An Instruction
Binary Pattern: Program An Instruction
Instruction Format:
Each instruction has two parts.
One is the task or operation to be performed called the
operation code opcode.
The second is the data to be operated on Called the operand.
The operand can be specified as 8-bit (or 16-bit) data, an internal
register, a memory location, or 8-bit (or 16-bit) address.
1-Byte Instructions:
It includes the opcode and operand in the same byte. Operand(s) are
internal registers and are coded into the instruction. These instructions
can perform three different tasks as shown in the Fig.
These instructions are stored in 8-bit binary format in one memory
location.
2-Byte Instructions:
The 1st byte specifies the opcode and the 2nd byte specifies the
operand. The operand may be a data or an address, e.g. MVI 𝐴, 35H
and IN 29H. (3)
Opcode Format:
The instructions or operation are specified by using specific bit pattern
unique for each instruction, which contain all the information about
operations, registers, memory, and status flags to be used. (4)
o They transfer:
Data between registers: e.g. copy the contents of register B into
register D.
Data Byte to a register or memory location: e.g. load register B
with the data byte 32H.
Data between a memory location and a register: e.g. from the
memory location 2000H to register B.
Data between an I/O Device and the accumulator: e.g. from an
input keyboard to the accumulator.
o The data in the source is not changed, only the data of the
destination is changed.
o An I/O device can transfer or receive data from the accumulator but
not from other registers (except for the memory mapped I/O device).
o The LXI instruction (Load eXtended Immediate):
The 8085 provides an instruction to place the 16-bit data into the
register pair in one step. LXI Rp, <16-bit address>
– The instruction LXI B 4000H will place the 16-bit number 4000 into
the register pair B, C. The upper two digits are placed in the 1st register
of the pair and the lower two digits in the 2nd.
Arithmetic Operations:
Addition(ADD, ADI):
‒ Any 8-bit number
‒ The contents of a register
‒ The contents of a memory location
• Can be added to the contents of the accumulator and the result is
stored in the accumulator.
Subtraction(SUB, SUI):
‒ Any 8-bit number
‒ The contents of a register
‒ The contents of a memory location
• Can be subtracted from the contents of the accumulator and the
result is stored in the accumulator. No two other registers can be
subtracted directly.
‒ Compare:
• Compare the contents of a register or memory location with the
contents of the accumulator.
Branch Operations :
Unconditional Branch:
‒ JMP Address Jump to the address specified (Go to).
‒ CALL Address Jump to the address specified but treat it as a
subroutine.
‒ RET Return from a subroutine.
Conditional Branch:
‒ Go to new location if a specified condition is met.
Machine Control Operations :
Writing & Executing a Simple Program in 8085 Assembly Language:
Write instructions to add two hexadecimal numbers, 32H & 48H, and
then save the answer in register C. (13)