Question: 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

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!