Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Substract 16bits nos with 8085

Status
Not open for further replies.

papier

IS-IT--Management
Oct 25, 2004
1
FR
I am a beginner in uP and I can't manage to substract 2 16bits numbers by writing a programm in assembly.
I found a solution but not using the "sub" command and I think there should exist a more simple one.
Can someone help?
 
Greetinx!

What do u need? Please correct task. Happy programming!))
 
You need to use an instruction common in most uP's called "subtract with borrow" or "subtract with carry." It's usually 'SBB' or 'SBC'. On the Intel 8086, you can do 16-bit math using 8-bit registers via:

mov al,byte ptr subtrahend
sub al,byte ptr minuend
mov byte ptr result,al
mov al,byte ptr subtrahend[1]
sbb al,byte ptr minuend[1]
mov byte ptr result[1],al

presumably the 8085 code isn't too far off... "Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top