Latest

6/recent/ticker-posts

SOLUTION OF INTRODUCTION TO 8085 PROGRAMMING (R GAONKAR), MICROPROCESSOR

NOTE: IF YOU HAVE ANY QUERIES, FEEL FREE TO COMMENT

 

1.     list the four categories of 8085 instructions that manipulate data.

Ans:

Data transfer group – Example: MOV, MVI, LXI.

Arithmetic group – Example: ADD, SUB, INR.

Logical group – Example: ANA, XRA, CMP.

Branch group – Example: JMP, JNZ, CALL.

 2.     Define opcode and operand. And specify the opcode and operand  in the instruction MOV HL.

Ans:

The opcode is the instruction that is executed by the CPU and the operand is the data or memory location used to execute that instruction.

 

In MOV HL, MOV is the operand and HL is the opcode.

3.     Write the machine code of the instruction MOV HA if the opcode is (01)2.  The register code for H is (100)and the register code for A is 1112 .

Ans:  the machine code is 01 100 111= 67 H

 

 4. Find the machine codes and the number of bytes of the following instructions.

Identify the opcodes and the operands.

a)    MVI H,47 H

        2647H

        2byte instruction.

        Opcode =MVI

        Operands=47H

b) ADI F5H                                                                                                                                                            

        C6F5H

        2bytes

        Opcode=ADI

        Operands= A(implied),F5H

c)     SUB C

        91C

        1 byte

        Opcode=SUB

        Operands=A(implied),C

5. Find the hex codes from the following instructions. Identify  opcodes and operands, and show the order of the entering the codes in the memory Find the hex codes

a)    STA 2050H

    Hexcode= 322050H

    Opcode=STA

    Operands=2050H

b)    JNZ 2070H

    Hexcode=C22070H

    Opcode= JNZ

    Operands=2070H

6.     Find the hex machine code for the following instructions from the instruction sets listed on the back cover, and identify the number of bytes in each instructions.

 

Instruction

Hex code

bytes

address

 

MVI B,4FH

06  4F

2

2000

 

MVI C,78H

0E 78

2

2002

 

MOV A,C

79

1

2004

 

ADD B

80

1

2005

 

OUT 07H

D3 07

2

2006

 

HLT

76

1

2008

 

 

 

 

 

 













 

7. If the starting address of the system memory is 2000 H, and you were to enter the hex code for the instructions of question 6, identify the memory addresses and the corresponding hex codes

        

 

Instruction

Hex code

bytes

address

 

MVI B,4FH

06  4F

2

2000

 

MVI C,78H

0E 78

2

2002

 

MOV A,C

79

1

2004

 

ADD B

80

1

2005

 

OUT 07H

D3 07

2

2006

 

HLT

76

1

2008

 

 

 

 

 

 










 

 8.     Assemble the following programs, starting with memory address 2020 H.

 

Instruction

address

Hex code

MVI A,8FH

2020

3E8F

MVI B,68H

2022

0668

SUB B

2024

90

ANI 0FH

2025

E60F

STA 2070H

2027

32 2070

HLT

2030

76



9.     Assemble the following programs starting at location 2000 H.


 

Instruction

Hex

Address

IN F2H

DB F2

2000

CMA

2F

2002

ORA A

B7

2003

JZ START

CA0020

2004

 

 

10.  Write the logical steps to add the following two numbers. Both the numbers should be saved for future use. Save the numbers as accumulator.

A2H and 18 H

=>

i)                Load A2H in one register

ii)              Load 18H in second register

iii)            Copy A2H in accumulator

iv)            Add the data of second register to the accumulator

v)              End of the program.

11.  Translate the program in 10 to assembly language.

=>

MVI B,A2H

MVI C,18H

MOV A,B

ADD C

HLT

12.  Data byte 28 H is stored in register B and data byte 97 H is stored in the accumulator. Show the contents of B, C and the accumulator after the execution of the following instructions.

MOV A,B

MOV C,A

=>After the execution of the program,

A=28 H

B=28H

C=28H

13.  In q 6 explain the potential result of the program if the code 07 H of the out instruction is omitted.

=>If the 07 H is omitted, the processor considers the opcode of the next instruction 76H(HLT) as the address of the output port, and outputs the contents of the accumulator to the address 76 H, and continues to the next code which is indeterminate.

14.  In Q 8 explain the possible outcome if the second byte 07FH of the instruction ANI OFH is omitted.

=>The processor takes the opcode 32 H of the next instruction as the second byte of the ANI instruction. Then it takes the next code 20H as the opcode of the next instruction and continues.

15.  Given three sets of hex codes, identify the mnemonics.

=>

a)           3E = MVI A, F2H

             32  = STA 2032H

            76= HLT

c)           06 = MVI B, 82H

           78=MOV A,B

            32= STA 2050 H

            FF= RST 7

d)         06  = MVI B, 4FH

            0E  =MVI C, 37 H

            78  =MOV A,B

            81  =ADD C

            00  =NOP

            32  =STA 2035H

            76= HLT

16.  Identify and explain the results of Q 15 a) and b)

=>

a)    this program, result in storing F2H into 2032H

    1)    Load F2H in accumulator A

    2)    Store the data from A to memory location 2032 H

    3)    End of program

b)    This program results in storing 82H into 2050 H

    )    Load 82 H in register B

    2)    Copy the data in B to A

    3)    Store the data from A to memory location 2050 H

    4)    Execute the instruction at 0038 H memory location

17.  In Q 15. C) what does the code 00 represent? Data, low order address or an opcode?

=>00H is the hex code of opcode NOP. There is no operation.

18.  In Q 15 c), explain what does the program does, calculate the sum and identify the  memory location where the sum is stored.

=>This program gives the sum of 4FH and 37H and store it in  2035H.

        The sum is 87H and it is stored in 2035 H

  

 

Post a Comment

0 Comments