NASM:未指定操作大小 [英] NASM: operation size not specified

查看:351
本文介绍了NASM:未指定操作大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在emu8086中编写了这段代码,并且在模拟器中运行得很好,但是当我尝试使用NASM进行编译时,却抛出了错误消息:未指定操作大小",请帮忙吗?

I wrote this code in emu8086 and it goes well in the emulator but when I'm trying to compile it with NASM it's throwing me up the error: "operation size not specified", help someone?

add bx,[3565]
sub bx,0xcc
mov [bx],0CCh

推荐答案

NASM无法弄清mov [bx],0CCh之类的行是什么意思.清楚地, 这将设置为0CCh.但是你想让bx指向一个字节吗 , 短长, ...?这将表现为相当不言自明的 NASM中的error: operation size not specified.您可以避免指定类型的错误,如下所示:

NASM can't figure out what you meant by a line like mov [bx],0CCh. Clearly, this sets something to 0CCh. But do you want to have bx pointing to a single byte , short, long, ...? This will manifest itself as the fairly self-explanatory error: operation size not specified in NASM. You could avoid the error specifying the type, as shown below:

SECTION .text
    global start

start:
    add bx,[3565]
    sub bx,0xcc
    mov byte [bx],0CCh

这样就可以组装好了……当然,不要试图按原样运行它,它会产生EXCEPTION_ACCESS_VIOLATION.只需使用调试器打开它,您就会明白为什么.

That'd assemble it ok... of course, don't try to run it as it is, it'll produce EXCEPTION_ACCESS_VIOLATION. Just open it with a debugger and you'll understand why.

这篇关于NASM:未指定操作大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