[NASM] Initialisation d'un tableau
Bonjour,
Débutant en ASM x86, je n'arrive pas à initialiser un tableau de 0 à 255. J'ai beau lire de la doc et faire les exemples mais avec un debugger j'ai un beau access violation. Pour tester je n'ai pas fait de boucle, je cherche juste à modifier la première valeur du tableau.Si quelqu'un peut me donner un coup de main. Merci
NB: J'utilise nasm avec visual studio comme debugger sur un windows 64bits
Voici mon bout de code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| global _init_table
%define ARRAY_SIZE 256
SECTION DATA USE32 CLASS=DATA:
array: times ARRAY_SIZE dw 0 ; reserved an array of 256 bytes
SECTION CODE USE32 CLASS=CODE:
_init_table:
push ebp ; add ebp on the stack
mov ebp, esp ; move esp in ebp
sub esp, 4 ; reserved a DWORD for j
push ebx ; ebx must not be changed
; Inutile pour le moment
mov dword[ebp - _init_table_PRM_j], 0 ; initialize j to '0'
db 0xcc ; TO REMOVE WARNING
; Initialisation de la boucle
mov eax, 10
mov ebx, array ; Charge l'adresse de array dans ebx
mov [ebx], word 10
; Sortie de fonction
pop ebx;
mov esp, ebp ; move ebp in esp
pop ebp ; pop ebp
ret |