英特尔x86阵列内容

时间:2018-10-31 18:07:50

标签: assembly x86

我正在为使用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 :(得分:0)

解决方案取决于您如何定义 mineField

mineField 指向(bytes?)数组本身:

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