google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: Programs of microprocessor

Thursday, December 26, 2013

Programs of microprocessor

Microprocessor cannot understand a program written in Assembly Language .
Instruction are divided into bit pattern of word in byte as op-code(operation code) and operation
Instruction format has three types
1.One byte-has op-code
2.Two byte- has op-code and address
3.Three byte -has code and address lower byte and address higher byte
opcode
1 byte
opcode
Data / address
2 byte
opcode
Data / address Lower byte
Data Address Higher byte
3 byte

Instructions set for 8085 are classified into five categories:
1.Data transfer group instructions
2.Arithmetic group of instrructions
3.Logical group
4.Branching group
5.Machine Level
A program known in Assembler is used to covert a Assembly language program to machine language.
I) Data transfer copy operation:-

1)Load a 8 bit number in a register
2)Copy from Register to Register
3)Copy between Register and Memory
4)Copy between Input/Output Port and Accumulator
5)Load a 16 bit number in a Register pair
6) Copy between Register pair and Stack memory

Example :-
1.Load a 8 bit number 4F in register B                     -MVI   B ,4FH
2.Copy from Register B to Register A                     -MOV  A,B
3.Load a 16 bit number 2050 in Register pair HL     -LXI     H,2050H
4.Copy from Register B to Memory Address 2050  - MOV   M,B
5.Copy between Input/Output Port and Accumulator- OUT   01H      IN   07H

2)Arithmetic operations and instructions

1.Add 8 bit number 32 H to Accumulator                   -ADI   32 H
2.Add contents of Register B to Accumulator            - ADD B
3.Subtract a 8 bit number 32 H from Accumulator      - SUI   32H
4.Subtract contents of Register C from Accumulator   -SUB  C
5.Increment the contents of Register D by 1                - INR   D
6.Decrement the contents of Register E by 1               -  DCR   E

3)Logical and Bit Manipulation operations and instructions

1.Logically AND Register H with Accumulator             -ANA  H
2.Logically OR Register L with Accumulator                 -ORA   L
3.Logically XOR Register B with Accumulator             - XRA   B
4.Compare contents of Register C with Accumulator  -CMP  C
5.Complement Accumulator                                            -CMA
6.Rotate Accumulator Left                                             -RAL

Program to add two 8 bit numbers and store result in register C

1.Get two numbers
a) Load first no. in register D                                        MVI   D , 2H
b)Load  second no. in register E                                    MVI   E , 3H

2.Add them
a) Copy register D to A                                                  MOV  A , D
b) Add register E to A                                                     ADD E

3. Store result
a)Copy A to register  C                                                  MOV  C , A

4.Stop
a)Stop processing                                                            HLT


Program to add 8 bit number result can be more than 8 bits i.e.with carry present

1.Get two numbers
a) Load first no. in register D                                        MVI   D , 2H
b)Load  second no. in register E                                    MVI   E , 3H

2.Add them
a) Copy register D to A                                                  MOV  A , D
b) Add register E to A                                                     ADD E

3. Store result
a)Copy A to register  C                                                  MOV  C , A

4.Carry
a)Use conditional Jump instructions                           JNC  END

5.Change
a)Clear register B                                                          MVI  B ,0H
b)Increment B                                                                INR  B

6.Stop
a)Stop processing                                                         HLT

No comments:

Post a Comment

हिम्मत

 अंधेरे में एक करोड का हीरा गिर गया था, उसे ढूंढने के लिए पाँच रूपएं की मोमबत्ती ने सहयोग किया। अभी बताओ वह पाँच रूपएं की एक छोटी सी मोमबत्त...