myke predko wrote: > This is an eight bit subtract of a 24 bit value, but you are not > bringing the carry to the most significant byte ("t2"). and Scott Dattalo replied: > If you wanna do this why not do it like: > .... > > movlw d'1000000'&0xff > subwf t0,f > movlw 1 > skpnc > subwf t1,f > skpnc > subwf t2,f Scott: After reading the recent "commenting practices" thread that was sparked by Myke Predko's use, with no explanatory comments, of the FSR as a generic temporary variable (and worse, if you recall, he used the temporary variable in ALMOST the same way that the FSR is usually used), I think I'd rewrite your code like this: LIST P=16C54,R=DEC MOVLW 1<<6 ;No need for "&0xff", since 1000000 = 1E6. SUBWF T0,TMR0 ;TMR0 has just overflowed. MOVLW F ;W register = F (just F, not 0x0F). BTFSC STATUS,W ;Skip if C (just C, not 0x0C) = W. SUBWF T1,W+1 ;(W register = F still, but W = F-1). BTFSC STATUS,INDF ;We're using INDF and FSR together SUBWF T2,(FSR-3) ; here, but not in the usual way. This code assembles identically to yours... But since it's fully commented, it's clearly better. -Andy === Andrew Warren --- aiw@cypress.com === IPD Systems Engineering, CYSD === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads