c - 汇编器中的简单增量

标签 c assembly

我被这个问题困住了。我正在自学汇编程序并翻译一些基本指令。但我不能用这个。

谁能帮帮我吗?

int
secuencia ( int n, EXPRESION * * o )
{
  int a, i;
  for ( i = 0; i < n; i++ ){

    a = evaluarExpresion( *o );

    // Im trying to do this: o++;
  __asm {
      mov eax,dword ptr [o] 
      mov ecx,dword ptr [eax] 
      inc [ecx]  
    }
  }
  return a ;
}

我写了里面的 and 工作,但仍然不知道如何增加 O

int
secuencia ( int n, EXPRESION * * o )
{
  int a, i;
  for ( i = 0; i < n; i++ ){

      __asm {

            mov eax,dword ptr [o] 
            mov ecx,dword ptr [eax] 
        push ebp
            mov ebp, esp
            push ecx

            call evaluarExpresion
        mov esp, ebp

        pop ebp

        mov a, eax
      }

    o++;
  }
  return a ;
}

最佳答案

mov esi, o
add esi, 4 //increment is here

第 1 行:我们将 o 指针移至 esi 寄存器。 Line2:我们增加你的 o 指针

mov eax, o
mov esi, [eax]
add esi, 4

我不太明白你想做什么,但希望对你有帮助!

关于c - 汇编器中的简单增量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1695472/

相关文章:

c - 错误 : return type is an incomplete type

c - 如何在c中将输出精度设置为float

c - 如何使用平方反比定律将光强度转换为线性值

c - 为什么编译汇编时出现奇数操作数错误?

c++ - 为什么 GCC 不能假设 std::vector::size 在这个循环中不会改变?

python - SWIG 将 C 库连接到 Python(SWIG 生成的类使用起来很麻烦)

c - 使用扩展汇编语法在实模式下调用 BIOS 服务存在困难

c - `atomic_compare_exchange_strong_explicit()` -- 当不相等时,`success` 和 `failure` 参数的各种组合会做什么?

assembly - 通过 AVR 汇编程序 "hello world"代码

python distutils,用生成的源代码编写c扩展