0

这是 16 位实模式 NASM。

 ; ---- variables ------
    cursorRow db 1
 .
 .
 .

 ; what are the differences between these two pushes?
 push cursorRow ; is this the address of?

 push [cursorRow] ; is this the value of?

我在以 cursorRow 为参数的函数中更改此变量时遇到问题。我发布的一个相关问题:从堆栈及其段更新位于数据段中的变量

4

2 回答 2

1

cursorRow 是值,[cursorRow] 是 cursorRow 位置的值。如果您需要将 cursorRow 的地址放在堆栈上,那么您需要推送 bp+1 或变量的实际地址是什么

于 2011-07-12T05:19:32.650 回答
1

如果 cursorRow (不是 [cursorRow] )在数据段中启动,它就像一个 C 指针。使用 [cursorRow] 将取消引用它并返回存储在那里的值,您必须在 [cursorRow] 前面加上值的大小,例如mov al, byte [cursorRow].

于 2012-02-13T19:18:09.633 回答