Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
104 views

Addition of Two 8 Bit Numbers

This document contains code examples for adding two 8-bit numbers using registers and memory locations in an assembly language. The first example loads the numbers into registers B and C, adds them, and stores the output in memory. The second loads the numbers from memory into the accumulator and register B, adds them, and stores the output in memory. The third is similar but also stores the carry bit in a separate memory location.

Uploaded by

Debasis Saha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views

Addition of Two 8 Bit Numbers

This document contains code examples for adding two 8-bit numbers using registers and memory locations in an assembly language. The first example loads the numbers into registers B and C, adds them, and stores the output in memory. The second loads the numbers from memory into the accumulator and register B, adds them, and stores the output in memory. The third is similar but also stores the carry bit in a separate memory location.

Uploaded by

Debasis Saha
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Addition of two 8 bit numbers.

MVI B, 06
//Load Register B with the Hex value 06
MOV A, B
//Move the value in B to the Accumulator or register A
MVI C, 07
//Load the Register C with the second number 07
ADD C
//Add the content of the Accumulator to the Register C
STA 8200
//Store the output at a memory location e.g. 8200
HLT
//Stop the program execution
Addition of two 8 bit numbers stored in memory
Code:

LDA 8500
//Load the accumulator with the address of memory viz 8500
MOV B, A
Move the accumulator value to the register B
LDA 8501
//Load the accumulator with the address of memory viz 8501
ADD B
//Add the content of the Accumulator to the Register B
STA 8502
//Store the output at a memory location e.g. 8502
HLT
//Stop the program execution
Addition of two 8 bit numbers stored in memory and storing the carry
Code:

LDA 8500
//Load the accumulator with the address of memory viz 8500
MOV B, A
Move the accumulator value to the register B
LDA 8501
//Load the accumulator with the address of memory viz 8501
ADD B
//Add the content of the Accumulator to the Register B
STA 8502
//Store the output at a memory location e.g. 8502

MVI A, 00
//clear the accumulator with 00
ADC A
//Add with carry the content of the accumulator
STA 8503

You might also like