Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that reads 10 numbers from a user into array using ARM Assembly Have to use loops. This isn't working for me. .data
Write a program that reads 10 numbers from a user into array using ARM Assembly
Have to use loops.
This isn't working for me.
.data .balign 4 m1: .asciz "User number:" .balign 4 scan_p: .asciz "%d" .balign 4 number_read: .word 0 .balign 4 return: .word 0 .balign 4 a: .skip 20 .balign 4 i: .word .global main main: LDR R1, address_of_return STR LR, [R1] LDR R3, addressOfA LDR R4, addressOfI MOV R5, #0 STR R5, [R4] loop: LDR R5, [R4] CMP R5, #5 BEQ end ADD R6, R3, R5, LSL #2 LDR R0, address_of_m1 BL printf LDR R0, address_of_scan_p LDR R1, address_of_number_read BL scanf STR R1, [R6] // Store a[i] = *address_of_number_read ADD R5, R5, #1 STR R5, [R4] b loop end: LDR R1, address_of_return LDR R1, [R1] BX LR address_of_m1: .word m1 address_of_scan_p: .word scan_p address_of_number_read: .word number_read address_of_return: .word return addressOfA: .word a addressOfI: .word i .global printf .global scanf
Getting a segmentation fault 139
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