私のプログラムは、配列を使用してユーザーからの入力として数値を取得し、モニターに数値を出力します。したがって、私のプログラムの入力と出力を期待するのは次のとおりです。
i/p: 1 2 3 4
o/p: 1 2 3 4
しかし、私のプログラムは、数値を除いてこの方法で出力を提供します。
o/p: 4 3 2
私のプログラムは次のとおりです。
section .data
msg db "%d"
four dd 4
msga db "%d",10,0
section .bss
arr resd 4
section .text
global main
extern printf,scanf
main:
xor ecx,ecx
lp:
mov ebx,arr
mov eax,ecx
mul dword[four]
add ebx,eax
pusha
push ebx
push msg
call scanf
add esp,8
popa
inc ecx
cmp ecx,4
jnz lp
mov ecx,3
lp1:
mov ebx,arr
mov eax,ecx
mul dword[four]
add ebx,eax
pusha
push dword[ebx]
push msga
call printf
add esp,8
popa
dec ecx
jg lp1
このプログラムでアドバイスしてくれませんか?事前にubuntu11.04THanxを使用しています