在我的代码中,我试图反向打印一个数组。我的两个主要想法是使用堆栈和 LIFO 属性来完成它,或者使用循环作为从 10 到 0 零的索引来反向访问元素。由于堆栈方法的对齐问题,我选择了第二个。
我对组装很陌生,希望能得到一些帮助,以了解我的错误在哪里。提前致谢 !
DEFAULT REL
; external functions for inputs/outputs printf and scanf/printf
extern printf
extern scanf
section .data
prompt db "Entrez un entier : ",0
longIntFormat db "%ld",0
section .bss
entier resb 10 ; array of 10 integers
section.text
push rbp
mov rcx, 0
mov rdx, 0 ; initialise counter
lea rcx, [entier] ; load array into register rcx
; fills the array with user input
_getLoop:
; call printf
lea rdi,[prompt]
mov …Run Code Online (Sandbox Code Playgroud)