On Tue, 21 Apr 1998, Regulus Berdin wrote: > > From: T. Scott Dattalo > snip > > These routines will not work on the '5x parts because > > of the ADDLW instruction. (but maybe Reggie will fix that) > > I'll try: > > BCD_ADD: ;Y = Y + X > MOVLW 66 > ADDWF X,W > ADDWF Y,F > MOVLW -60 > SKPDC > MOVLW -66 > SKPC > ADDWF Y,F > RETLW 0 Close, but try X = 0x95 and Y = 0x95. The correct answer should be Y=0x80 and C=1. However, this routine will produce Y=0x2A and C=1. You still need that annoying normalization step. > BCD_MINUS: ;Y = Y - X > MOVF X,W > SUBWF Y,F > MOVLW -6 > SKPC > MOVLW -66 > SKPDC > ADDWF Y,F > RETLW 0 Try X=0x25, Y=0x16. This produces 0xf1 instead of 0x91. > > Sorry, there are no comments :) , it is difficult to explain. Yeah... tell that to Bill Scott