Good day to all. I'm working on a short routine where I add a 24 bit constant to a 24 bit variable. My previous method has been to load the constant into 3 bytes of RAM, then use the standard multi-byte addition routines to add the variable to the RAM value. Takes 6 + 10 instruction cycles; or, if I'm feeling energetic: 5 + 10 instruction cycles. Really energetic: 14 instruction cycles. I've been doing it that way for years - no problems. But it bugs me. I should be able to figure out a generic method for adding a multi-byte constant to a multi-byte variable without having the intermediate step of loading the 3 literals that form the 24-bit constant into RAM. An example: OFFSET_HI EQU 0x7D OFFSET_MED EQU 0x35 OFFSET_LOW EQU 0xDE cblock TIMER3_HI ;input TIMER3_MED TIMER3_LOW TIMER4_HI ;output TIMER4_MED TIMER4_LOW endc ;vaguely energetic version movlw OFFSET_LOW addwf TIMER3_LOW,W movwf TIMER4_LOW movlw OFFSET_MED ;preload literal movwf TIMER4_MED movfw TIMER3_MED skpnc incfsz TIMER3_MED,W addwf TIMER4_MED,F movlw OFFSET_HI ;preload literal movwf TIMER4_HI movfw TIMER3_HI skpnc incfsz TIMER3_HI,W addwf TIMER4_HI,F Of course, I could shave 1 instruction cycle from the high-byte addition operation 'cuz I don't need to worry about propagating the carry: movlw OFFSET_HI skpnc movlw (OFFSET_HI + 1) addwf TIMER3_HI,W movwf TIMER4_HI But that's too much thinking. So: I'd like to see if anyone had developed a generic multi-byte (24, 32, 40, 48 bit) constant plus variable addition or subtraction routine. Sort of like the standard multi-byte addition and subtraction routines we all use, but optimized for literal operations. dwayne -- Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax www.trinity-electronics.com Custom Electronics Design and Manufacturing -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist