содержимое массива Intel x86 - PullRequest
0 голосов
/ 31 октября 2018

Я делаю программу на ассемблере для проекта с Intel x86, мне нужно добраться до содержимого массива, у меня есть первая позиция, но мне нужно получить другой индекс и сохранить его в регистре, так что я делаю так: `

call calcIndexP1         ; this calculates the index of the array and saves the value in  indexMat
mov bl, [mineField]      ; this is the first position of array 
lea  ebx, [ebx+indexMat] ; here I load the adress of the array position 
mov ebx, ebx             ; i think with this i get the content of the ebx which is the position of array 
cmp ebx, 1               ; I compare its value with 1 and jmp to some other states
je  mina
jmp no_mina`

Но я не могу получить его содержание.
Я предполагаю, что это потому, что он всегда делает безусловный переход, даже когда значение равно 1.

1 Ответ

0 голосов
/ 04 ноября 2018

Решение зависит от того, как вы определили mineField

mineField указывает на сам массив (байты?):

call calcIndexP1         ; calculates the index of the array
mov eax, [indexMat]
mov bl, [mineField+eax]  ; Content 
cmp bl, 1                ; I compare its value with 1 and jmp to some other states
je  mina
jmp no_mina

mineField - это переменная, содержимое которой указывает на массив (байты?):

call calcIndexP1         ; calculates the index of the array
mov eax, [indexMat]
mov ebx, [mineField]     ; this is the first position of array 
mov bl, [ebx+eax]        ; Content 
cmp bl, 1                ; I compare its value with 1 and jmp to some other states
je  mina
jmp no_mina
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...