Question: Re-write the C code below using ATMega32 assembly: unsigned char i, sum = 0; for( i=0; i <10; i++ ) { if( i < 5

Re-write the C code below using ATMega32 assembly:
unsigned char i,  sum = 0;
for( i=0; i<10; i++ ) {
           if( i < 5 )
                      sum  + =  2;
           else
                      sum  – =  1;
}

Step by Step Solution

3.50 Rating (147 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Assembly code main push r7 sub sp sp 20 add r7 sp 0 movs r3 0 str r3 r7 12 movs r3 1 str r3 r7 8 mov... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!