Dmitry A. Kiryashov wrote: >Actually Bob answer is too prefect to improve it ;) It=B4s so nice I=B4m putting it in my 16bit macro file. :) And... the carry out IS correct, right? I found a 16bit subtract constant in my archive which I append at end. I=B4m too tired to convince myself about the carry on that one for the= moment though. I tend to believe there is also a five cycle add constant solution. Five cycle subtract register from register seem impossible... not? Gotta go /Morgan >Bob Ammerman wrote: > >> Challenge >> >> If you don't care about the carry out, it's possible to perform a 16-bit= add in >> 5 cycles. Since Nikolai is away from his computer, Dmitry is quiet, John= is >> (where is John?) and Andy is on a plane, this oughta be an interesting >> challenge. >> >> Scott > > movf lo_a,W > addwf lo_b,F > rlf known_zero,W > addwf hi_a,W > addwf hi_b,F > >Bob Ammerman >RAm Systems > >> (contract development of high performance, high function, low-level >> software) > >-- >http://www.piclist.com hint: To leave the PICList >mailto:piclist-unsubscribe-request@mitvma.mit.edu ------------------------ Part of mail on PICLIST from Rich Leggitt = 2000-03-11 : Consider subtraction of 16-bit constant from memory: PIC =3D 5 cycles/70 bits (14 bit core): movlw low(const) subwf LO,f rlf ZERO,w sublw high(const)+1 subwf HI,f Regards /Morgan -- http://www.piclist.com hint: PICList Posts must start with ONE topic: "[PIC]:","[SX]:","[AVR]:" =uP ONLY! "[EE]:","[OT]:" =Other "[BUY]:","[AD]:" =Ads