Simple Programs for 8085 Microprocessor

8085 program to store a 8 bit data in memory

MVI A, 24H
STA 1423H
HLT
  1. MVI A, 24H – store 24H in the accumulator.
  2. STA 1423H – copy the contents of accumulator to memory loaction 1423H.
  3. HLT – stop the execution.

8085 program to add two 8 bit data numbers

LXI H, 1500H
MOV A, M 
INX H
ADD M
INX H
MOV M, A
HLT
  1. LXI H, 1500H – store the address of first number (1500 H) in HL register pair.
  2. MOV A, M – copy the contents of memory loaction to accumulator.
  3. INX H – increments the contents of HL register pair. HL now points to 1501H.
  4. ADD M – Add first operator in the accumulator with the second operator in memory location 1501H.
  5. INX H – HL now points to 1502H.
  6. MOV M, A – store result in accumulator at location 1502H.
  7. HLT – stop the execution.

Example

1st operand (1500) - 1A
2nd operand (1501) - B7
Result (1502) - 1A + B7 = D1

8085 program to subtract two 8 bit data numbers

LXI H, 1500H
MOV A, M 
INX H 
SUB M
INX H
MOV M, A
HLT

8085 program to find 1s compliment of a number

LDA 1500H
CMA
STA 1501H
HLT

8085 program to find 2s compliment of a number

LDA 1500 H
CMA
ADI, 01 H
STA 1501 H
HLT
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments