piclist 1998\03\03\115208a >
Thread: Dumb question
www.piclist.com/techref/index.htm?key=dumb+question
face
flavicon
face BY : Andrew Warren email (remove spam text)



Peter Baines <spamPICLISTspamBeGonespamEraseMEMITVMA.MIT.EDU> wrote:

> does anybody have some code to subtract one 16 bit number from
> another NOT using 2s compliment so that it returns an ABS result
> with a flag (AKA register) to say if it is negative.

Peter:

This routine computes DEST = DEST - SOURCE.  After it executes, the
Carry flag is valid (i.e., Carry = 0 if the result is negative,
Carry = 1 if the result is zero or positive).  Note that the Zero
flag is NOT necessarily valid after execution.

   MOVF   SOURCELO,W
   SUBWF  DESTLO
   MOVF   SOURCEHI,W
   SKPC
   INCFSZ SOURCEHI,W
   SUBWF  DESTHI

-Andy

=== Andrew Warren - spam_OUTfastfwdRemoveMEspamKILLspamix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499
<199803031601.KAA14827@dfw-ix8.ix.netcom.com> 7BIT

In reply to: <11282571820572@aspen-internet.net>
See also: www.piclist.com/techref/index.htm?key=dumb+question

Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Dumb question

month overview.

new search...