Showing posts with label Addition. Show all posts
Showing posts with label Addition. Show all posts

Tuesday, January 25, 2022

8086 Program to add two 8 bit Hexadecimal numbers microprocessor

Hello guys welcome to the blog !!

I have come up with a new code for you today.

We will  see a code in order to add two 8 bit hexadecimal numbers using microprocessor 8086 . The code is attached to below and also do check out other topics like Android , C programming , etc on your blog☺ !!


8086 program to add two 8-bit hexadecimal numbers source code :-

data segment

num1 db 50h

num2 db 30h

sum db ?

data ends

code segment

start :

assume cs:code, ds:data

mov ax,data

mov ds,ax

mov al,num1

mov bl,num2

add al,bl

mov ah,4ch

int21h

code ends

end start

Block transfer OVERLAPPING 
Block transfer(Simple Program)
Block Transfer(REVERSE ORDER)
Addition of 8-bit  BCD8086 program
addition of 16-bit bcd program
Division of 32/16 bit program
Subtraction of 8-bit program
Subtraction of 8-bit BCD program
Subtraction of 16-bit program
Subtraction of 16-bit BCD program
String reverse 8086 program
block transfer using string
string concatenation
string length calculation
Block Transfer 
Block reverse
Hex to ASCII program 8086
BCD to ASCII program 8086
ASCII to BCD program 8086

 

Programs:-

For many other Language Programs of microprocessor 8086, C++ , Data Structures , etc and MSBTE diploma,BCA, MCA and engineering related concepts visit our  BLOG

Monday, October 4, 2021

8086 program to add two 8 bit BCD numbers

8-bit BCD ADDITION 8086 program:-

data segment

num1 db 20h

num2 db 30h

sum db ?

data ends

code segment

start :

assume cs:code, ds:data

mov ax,data

mov ds,ax

mov al,num1

mov bl,num2

add al,bl

daa

mov ah,4ch

int21h

code ends

end start

Block transfer OVERLAPPING 
Block transfer(Simple Program)
Block Transfer(REVERSE ORDER)
Addition of 8-bit  BCD8086 program
addition of 16-bit bcd program
Division of 32/16 bit program
Subtraction of 8-bit program
Subtraction of 8-bit BCD program
Subtraction of 16-bit program
Subtraction of 16-bit BCD program
String reverse 8086 program
block transfer using string
string concatenation
string length calculation
Block Transfer 
Block reverse
Hex to ASCII program 8086
BCD to ASCII program 8086
ASCII to BCD program 8086
BCD to HEX
HEX to BCD

 

 

Programs:-

For many other Language Programs of microprocessor 8086, C++ , Data Structures , etc and MSBTE diploma,BCA,MCA and engineering related concepts visit our  BLOG

Friday, October 23, 2020

8086 Assembly Program to Add two ASCII numbers


data segment

n1 db 1dup(?)

n2 db 1dup(?)

ascii1 db 1dup(?)

ascii2 db 1dup(?)

data ends

code segment

assume cs:code, ds:data

mov dx,data

mov ds,dx

mov bl,n2

mov al,n1

add al,bl

aaa

jnc nxt

mov ascii2,31h

nxt: add al,30h

mov ascii1, al

mov ah,4ch

int 21h

code ends

end start

string compare
sum of SERIES BCD numbers
Block reverse

Programs:-
For many other Assembly Language  Programs related to microprocessor 8086 , C++ , C, DataStructures visit our  BLOG 

There are programs of largest ,smallest ,division ,multiplication,odd/even,block operation ,string operations,BCD ,etc

Wednesday, June 3, 2020

Assembly Program 8086 to add two 8-bit BCD number and to add two 16-bit BCD number

Hey !! Let's see program to multiply two 8 bit numbers and another program to add two 16 bit BCD number. First let's take a look at the theory.

Let's go!!


In assembly language 8086 we use mnemonics in order to perform arithmetic operations like ADD/ADC in addition.
So, Let's dive deep into what ADD and ADC is ....Scroll Down for Program↓...

ADD:- It adds number from source to destination without carry. Source can be memory location or register or a number but destination should be register or a memory location(not immediate number). Remember that source and destination should be of same type and both shouldn't be memory locations.

Syntax: ADD <destination> <source>
Operation: destination← destination + source

ADC:- It adds number from source to destination with carry i.e , adds carry flag into result of addition. Source can be memory location or register or a number but destination should be register or a memory location(not immediate number). Remember that source and destination should be of same type and both shouldn't be memory locations.

Syntax: ADC <destination> <source>
Operation: destination← destination + source + carry

DAA:- Usually used after ADD/ADC because DAA works on AL registers. This instruction is used to convert result of addition of 2packed numbers into 1-packed BCD number. in simple language, ADD/ADC adds BCD number in hexadecimal format and then DAA instruction converts this hexadecimal result into BCD result.

Syntax: DAA

Which flags get affected?
Ans- OF , CF, PF , AF, SF , ZF .



Below are 2 programs : Two 8-bit BCD addition and Two 16-bit BCD addition.



Sum of two 8-Bit BCD numbers using ALP 8086 :-
data segment
no1 db 02h
no2 db 03h
ans db ?
data ends
code segment
start : assume  cs :code,  ds :data
mov ax ,data
mov ds , ax
mov al , no1
mov bl ,no2
ADD al, b1
DAA
mov ans ,al
mov ah ,4ch
int 21h
code ends
end start


Sum of two 16-Bit BCD numbers using ALP 8086 :-
data segment
no1 dw 21h
no2 dw 31h
ans dw ?
data ends
code segment
start : assume  cs :code,  ds :data
mov ax ,data
mov ds , ax
mov ax , no1
mov bx , no2
ADD ax , bx
DAA
mov ans ,ax
mov ah ,4ch
int 21h
code ends
end start


Programs:-

For many other Assembly Language  Programs related to microprocessor 8086 , data structure, etc Subjects  related to MSBTE,Computer engineering, IT field visit our  BLOG 

There are programs of largest ,smallest ,division ,multiplication,odd/even,block operation ,string operations,BCD ,etc

Monday, May 20, 2019

Assembly 8086 program for addition of two 16-bit numbers

In assembly language 8086 we use mnemonics in order to perform arithmetic operations like ADD/ADC in addition.
So, Let's dive deep into what ADD and ADC is ...

ADD:- It adds number from source to destination without carry. Source can be memory location or register or a number but destination should be register or a memory location(not immediate number). Remember that source and destination should be of same type and both shouldn't be memory locations.

Syntax: ADD <destination> <source>
Operation: destination← destination + source

ADC:- It adds number from source to destination with carry i.e , adds carry flag into result of addition. Source can be memory location or register or a number but destination should be register or a memory location(not immediate number). Remember that source and destination should be of same type and both shouldn't be memory locations.

Syntax: ADC <destination> <source>
Operation: destination← destination + source + carry

Which flags get affected?
Ans- OF , CF, PF , AF, SF , ZF .

data segment
no1 dw 21h
no2 dw 31h
ans dw ?
data ends
code segment
start : assume  cs :code,  ds :data
mov ax ,data
mov ds , ax
mov ax , no1
mov bx , no2
ADD ax , bx
mov ans ,ax
mov ah ,4ch
int 21h
code ends
end start

Programs:-


For many other Assembly Language  Programs related to microprocessor 8086 visit our  BLOG 

There are programs of largest ,smallest ,division ,multiplication,odd/even,block operation ,string operations ,etc

Monday, May 13, 2019

Assembly Program 8086 - Addition of two 8-bit numbers

In assembly language 8086 we use mnemonics in order to perform arithmetic operations like ADD/ADC in addition.
So, Let's dive deep into ADD and ADC ...Scroll Down for Program Code

ADD:- It adds number from source to destination without carry. Source can be memory location or register or a number but destination should be register or a memory location(not immediate number). Remember that source and destination should be of same type and both shouldn't be memory locations.

Syntax: ADD <destination> <source>
Operation: destination← destination + source

ADC:- It adds number from source to destination with carry i.e , adds carry flag into result of addition. Source can be memory location or register or a number but destination should be register or a memory location(not immediate number). Remember that source and destination should be of same type and both shouldn't be memory locations.

Syntax: ADC <destination> <source>
Operation: destination← destination + source + carry

Which flags get affected?
Ans- OF , CF, PF , AF, SF , ZF .


data segment
no1 db 02h
no2 db 03h
ans db ?
data ends
code segment
start : assume  cs :code,  ds :data
mov ax ,data
mov ds , ax
mov al , no1
mov bl ,no2
ADD al, b1
mov ans ,al
mov ah ,4ch
int 21h
code ends
end start