addition 8 bit

2
An Assembly Language Program to perform addition of two 8-bit numbers using 8085? Algorithm 1) Start the program by loading the first data into Accumulator. 2) Copy the data to a register. 3) Get the second data and load into Accumulator. 4) Add the two register contents. 5) Check for carry. 6) Store the value of sum and carry in memory location. 7) Terminate the program. Program MEMORY LABEL MNEMONIC OPCODE COMMENT 4200 MVI C,00 OE Initialize C register to 00 4201 00 4202 LDA 4500 3A Load value to accumulator 4203 00 4204 45 4205 MOV B, A 47 Copy the content of Accumulator to B register. 4206 LDA 4501 3A Load the value to Accumulator 4207 01 4208 45 4209 ADD B 80 Add the value of register B to A 420A JNC LOOP D2 Jump on no carry 420B 0E 420C 42 420D INR C OC Increment value register C 420E LOOP STA 4100 32 Store the value of Accumulator 420F 00 4210 45 4211 MOV A,C 79 Copy the content of register C to

Upload: varun89goel

Post on 12-Jan-2016

3 views

Category:

Documents


0 download

DESCRIPTION

Program

TRANSCRIPT

Page 1: Addition 8 Bit

An Assembly Language Program to perform addition of two 8-bit numbers using 8085?

Algorithm

1)      Start the program by loading the first data into Accumulator.2)      Copy the data to a register.3)      Get the second data and load into Accumulator.4)      Add the two register contents.5)      Check for carry.6)      Store the value of sum and carry in memory location.7)      Terminate the program.

Program

MEMORY LABEL MNEMONIC OPCODE COMMENT

4200 MVI C,00 OE Initialize C register to 004201 004202 LDA 4500 3A

Load value to accumulator4203 004204 454205 MOV B, A 47 Copy the content of

Accumulator to B register.4206 LDA 4501 3A

Load the value to Accumulator4207 014208 454209 ADD B 80 Add the value of register B to

A420A JNC LOOP D2

Jump on no carry420B 0E420C 42420D INR C OC Increment value register C420E LOOP STA 4100 32

Store the value of Accumulator420F 004210 454211 MOV A,C 79 Copy the content of register C

to Accumulator4212 STA 4101 32

Store the value of Accumulator (CARRY)

4213 014214 414215 HLT 76 Halt the program

Observation

Input at           4500    :           32H

4501    :           FFH

Page 2: Addition 8 Bit

Output at         4100    :           31H

                        4101    :           01H