1
Dans l'assemblage, comment imprimer les valeurs d'un tableau? Maintenant dans ce programme, je dois également imprimer ses valeurs < Index entré par l'utilisateur.Assembly - Array (Linux)
.intel_syntax noprefix
.include "console.i"
.data
index: .long 0
array: .long 1,2,3,4,5,6,7,8,9,10,11,12 # Array initialized
value: .long 0
.text
ask1: .asciz "Enter an Index: "
ans: .asciz "Value= "
ask2: .asciz "Invalid Index"
ask3: .asciz "Goodbye!!"
_entry:
Prompt ask1
GetInt index
mov ebx, offset array # ebx = address of array
mov esi, index
cmp esi, 11 # comparing index with 11
ja 1f # if Index > 11,then jump
# to label 1
mov eax, [ebx + 4*esi]
mov value, eax
Prompt ans
PutInt value
PutEol
Prompt ask3
PutEol
ret
1: Prompt ask2
PutEol
Prompt ask3
PutEol
ret
.global _entry
.end
sera ** mov ecx, [EBX] ** aide en tout cas? Alors que je le déplace plus tard dans une valeur et imprime. – Pavitar
J'ai essayé ** mov ecx, [ebx] ** mais il imprime seulement la première valeur du tableau. :( – Pavitar