You are on page 1of 12

Henzon Jay D.

Bael

BSEE – III

CPE 232 - Lec

1. Explain the classification of the instruction set of the 8085 microprocessor.

Answer:
Data transfer operations, arithmetic operations, logical operations, branching operations,
and Stack, Input/output, machine-control operations are the five functional categories of
these instructions. Data transfer instructions are used to transfer data between registers or
between memory and registers. A data transfer instruction with a „X‟ in its name deals
with a register pair (16-bits). These instructions have no effect on the processor‟s flag
register. Data in registers or on condition flags. The logical AND, OR, and Exclusive OR
instructions allow you to turn specific accumulator bits ON or OFF. The branching
instructions either unconditionally or conditionally change the normal sequential program
flow. Conditional branching instructions check the status of one of four condition flags to
determine whether or not to execute the specified branch. The stack instructions allow the
transfer of data from register pair to stack memory memory is added, subtracted,
incremented, or decremented using arithmetic instructions. The logical operations
function performs logical (Boolean) operations on data in registers and memory, as well
as and from stack memory to the register pair. The input/output instructions allow the
transfer of 8-bit data to input/output port. On the other hand, machine instructions control
the machine operations such as interrupt, halt, or do nothing.

2. Explain the various elements of instructions.


Answer:
Instruction Format of 8085:

 Each Instruction Format of 8085 and Data Format of 8085 microprocessor has specific
information fields. These information fields of instructions are called elements of
instruction. These are:
 Operation code: The operation code field in the instruction specifies the operation to be
performed. The operation is specified by binary code, hence the name operation code or
simply opcode. For example, for 8085 processor operation code for ADD B instruction is
80H.
 Source / destination operand: The source/destination operand field directly specifies the
source/destination operand for the instruction. In the Instruction Format of 8085, the
instruction MOV A, B has B register contents as a source operand and A register contents
as a destination operand because this instruction copies the contents of register B to
register A.
 Source operand address: We know that the operation specified by the instruction may
require one or more operands. The source operand may be in the 8085 register or in the
memory. Many times the Instruction Format of 8085 specifies the address of the source
operand so that operand(s) can be accessed and operated by the 8085 according to the
instruction.

In 8085, the source operand address for instruction ADD M is given by HL register pair.

 Destination operand address: The operation executed by the 8085 may produce result.
Most of the times the result is stored in one of the operand. Such operand is known as
destination operand. The Instruction and Data Format of 8085 which produce result
specifies the destination operand address. In 8085, the destination operand address for
instruction INR M is given by HL register pair because INR M instruction increments the
contents of memory location specified by HL register pair and stores the result in the
same memory location.
 Next instruction address: The next instruction address tells the 8085 from where to fetch
the next instruction after completion of execution of current instruction. For BRANCH
instructions the address of the next instruction is specified within the instruction.
However, for other instructions, the next instruction to be fetched immediately follows
the current instruction. For example, in 8085, instruction after INR B follows it. The
instruction JMP 2000H specifies the next instruction address as 2000H.
3. Give the instruction format for 8085.

Answer:
Instruction Formats:
The Instruction Format of 8085 set consists of one, two and three byte instructions. The
first byte is always the opcode; in two-byte instructions the second byte is usually data; in
three byte instructions the last two-bytes present address or 16-bit data.

 One-byte instruction:

For Example: MOV A, B whose opcode is 78H which is one byte. This Instruction and
Data Format of 8085 copies the contents of B register in A register.

 Two-byte instruction:
For Example: MVI B, 02H. The opcode for this instruction is 06H and is always followed
by a byte data (02H in this case). This instruction is a two-byte instruction which copies
immediate data into B register.

 Three-byte instruction:

For Example: JMP 6200H. The opcode for this instruction is C3H and is always followed by
16-bit address (6200H in this case). This instruction is a three-byte instruction which loads
16-bit address into program counter.

4. Give the opcode formats for 8085.

Answer:
Opcode Format of 8085:

 The 8085A microprocessor has 8-bit opcodes. The opcode is unique for each
