Showing posts with label How Technical. Show all posts
Showing posts with label How Technical. Show all posts

How Hex code for opcode is developed in Microprocessor 8085

In general a simple instruction consists of one or two or three hex code. Hence in order to feed a simple instruction into a microprocessor kit, we usually gives the hex code into the kit.

Eg.Instruction  MOV B,A represents that the contents of A register is moved into B register. Inorder to feed this instruction into a kit, we usually refer an opcode sheet and check for the corresponding hexcode, here for MOV B,A we have 47. Hence 47 is typed to represents this command.

Now we are going to see how hex code for each instructions are framed.

In the design of the 8085 microprocessor chip, all the operations, registers and staus flags are identified with a specific code. For Eg, all internal registers are identified as follows:

Code         Registers                                         Code           Register Pair
000                  B                                                  00                   BC
001                  C                                                  01                   DE
010                  D                                                  10                   HL
011                  E                                                   11                   SP
100                 H
101                 L
111                 A
110       Reserved for memory
              related operation

Lets now see how some operations are developed:

1. Add the contents of a register to the Accumulator                         10000   SSS
                                                                                      (5-bit opcode 3-bits are reserved for a register)
Add     : 10000
Reg B  : 000
Hence Binary instruction : 10000 000 --> Corresponding hexcode is 80

2. Move(copy) the contents of reg Rs to reg Rd               01             DDD         SSS
                                                                                           copy        reg Rd      reg Rs
For MOV C,A :
  Move   : 01
  To reg C : 001 (DDD)
  Form reg A : 111 (SSS)
  Binary instruction: 01 001 111     ---> corresponding hexcode is 4F

Similarly all other hexcode for each instructions can be easily developed.