Question: Translate the pseudo-code shown below into ARM Assembly Language. The pseudo-code describes an algorithm that will sort the elements of an array do swapped =

Translate the pseudo-code shown below into ARM Assembly Language. The pseudo-code describes an algorithm that will sort the elements of an arrayTranslate the pseudo-code shown below into ARM Assembly Language. The pseudo-code describesan algorithm that will sort the elements of an array do swapped

do swapped = false; for (i = 1; i array[i]). tmpswap = array[i-1]; array[i 1] = array[i]; array[i] = tmpswap; swapped = true; } while (swapped); N EQU 10 AREA globals, DATA, READWRITE ; N word-size values SORTED SPACE N*4 ; N words (4 bytes each) AREA ENTRY RESET, CODE, READONLY ; copy the test data into RAM LDR R4, =SORTED LDR RS, UNSORT LDR R6, =0 whInit CMP R6, #N BHS eWhInit LDR R7, [R5, R6, LSL #2] STR R7, [R4, R6, LSL #2] ADD R6, R6, #1 B whInit eWhInit LDR R4, =SORTED LDR R5, =UNSORT ; your sort subroutine goes here UNSORT DCD 9,3,0,1,6,2,4,7,8,5 STOP B STOP END do swapped = false; for (i = 1; i array[i]). tmpswap = array[i-1]; array[i 1] = array[i]; array[i] = tmpswap; swapped = true; } while (swapped); N EQU 10 AREA globals, DATA, READWRITE ; N word-size values SORTED SPACE N*4 ; N words (4 bytes each) AREA ENTRY RESET, CODE, READONLY ; copy the test data into RAM LDR R4, =SORTED LDR RS, UNSORT LDR R6, =0 whInit CMP R6, #N BHS eWhInit LDR R7, [R5, R6, LSL #2] STR R7, [R4, R6, LSL #2] ADD R6, R6, #1 B whInit eWhInit LDR R4, =SORTED LDR R5, =UNSORT ; your sort subroutine goes here UNSORT DCD 9,3,0,1,6,2,4,7,8,5 STOP B STOP END

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!