【发布时间】:2024-01-03 07:38:01
【问题描述】:
这是 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 为参数的函数中更改此变量时遇到问题。 我发布的一个相关问题:Updating variable that lives in the data segment from the stack and its segment
【问题讨论】:
-
我认为这两者都会根据您的汇编程序推动 cursorRow 的 value (您可以随时反汇编文件以确定)。
mov ax, offset cursorRow; push ax至少应该推送地址。lds si, [cursorRow]; push ds; push si应该推一个远指针,但是我已经有一段时间没有做多段 16 位程序了。 -
我正在使用 NASM,据我所知,它没有 offset 关键字。昨晚我通过使用以下指令推送 cursorRow 的地址来让我的程序工作:
push cursorRow -
你读过 nasmdoc 吗?我记得有一节专门描述这部分与其他汇编程序(如 MASM 和 TASM)不同。
标签: assembly stack nasm 16-bit