为什么这是一个无效的操作数?

发布于 2024-09-18 07:16:45 字数 733 浏览 4 评论 0原文

我正在编写的编译器生成了以下 ASM 文件:

; This code has been generated by the 7Basic
; compiler <http://launchpad.net/7basic>

; Uninitialized data

      SECTION .bss
v_0 resb 4
v_4 resb 4
v_8 resb 4

; Code

      SECTION .text
push 1
pop eax
mov v_0, eax
push 2
pop eax
mov v_4, eax
mov eax, v_0
push eax
mov eax, v_4
push eax
pop ebx
pop eax
imul eax,ebx
push eax
pop eax
mov v_8, eax

当我尝试编译它时,出现以下错误:

test.asm:16: 错误:操作码和操作数的组合无效
test.asm:19:错误:操作码和操作数的组合无效
test.asm:29: 错误:操作码和操作数的组合无效

这确实没有意义,因为根据 NASM 文档,我可以:

MOV    mem_offs,reg_eax    386

为什么我不能执行此操作?

I have the following ASM file generated by a compiler I'm writing:

; This code has been generated by the 7Basic
; compiler <http://launchpad.net/7basic>

; Uninitialized data

      SECTION .bss
v_0 resb 4
v_4 resb 4
v_8 resb 4

; Code

      SECTION .text
push 1
pop eax
mov v_0, eax
push 2
pop eax
mov v_4, eax
mov eax, v_0
push eax
mov eax, v_4
push eax
pop ebx
pop eax
imul eax,ebx
push eax
pop eax
mov v_8, eax

When I try to compile it, I get the following errors:

test.asm:16: error: invalid combination of opcode and operands
test.asm:19: error: invalid combination of opcode and operands
test.asm:29: error: invalid combination of opcode and operands

This really doesn't make sense because according to the NASM docs, I'm allowed to:

MOV    mem_offs, reg_eax    386

Why can't I perform this operation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

埋情葬爱 2024-09-25 07:16:45

您需要方括号来取消引用指针:

mov  [v_0], eax

You need square brackets to dereference the pointers:

mov  [v_0], eax
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文