Truncated match.
PICList
Thread
'add32 / sub32'
1998\04\18@122723
by
Michael Hagberg
ok, let's see if i learned my lesson well. will the sub32 routine work
correctly? i also modified the add routine so the answer for both functions
is returned in the 'A'.
michael
;Given A3,A2,A1,A0
; B3,B2,B1,B0
;Returns A = A + B
ADD32 movf B0,w ;Low byte
addwf A0,f
movf B1,w ;Middle low byte
btfsc STATUS,C
incfsz B1,w
addwf A1,f
movf B2,w ;Middle high byte
btfsc STATUS,C
incfsz B2,w
addwf A2,f
movf B3,w ;High byte
btfsc STATUS,C
incfsz B3,w
addwf A3,f
return
;Given A3,A2,A1,A0
; B3,B2,B1,B0
;Returns A = A - B
SUB32 movf B0,w ;Low byte
subwf A0,f
movf B1,w ;Middle low byte
btfsc STATUS,C
incfsz B1,w
subwf A1,f
movf B2,w ;Middle high byte
btfsc STATUS,C
incfsz B2,w
subwf A2,f
movf B3,w ;High byte
btfsc STATUS,C
incfsz B3,w
subwf A3,f
return
end
1998\04\19@235425
by
Andrew Warren
Michael Hagberg <spam_OUTPICLISTTakeThisOuT
MITVMA.MIT.EDU> wrote:
{Quote hidden}> ok, let's see if i learned my lesson well. will the sub32 routine
> work correctly?
> ....
> ;Returns A = A - B
>
> SUB32 movf B0,w ;Low byte
> subwf A0,f
>
> movf B1,w ;Middle low byte
> btfsc STATUS,C
> incfsz B1,w
> subwf A1,f
>
> movf B2,w ;Middle high byte
> btfsc STATUS,C
> incfsz B2,w
> subwf A2,f
>
> movf B3,w ;High byte
> btfsc STATUS,C
> incfsz B3,w
> subwf A3,f
> return
Michael:
No, it won't work... You need to replace all those BTFSC's with
BTFSS's.
-Andy
=== Andrew Warren - .....fastfwdKILLspam
@spam@ix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- Today
- New search...