Showing posts with label Subtract. Show all posts
Showing posts with label Subtract. Show all posts

Saturday, December 18, 2021

8086 Program to subtract two 16-bit BCD numbers MICROPROCESSOR 8086

 

Assembly BCD program - subtract 2  16-bit bcd numbers


data segment

num1 dw 2800h

num2 dw 4900h

sum dw ?

data ends

code segment

start :

assume cs:code, ds:data

mov ax,data

mov ds,ax

mov ax,num1

mov bx,num2

add ax,bx

das

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


Programs:-

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

Monday, September 20, 2021

Saturday, November 28, 2020

8086 Assembly Language Program to Subtract two 8-bit BCD number in 8086

Hey !! 

Today we will see program to subtract two 8-bit bcd number using assembly language of microprocessor 8086.

Let's go!!
 

data segment

num1 db 90h

num2 db 10h

data ends

code segment

start :

assume cs:code, ds:data

mov ax,data

mov ds,ax

mov al,num1

mov bl,num2

sub al,bl

das

mov ah,4ch

int21h

code ends

end start

 

Programs:-

For many other Language Programs of microprocessor 8086, C++ , C , Data Structures ,etc ...subjects related to MSBTE, Computer engineering, IT field  visit our  BLOG 



Wednesday, June 3, 2020

8086 Assembly Program for subtraction of two 16-bit numbers

For many other Language  Programs related to microprocessor 8086, data structures  and C++ visit our  BLOG 

Program to SUBTRACT two 16-bit numbers:-

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
SUB ax , bx
mov ans ,ax
mov ah ,4ch
int 21h
code ends
end start

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

SUB:- It subtracts the data in source from data in destination and then stores result in destination. 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: SUB <destination> <source>
Operation: destination← destination - source

SBB:- It is used to subtract source-operand and borrow. from destination-operand and then the result is stored in destination. 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: SBB <destination> <source>
Operation: destination← destination - source - carry flag
Which flags get affected?
Ans- OF , CF, PF , AF, SF , ZF .


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 27, 2019

8086 Assembly Program to SUBTRACT two 16-bit BCD numbers

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

SUB:- It subtracts the data in source from data in destination and then stores result in destination. 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: SUB <destination> <source>
Operation: destination← destination - source

SBB:- It is used to subtract source-operand and borrow. from destination-operand and then the result is stored in destination. 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: SBB <destination> <source>
Operation: destination← destination - source - carry flag

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

Syntax: DAS

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
SUB ax , bx
DAS
mov ans ,ax
mov ah ,4ch
int 21h
code ends
end start

Addition of 8-bit  BCD8086 program
Subtraction of 16-bit BCD program

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,BCD ,etc

8086 Assembly program to SUBTRACT two 8-bit BCD numbers

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

SUB:- It subtracts the data in source from data in destination and then stores result in destination. 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: SUB <destination> <source>
Operation: destination← destination - source

SBB:- It is used to subtract source-operand and borrow. from destination-operand and then the result is stored in destination. 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: SBB <destination> <source>
Operation: destination← destination - source - carry flag

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

Syntax: DAS

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
SUB al, b1
DAS
mov ans ,al
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,BCD ,etc

Wednesday, May 15, 2019

Assembly Language Program to SUBTRACT two 8-bit numbers 8086

For many other Assembly Language  Programs related to microprocessor 8086, data structures  and C++ visit our  BLOG 

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
SUB al, b1
mov ans ,al
mov ah ,4ch
int 21h
code ends
end start

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

SUB:- It subtracts the data in source from data in destination and then stores result in destination. 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: SUB <destination> <source>
Operation: destination← destination - source

SBB:- It is used to subtract source-operand and borrow. from destination-operand and then the result is stored in destination. 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: SBB <destination> <source>
Operation: destination← destination - source - carry flag

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

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