Instruction and Data Format of 8085 and contains the information about operation,
register to be used, memory to be used etc. The 8085A identifies all operations,
registers and flags with a specific code. For example, all internal registers are
identified as shown in the Tables 2.1(a) and 2.2(b).
Similarly, there are different codes for each opera are identified as follows:

Note: DDD defines the destination register, SSS defines the source register and DD defines
the register pair

5. Explain the various data formats supported by 8085.


Answer:
Data Format of 8085 Microprocessor:

 The operand is another name for data. It may appear in different forms:
Addresses
Numbers/Logical data and
Characters
Addresses: The address is a 16-bit unsigned integer, number used to refer a memory
location.
Numbers/Data: The 8085 supports following numeric data types.
 Signed Integer: A signed integer number is either a positive number or a negative
number. In 8085, 8-bits are assigned for signed integer, in which most significant bit
is used for sign and remaining seven bits are used for Sign bit 0 indicates positive
number whereas sign bit 1 indicates negative number.
 Unsigned Integer: The 8085 microprocessor supports 8-bit unsigned integer.
 BCD: The term BCD number stands for binary coded decimal number. It uses ten
digits from 0 through 9. The 8-bit register of 8085 can store two digits BCD

Characters: The 8085 uses ASCII code to represent characters. It is a 7-bit


alphanumeric code that represents decimal numbers, English alphabets, and other
special characters.

6. Write the two ways to initialize stack pointer at FFFFH.


Answer:

 The two ways to initialize stack pointer at FFFFH are the PUSH and POP. When the
information is written on the stack, it is called PUSH. When the information is read
from the stack, the operation is called POP. During PUSH and POP operation, stack
pointer register gives the address of the memory where the information is to be stored
or to be read
7. How many times will the two JNZ instructions be executed in the following
sequence? What will be the contents of H and L when the program control reaches to
HLT instruction?
LXI H, 0503H
LOOP: DCR L
JNZ LOOP
DCR H
JNZ LOOP
HLT
Answer:

 LXI H, 0503H- 0503H will be loaded into the HL register pair


 DCR L- these instruction decrements the contents of the register pointed by
HL pair.
 JNZ LOOP- next instruction at new address will get the control
 DCR H- these instruction decrements the contents of the register pointed
by JNZ LOOP- next instruction at new address will get the control.
 HLT- halts the microprocessor instruction.
8. Explain the following instructions:
Answer:

 LHLD 8850- In 8085 Instruction set LHLD is a mnemonic that stands for
Load HL pair using Direct addressing from memory location whose 16-bit
address is denoted as a16. This instruction will copy the contents of L register
at address 2500H and the contents of H register at address 2501H.

 XTHL- In 8085 Instruction set, XTHL is a mnemonic that stands for


“exchange" Top of stack with HL”. This instruction exchanges the contents of
the top two locations of the stack with the contents of register pair HL.

 DAD H- DAD is a mnemonic, which stands for Double ADd and also rp
specifically HL. In this instruction, HL register pair works as Accumulator.
Because the 16-bit content of rp will be added with HL register pair content
and sum thus produced will be stored back on to HL again. It is a sample
instruction of this category. As It is 1-Byte instruction so it occupies a single
Byte place in the memory.

 INR M- In 8085 Instruction set, INR is a mnemonic that stands for


„INcRement‟ and „R‟ stands for any of the following registers or memory
location M pointed by HL pair. This instruction increment the contents of
memory location pointed by HL register pair by 1. The result is stored at the
same memory location. The HL register pair is used as a memory pointer. This
instruction adds 1 with the contents of M. the previous value of M will
increase or increment by amount 1 only.
9. Analyze the 8085 code below to reveal the arithmetic operation performed:
Answer:

 MVI A, 07 - 07 data will be moved or copied to the register A.


 RLC– rotate the contents of the accumulator to the left by 1-bit position
 MOV B, A - in this instruction, 8-bit data value in register A will be moved to
the 8-bit register B.
 RLC -rotate the contents of the accumulator to the left by 1-bit position
 RLC -rotate the contents of the accumulator to the left by 1-bit position
 ORA B - this instruction ORs the contents of B with the Accumulator. the
result will then be stored back into the Accumulator.
10. Explain the contents of the accumulator to run SIM Instructions.
Answer:

 When SIM instruction is executed then the content of the Accumulator decides the
action to be taken. So before executing the SIM instruction, it is
mandatory to initialize Accumulator with the required value.
11. Explain restart as software instructions. Explain the implementation of RST5.
Answer:
In 8085 Instruction set, RSTn is actually standing for “Restart n”. And in this case, n
has a value from 0 to 7 only. Thus the eight possible RST instructions are there, e.g.
RST 0, RST 1, …, RST 7. They are 1-Byte call instructions. RST 5 causes a branch
to a subroutine at 5*8 = 0028H

12. Explain the instructions RIM and SIM.


Answer:

 In 8085 Instruction set, SIM stands for “Set Interrupt Mask”. It is 1-Byte instruction
and it is a multi-purpose instruction.

The main uses of SIM instruction are:


Masking/unmasking of RST7.5, RST6.5, and RST5.5
Reset to 0 RST7.5 flip-flop.
Perform serial output of data.

 Read Interrupt Mask (RIM) :


In 8085 Instruction set, RIM stands for “Read Interrupt Mask”. It is a 1-Byte multi-
purpose instruction.
It is used for the following purposes :
To check whether RST7.5, RST6.5, and RST5.5 are masked or not.
To check whether interrupts are enabled or not.
To check whether RST7.5, RST6.5, or RST5.5 interrupts are pending or not.
To perform serial input of data.

13. Define the instruction and instruction set.


Answer:
 An instruction is a binary pattern designed inside a microprocessor to perform a specific
function. The entire group of instructions that a microprocessor supports is called Instruction
Set.
 The instruction set provides commands to the processor, to tell it what it needs to do. The
instruction set consists of addressing modes, instructions, native data types, registers, memory
architecture, interrupt, and exception handling, and external I/O.

14. Explain the operation difference between the following pairs of instructions.
Answer:
a.) SPHL and XTHL
SPHL - This instruction copies the contents of HL register pair to the stack pointer (SP). It
means that the stack pointer will now point to the memory location whose address was
given in the HL register pair.

XTHL- This instruction exchanges the contents of the memory location pointed by stack
pointer with the contents of the L register and the contents of the next memory location with
the contents of H register. This instruction does not alter the contents of the stack pointer.
b.) LHLD and SHLD addr
LHLD addr instruction copies the contents of the memory location given within the
instruction into the L register and the contents of the next
memory location into H register.
SHLD addr stores the contents of L register in the memory location given within the
instruction and contents of H register at address next to it. This instruction is used to store
the contents of H and L registers directly into the memory. The contents of the H and L
registers remain unchanged.

c.) INR A and ADI 01 H


INR‟s operand R M and it is used to increment the register A by 1. The contents of the
designated register A are incremented by 1 and their resultis stored at the same place.

Whereas, ADI is an 8-bit data which adds the immediate to the accumulator. The 8-bit data
is added to the contents of the accumulator and the result is stored in the accumulator.

It is a 2-byte instruction so it will occupy 2-bytes of memory locations as well. Supposed


the Accumulator has an initial content of 02H, after
addition, the final sum will 01H+02h= 03H.

d.) CALL addr and JMP addr

Under Unconditional CALL, CALL addr calls the subroutine identified by the address.
Under Conditional CALL, CALL addr calls the subroutine identified by the address if the
specified condition is fulfilled.

JMP addr, under Unconditional Jump, JMP addr jumps to the instruction specified by the
address. Under Conditional Jump, JMP addr jumps to the instruction specified by the
address if the specified condition is fulfilled.

CALL instruction is used to transfer program control to a subprogram or subroutine. This


instruction pushes the current PC contents onto the stackand loads the given address into the
PC.

JMP addr loads the PC with the address given within the instruction and resumes program
execution from this location.

e.) XRA A and MVI A, 00H


XRA A is a one-byte instruction is performing the XOR operation with accumulator itself.
MVI A, 00H is an instruction that loads 00H into the accumulator. This is two-byte
instruction.
f.) DAD RP and DAA
DAD RP is an instruction that adds the contents of the specified registerpair to the contents
of the HL register pair and stores the result in the HL register pair. The rp is 16-bit register
pair such as BC, DE, HL, or stackpointer, only higher order register is to be specified for
register pair within the instruction.

DAA instruction then adjusts accumulator to packed BCD after adding two BCD numbers.

15. Explain the operation of following instructions and specify addressing mode and number
of M/C required:
Answer:
a.) DAA- DAA instruction then adjusts accumulator to packed BCD after adding two BCD
numbers.
b.) DAD B- DAD B is a sample instruction. It is 1-Byte instruction so it occupies a single Byte
place in the memory. So this instruction DAD B requires 1-Byte, 3 Machine Cycle (Opcode
Fetch, Bus Idle, Bus Idle) and 10 T-States for execution. This instruction takes 10 T states
including opcode fetch. The opcode fetch cycle takes 4 T states and the remaining 6 T
states, divided into two Machine Cycles, are for the instruction execution. During these 6 T
(two Machine Cycles) states no bus operations are performed.
c.) XTHL- This instruction exchanges the contents of memory location pointed by the stack
pointer with the contents of L registers and the contents of the next memory location with
the contents of H register. This instruction does not modify stack pointer contents.
d.) CNC addr- CNC is a mnemonic, which stands for “Call if Not Carry”. This instruction is
used to branch to the subroutine whose 16-bit address is provided in the instruction, only if
Cy flag value is 0. If Cy flag value is 1, program flow continues in the main program
sequentially. It is a3-Byte instruction.

16. Explain the operation perform by 8085 when the following instructions are executed,
Answer:
a.) SBB C- this instruction will subtract the contents of C register (20H) and carry flag (1) from
the contents of accumulator (40H). It will store the result (40H-20H-1-1FH) in the
accumulator.
b.) RRC-stands for “Rotate Right Accumulator”. With the help of this instruction, we can
rotate the Accumulator current content to the right by 1- bit position. This instruction rotates
the contents of the accumulator right by one position. Bit B0 is placed in B7 as well as in
CY.
c.) LDAX B- LDAX B requires 1-Byte, 2-Machine Cycles (Opcode Fetch, Memory Read) and
7 T-States for execution. LDAX B- loads the accumulator with the contents of memory
location pointed by BC register pair.
d.) XTHL– This instruction exchanges the contents of memory location pointed by the stack
pointer with the contents of L registers and the contents of the next memory location with
the contents of H register. This instruction does not modify stack pointer contents.

18. Explain DAA instruction with an example.

Answer:
DAA instruction belongs to arithmetic group that adjusts accumulator to packed BCD
(Binary Coded Decimal) after adding 2 BCD numbers. Example:

19. What is a program?


Answer:
A computer program is a collection of instructions that can be executed by a computer to
perform a specific task. A computer program is usually
written by a computer programmer in a programming language.

20. Give the steps involved in programming.


Answer:
There are 4 steps involved in programming. 1st step is specifying the problem which is to find
out which task is to be performed. 2nd is designing the problem-solution, a step by step process
that is to be followed. 3rd is coding wherein implementing the 1st & 2nd. Lastly, the 4th
step is debugging the code wherein testing the code if it does the given task.

21. What is a flowchart? Explain its usage.


Answer:
The flowchart is a graphical tool that allows programmers to represent various actions which
are to be performed. This is very useful for clear understanding of the programming language.

22. Explain the process of writing an assembly language program with the help of an example.
Answer:
In writing assembly language, 3 tasks are involved for this example, „write an assembly
program to add two numbers‟. Task 1 is to load 2 hex numbers, task 2 is add numbers then task
3 is store result in the memory. Example:
23. What do you understand by hand assembly? Explain with the help of an example.
Answer:
Hand assembly is the process of converting assembly language to machine language program
by referring the proper hex code for each assembly instruction from 8085 instruction set
manual. Example is MVI A,20H to 3EH for Opcode and 20H for Operand.

24. Explain the process of executing the program on the microprocessor training kit.
Answer:
In executing the program, the microprocessor training kit provides a procedure to execute it.
Entering the starting address of the program to activate the procedure by going to execute mode
by pressing GO key and entering the starting address using hex keys. Once the starting address
is entered, the program can be executed by pressing EXECUTE key

You might also like