Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ENTER ALL ANSWERS AT THE BOTTOM OF THE PAGE. Each question is worth 1 mark unless stated otherwise. .file Q1.c .comm done,4,4 .comm x,4,4 .comm
ENTER ALL ANSWERS AT THE BOTTOM OF THE PAGE. Each question is worth 1 mark unless stated otherwise. .file "Q1.c" .comm done,4,4 .comm x,4,4 .comm arr, 80,4 .comm t,4,4 section rodata .align 2 .LCO: .ascii "t = %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, .L4 @(r3 = address of t) mov r2, #0 strr2, [r3, #0] @r2 will be stored at t) Idr r3, .L4+4 @ r3 = __answer #1) mov r2, #0 strr2, [r3, #0] Idrr3, .L4+8 mov r2, #0 strr2, [r3, #0] b .L2 .L3: Idr r3, .L4+8 @r3 = address of x Idr r2, [r3, #O] @r2 = x Idrr3, L4+8 Idrr1,[r3, #O] @lr1 = answer #2) Idr r3, .L4+12 strr1,[r3, r2, asl #2] @(r1 will be stored into answer #3) (2 marks) Idr r3, .L4+8 Idr r2, [r3, #0] Idr r3, L4+12 Idr r2, [r3, r2, asl #2] Idr r3, .L4 Idr r3, [r3, #O] add r2, r2, r3 Idr r3, .L4 strr2, [r3, #0] @(r2 = answer #4_) (2 marks) Idr r3, L4+8 Idr r3, [r3, #0] add r2. r3, #1 Idr r3, .L4+8 strr2, [r3, #O] @(r2 = __answer #5_) .L2: Idr r3, .L4+8 Idrr3, [r3, #O] cmp r3, #19 ble L3 @( branch if answer #6_is answer #7_than/to 19 Idr r2, .L4+16 Idr r3, L4 Idr r3, [r3, #0] movro, r2 @ro =__answer #8) mov r1, r3 bl printf Idr r3, .L4+4 mov r2, #1 strr2, [r3, #O] Idmfd sp!, {fp, pc} .L5: .align 2 L4: wordt word done .word X .word arr .word .LCO Answer #1: Answer #2: Answer #3 Answer #4 Answer #5 Answer #6 Answer #7 Answer #8 ENTER ALL ANSWERS AT THE BOTTOM OF THE PAGE. Each question is worth 1 mark unless stated otherwise. .file "Q1.c" .comm done,4,4 .comm x,4,4 .comm arr, 80,4 .comm t,4,4 section rodata .align 2 .LCO: .ascii "t = %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, .L4 @(r3 = address of t) mov r2, #0 strr2, [r3, #0] @r2 will be stored at t) Idr r3, .L4+4 @ r3 = __answer #1) mov r2, #0 strr2, [r3, #0] Idrr3, .L4+8 mov r2, #0 strr2, [r3, #0] b .L2 .L3: Idr r3, .L4+8 @r3 = address of x Idr r2, [r3, #O] @r2 = x Idrr3, L4+8 Idrr1,[r3, #O] @lr1 = answer #2) Idr r3, .L4+12 strr1,[r3, r2, asl #2] @(r1 will be stored into answer #3) (2 marks) Idr r3, .L4+8 Idr r2, [r3, #0] Idr r3, L4+12 Idr r2, [r3, r2, asl #2] Idr r3, .L4 Idr r3, [r3, #O] add r2, r2, r3 Idr r3, .L4 strr2, [r3, #0] @(r2 = answer #4_) (2 marks) Idr r3, L4+8 Idr r3, [r3, #0] add r2. r3, #1 Idr r3, .L4+8 strr2, [r3, #O] @(r2 = __answer #5_) .L2: Idr r3, .L4+8 Idrr3, [r3, #O] cmp r3, #19 ble L3 @( branch if answer #6_is answer #7_than/to 19 Idr r2, .L4+16 Idr r3, L4 Idr r3, [r3, #0] movro, r2 @ro =__answer #8) mov r1, r3 bl printf Idr r3, .L4+4 mov r2, #1 strr2, [r3, #O] Idmfd sp!, {fp, pc} .L5: .align 2 L4: wordt word done .word X .word arr .word .LCO Answer #1: Answer #2: Answer #3 Answer #4 Answer #5 Answer #6 Answer #7 Answer #8
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