Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 array
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 ENDStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started