NASM: operation size not specified

*爱你&永不变心* 提交于 2019-11-29 17:51:38

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!