Will upload in chat
Cooper, CoryW6 LabCS-206 Lab 6: Assembly Language Programming Exercise 1 Write ARM code to implement the following C operation. int s = 0; for ( i = 0; i < 10; i++) { s = s + i*i;) please use the below as a reference template. need the solution with explanation of the code along with screenshots of the code in the keil software! no exceptions please. last week’s exercise 1 a word consists of the bytes b4, b3, b2, b1. write a function to re‐order (transpose) these bytes in the order b1, b3, b2, b4. as you can see, the outer bytes have been transposed and the inner two bytes are unchanged. we could shift the word 24 bits right to get 0,0,01,b4 we could shit the original word 24 bits left to get b1,0,0,0 we could mask the original word to 0,b3,b2,0. finally, by oring these three values, we get b1,b3,b2,b4. we can do masking with bic (bits set in the second operand clear corresponding source bits). the following demonstrates the simulator output. solution: given there are four bytes of data (b4,b3,b2,b1) we are to transpose these bytes as b1,b3,b2,b4. we want to shift the original word right by 24 bits – 0,0,0,b4 also want to shift the original word left by 24 – b1,0,0,0 the original word can be makes as 0,b3,b2,0 by performing the or operation on the above three steps, transposition of the original word is successful. code: area test, code, readwrite entry ldr r0. =0x12345678 mov r1, r0, lsl #24 bic r0, r0, #0xff bic r0, r0, #0xff000000 orr r0, r0, r1 orr r0, r0, r2 end 10;="" i++)="" {="" s="s" +="" i*i;)="" ="" please="" use="" the="" below="" as="" a="" reference="" template.="" need="" the="" solution="" with="" explanation="" of="" the="" code="" along="" with="" screenshots="" of="" the="" code="" in="" the="" keil="" software!="" no="" exceptions="" please.="" last="" week’s="" exercise="" 1="" ="" a="" word="" consists="" of="" the="" bytes="" b4,="" b3,="" b2,="" b1.="" write="" a="" function="" to="" re‐order="" (transpose)="" these="" bytes="" in="" the="" order="" b1, b3,="" b2,="" b4.="" as="" you="" can="" see,="" the="" outer="" bytes="" have="" been="" transposed="" and="" the="" inner="" two="" bytes="" are="" unchanged.="" we="" could="" shift="" the="" word="" 24="" bits="" right="" to="" get="" 0,0,01,b4="" we="" could="" shit="" the="" original="" word="" 24="" bits="" left="" to="" get="" b1,0,0,0="" we="" could="" mask="" the="" original="" word="" to="" 0,b3,b2,0.="" finally,="" by="" oring="" these="" three="" values,="" we="" get="" b1,b3,b2,b4.="" we="" can="" do="" masking="" with="" bic="" (bits="" set="" in="" the="" second="" operand="" clear="" corresponding="" source="" bits).="" the="" following="" demonstrates="" the="" simulator="" output.="" ="" solution:="" given="" there="" are="" four="" bytes="" of="" data="" (b4,b3,b2,b1)="" we="" are="" to="" transpose="" these="" bytes="" as="" b1,b3,b2,b4.="" we="" want="" to="" shift="" the="" original="" word="" right="" by="" 24="" bits="" –="" 0,0,0,b4="" also="" want="" to="" shift="" the="" original="" word="" left="" by="" 24="" –="" b1,0,0,0="" the="" original="" word="" can="" be="" makes="" as="" 0,b3,b2,0="" by="" performing="" the="" or="" operation="" on="" the="" above="" three="" steps,="" transposition="" of="" the="" original="" word="" is="" successful.="" code:="" area="" test,="" code,="" readwrite="" entry="" ldr="" r0.="0x12345678" mov="" r1,="" r0,="" lsl="" #24="" bic="" r0,="" r0,="" #0xff="" bic="" r0,="" r0,="" #0xff000000="" orr="" r0,="" r0,="" r1="" orr="" r0,="" r0,="" r2=""> 10; i++) { s = s + i*i;) please use the below as a reference template. need the solution with explanation of the code along with screenshots of the code in the keil software! no exceptions please. last week’s exercise 1 a word consists of the bytes b4, b3, b2, b1. write a function to re‐order (transpose) these bytes in the order b1, b3, b2, b4. as you can see, the outer bytes have been transposed and the inner two bytes are unchanged. we could shift the word 24 bits right to get 0,0,01,b4 we could shit the original word 24 bits left to get b1,0,0,0 we could mask the original word to 0,b3,b2,0. finally, by oring these three values, we get b1,b3,b2,b4. we can do masking with bic (bits set in the second operand clear corresponding source bits). the following demonstrates the simulator output. solution: given there are four bytes of data (b4,b3,b2,b1) we are to transpose these bytes as b1,b3,b2,b4. we want to shift the original word right by 24 bits – 0,0,0,b4 also want to shift the original word left by 24 – b1,0,0,0 the original word can be makes as 0,b3,b2,0 by performing the or operation on the above three steps, transposition of the original word is successful. code: area test, code, readwrite entry ldr r0. =0x12345678 mov r1, r0, lsl #24 bic r0, r0, #0xff bic r0, r0, #0xff000000 orr r0, r0, r1 orr r0, r0, r2 end>