Experiment-2: Write a program to perform :

  1. Addition of two 8 bit numbers without carry.

  2. Addition of two 8 bit numbers with carry

Objective:

  • To understand the assembly instructions
  • To design assembly program
  • To analyze the given program

Flow Chart:

Two WAYS OF WRITING PROGRAM IN GNU 8085 SUMULATOR
Using direct Addressing Using Register Indirect

 

Program to add two 8-bit numbers(Two approaches)

1st Method 2nd Method
Address OP-CODE Mnemonic Comments Address OP-CODE Mnemonic Comments
4000 54H ;1ST OPERAND 4000 X
4001 9FH ;2ND OPERAND 4001 Y
4002 ;RESULT 4002 Z
4008 3A,00,40 LDA 4000 4008 21 00 40 LXI H, X
400B 47 MOV B, A 400B 7E MOV A, M
400C 3A,01,40 LDA 4001 400C 23 INX H
400F 80 ADD B 400D 70 MOV B,M
4010 32,02,40 STA 4002 400E 88 ADD B
4013 76 HLT 400F 23 INX H
4010 77 MOV M,A
4011 76 HLT

 

 

  1. Addition of two 8 bit numbers with carry

Two 16-bit numbers are stored at memory location 4000 and 4002

 

Address OP-CODE /DATA Label Mnemonic Comments
4000 86H ;1ST OPERAND
4001 78H
4002 98H ;2ND OPERAND
4003 9FH
4004 ;RESULT
4005 ;RESULT
4006 ; CARRY STORAGE
START: NOP
4008 3A, 00,40 LDA 4000H
400B 47 MOV B,A
400C 3A, 02,40 LDA 4002H
400F 80 ADDB
4010 32, 04,40 STA 4004H
4013 3A,01,40 LDA 4001H
47 MOV B,A
3A,03,40 LDA 4003H
88 ADC B
32,05,40 STA 4005H
3E, 00 MVI A, 00
17 RAL
32,06,40 STA 4006H
76 HLT

VIVA QUESTIONS: 

Que-1: Name the direct addressing instructions used in above programs.

Ans:

a. LDA

b. STA

c. LHLD

d. SHLD

Que-2: Name the Immediate mode instruction used in the above program.

Ans:

a. LXI

Que-3: Name indirect register addressing instructions used in above program.

Ans:

a. MOV A, M

b. MOV B, M

c.  MOV M, A

Que-4 Name register addressing mode instructions in above program.

Ans:

a. ADD B

b. ADC B

c. MOV B, A

d. INX H

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!