answersLogoWhite

0


Best Answer

I have a code for 16 bit subtraction..

just replace ax by al,bx by bl etc...

.code

main proc

mov ax,@data

mov ds,ax

lea dx,msg ;printing msg

mov ah,09h

int 21h

mov ax,x ;ax=x(any number)

mov bx,y ;bx=y( " ")

cmp ax,0 ;jump to l3 if ax is negtive

jb l3

cmp bx,0 ;jump to l6 if bx is negative

jb l6

cmp ax,bx ;if ax<bx,then jump to l1

jl l1

sub ax,bx ;else normal sub

mov diff,ax ;diff=result is stored

jmp l2

l1: ;iff (+)ax<(+)bx

neg bx ;bx=-bx

clc

add ax,bx

neg ax ;-ans=ans

mov diff,ax

mov dx,2dh ;print '-'

mov ah,02h

int 21h

jmp l2

l3: ;iff (-)ax

neg ax ;-ax=ax

cmp bx,0 ;jump to l4 if bx is negative

jb l4

clc

add ax,bx ;ax=(+)ax+(+)bx

mov ax,diff

mov dx,2dh ;print '-'

mov ah,02h

int 21h

jmp l2

l4: ;if (-)ax & (-)bx

neg bx ;-bx=bx

cmp ax,bx ;if ax>bx then jump to l5

jg l5

sub ax,bx ;else ax-bx

mov diff,ax

mov dx,2dh ;print '-'

mov ah,02h

int 21h

jmp l3

l5: ;if(-)ax>(-)bx

xchg ax,bx ;exchange ax and bx

sub ax,bx ;ax-bx

mov diff,ax ;ans is positive

jmp l2

l6: ;iff (-)bx

neg bx ;-bx=bx

add ax,bx ;ax-(-)bx

mov diff,ax ;ans will be positive

mov ah,4ch

int 21h

main endp

User Avatar

Wiki User

โˆ™ 2012-09-26 14:46:42
This answer is:
User Avatar
Study guides

Algebra

20 cards

A polynomial of degree zero is a constant term

The grouping method of factoring can still be used when only some of the terms share a common factor A True B False

The sum or difference of p and q is the of the x-term in the trinomial

A number a power of a variable or a product of the two is a monomial while a polynomial is the of monomials

โžก๏ธ
See all cards
3.78
โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…
1430 Reviews

Add your answer:

Earn +20 pts
Q: Program to subtract two 8 bit numbers using 8086 microprocessor?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you add and subtract 16 bit numbers using 8051 microprocessor?

The 8051 is a microcontroller, not a microprocessor. To add or subtract, use the ADD or SUBB opcodes.


Program to count the number of numbers in an array using 8085 microprocessor?

A program which is used to count the number of numbers in an array using a 8085 microprocessor is known as a assembly language program.


Can you Write a program to subtract two complex numbers using class in c?

I could, but it is your homework, innit?


What is subroutine in 8085?

in 8085 microprocessor a subroutine is a separate program written aside from main program ,this program is basically the program which requires to be executed several times in the main program. the microprocessor can call subroutine any time using CALL instruction . after the subroutine is executed the subbroutine hands over the program to main program using RET instruction.


8086 assembly program to sort a list of integers?

assembly language program for sorting an array using 8086 microprocessor.


Assembly language program for string concatenation using 8086 microprocessor?

write program to concatenating two sting in 8086 assembly language


Subtract these numbers using significant figures 25.6 - 0.112?

25.488000000000003


How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers


How do you write Ascending order program using 8086 microprocessor?

One many find this answer on YouTube. One also may find out how to write ascending order programs using an 8086 microprocessor by looking at the owners manual.


Program to additon of two 8 bit numbers with carry using 8086 microprocessor?

abe byahanchod delete nahi kar raha hu, answer kiske liye bacha ke rakha tha


Greatest of 3 numbers using 8086 microprocessor program?

lxi h,0091h lda 0090hmvi b,03hcmp mjm 0015hinx hdcr bjnz 0008hsta 00a0hhltmov a,minx hjmp 0008h


How do write sorting of numbers using microprocessor?

There are several methods available to sort numbers. A simple way to program sorting is the so-called "bubble-sort". This is inefficient for larger lists of numbers; in which case it is more convenient to use one of the faster algorithms, for example, "quick-sort".

People also asked