full adder/subtracter with carry

JimEli:
add:

unsigned char low, high;

void setup() {                
}

void loop() {
 asm(
   "lds r24, (low)  \n\t"  //low byte
   "lds r25, (high) \n\t"  //high byte
   "ldi r23, 1      \n\t"  
   "add r24, r23    \n\t"  //increment low byte by 1
   "adc r25, 0x00   \n\t"  //add carry to high byte
   "sts (low), r24  \n\t"  //save results
   "sts (high), r25 \n\t"
   ::: "r23","r24", "r25"
 );
}

The compiler can handle adding one to an integer. You don't need to drop into assembler for that. :wink: