Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Describe the function of each block of code below bounded by a matching @ and Your code must reference variable names, not register names. Use
Describe the function of each block of code below bounded by a matching @ and Your code must reference variable names, not register names. Use C style statements if possible. Your comment should be a single C statement or expression for the entire collection of instructions within the block. ENTER ALL ANSWERS AT THE BOTTOM OF THE PAGE Each answer is worth 1 mark unless stated otherwise. .file "A2C.c" .global timea .data .align 2 .type timea, %object .size timea, 4 timea: .word 29 .comm timeb, 4,4 .comm timet,4,4 .comm adj,4,4 .section rodata .align 2 .LCO: ascii "timeb is %d more than timea\012\000" .align 2 .LC1: .ascii "timet = %d\012\000" .text .align 2 .global main .type main, %function main: @args = 0, pretend = 0, frame = 0 @frame needed = 1, uses_anonymous_args = 0 stmfd sp!, {fp, Ir} add fp, sp, #4 Idr r3, .L5 movr2, #32 strr2, [r3, #O] @ Lanswer #1) Idr r3, .L5+4. movr2, #0 strr2, [r3, #0] @ answer #2) Idrr3, .L5+8 Idr r3, [r3, #O] cmp r3, #0 ble .L2 @ branch if answer #3) b .L3 .L4: Idr r3, .L5 Idr r3, [r3, #O] sub r2, r3, #1 Idr r3, .L5 strr2, [r3, #0] @ answer #4_) Idr r3, .L5+4. Idrr3, [r3, #0] add r2, r3, #1 Idrr3, .L5+4 strr2, [r3, #0] @ answer #5) .L3: Idr r3, .L5 Idrr2, [r3, #0] Idr r3, .L5+8 Idr r3, [r3, #0] cmp r2, r3 bgt L4 @ while_answer #6) Idrr2, .L5+12 Idr r3, .L5+4 Idrr3, [r3, #0] mov ro, r2 mov r1, r3 bl printf .L2: Idr r3, .L5 Idr r2, [r3, #0] Idr r3, .L5+4 Idr r3, [r3, #O] rsbr2, r3, r2 @reverse subtraction r2 = r2 - r3 Idr r3, .L5+8 Idr r3, [r3, #0] add r2, r2, r3 Idrr3, .L5+16 strr2, [r3, #O]. @ answer #7_) (4 marks) Idrr2, .L5+20 Idrr3, .L5+16 Idrr3, [r3, #0] mov ro, r2 mov r1. r3 bl printf Idmfd sp!, {fp, pc .L6: .align 2 .L5: .word timeb word adj .word timea .word .LCO word timet word .LC1 Answer #1 AJ Answer #2 AJ Answer #3 Answer #4 AI Answer #5 Answer #6 A/ Answer #7 A/ Describe the function of each block of code below bounded by a matching @ and Your code must reference variable names, not register names. Use C style statements if possible. Your comment should be a single C statement or expression for the entire collection of instructions within the block. ENTER ALL ANSWERS AT THE BOTTOM OF THE PAGE Each answer is worth 1 mark unless stated otherwise. .file "A2C.c" .global timea .data .align 2 .type timea, %object .size timea, 4 timea: .word 29 .comm timeb, 4,4 .comm timet,4,4 .comm adj,4,4 .section rodata .align 2 .LCO: ascii "timeb is %d more than timea\012\000" .align 2 .LC1: .ascii "timet = %d\012\000" .text .align 2 .global main .type main, %function main: @args = 0, pretend = 0, frame = 0 @frame needed = 1, uses_anonymous_args = 0 stmfd sp!, {fp, Ir} add fp, sp, #4 Idr r3, .L5 movr2, #32 strr2, [r3, #O] @ Lanswer #1) Idr r3, .L5+4. movr2, #0 strr2, [r3, #0] @ answer #2) Idrr3, .L5+8 Idr r3, [r3, #O] cmp r3, #0 ble .L2 @ branch if answer #3) b .L3 .L4: Idr r3, .L5 Idr r3, [r3, #O] sub r2, r3, #1 Idr r3, .L5 strr2, [r3, #0] @ answer #4_) Idr r3, .L5+4. Idrr3, [r3, #0] add r2, r3, #1 Idrr3, .L5+4 strr2, [r3, #0] @ answer #5) .L3: Idr r3, .L5 Idrr2, [r3, #0] Idr r3, .L5+8 Idr r3, [r3, #0] cmp r2, r3 bgt L4 @ while_answer #6) Idrr2, .L5+12 Idr r3, .L5+4 Idrr3, [r3, #0] mov ro, r2 mov r1, r3 bl printf .L2: Idr r3, .L5 Idr r2, [r3, #0] Idr r3, .L5+4 Idr r3, [r3, #O] rsbr2, r3, r2 @reverse subtraction r2 = r2 - r3 Idr r3, .L5+8 Idr r3, [r3, #0] add r2, r2, r3 Idrr3, .L5+16 strr2, [r3, #O]. @ answer #7_) (4 marks) Idrr2, .L5+20 Idrr3, .L5+16 Idrr3, [r3, #0] mov ro, r2 mov r1. r3 bl printf Idmfd sp!, {fp, pc .L6: .align 2 .L5: .word timeb word adj .word timea .word .LCO word timet word .LC1 Answer #1 AJ Answer #2 AJ Answer #3 Answer #4 AI Answer #5 Answer #6 A/ Answer #7 A/
Step 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