Assembly ARM Excercise-Segmentation Fault

问题描述 投票:0回答:1

我已将注释从意大利语更改为英语。希望它更容易理解!

                .data
v:              .word 1,2,3,4,5,6,7,8   @ at the end I have to get 1,0,3,0,5,0,7,0
                .text
                .global main
main:           mov r0, #8              @ dimension of my array
                ldr r1, =v              @ address of my array
                push {lr}               

                mov r3, #4              @ index = 1

loop:           cmp r3, #32             @ condition of the loop
                bge exit                @ if r3 is greather or equal exit from the loop

                ldr r1, [r1, r3]        @ load the element of my array of index r3 in r1
                mov r1, #0              @ set my even element to 0
                str r1, [r1, r3]
                add r3, r3, #8          @ increment my index of 2 position
                b loop                  @ back to loop function

exit:           pop {pc}                @ quit from my loop function and back to main
assembly raspberry-pi segmentation-fault arm armv7
1个回答
2
投票

请问关于StackOverflow should be written in English的问题,其中包括源代码中的注释(最好还包括标签),因为这些注释对于试图帮助您使用代码的人们和您一样重要。幸运的是,我会说意大利语!

© www.soinside.com 2019 - 2024. All rights reserved.