Nat*_*pos 2 assembly gnu-assembler intel-syntax
我正在尝试将我的简单程序从英特尔语法转换为AT&T(用GAS编译).我已经成功转换了我的应用程序的一大部分,但我仍然得到int(中断)的错误.我的功能是这样的:
printf:
mov $0x0e, %ah
mov $0x07, %bl
nextchar:
lodsb
or %al, %al
jz return
int 10
jmp nextchar
return:
ret
msg db "Welcome To Track!", 0Ah
Run Code Online (Sandbox Code Playgroud)
但是当我编译它时,我得到了这个:
hello.S:汇编程序消息:
hello.S:13:错误:int'msg db"Hello,World!",0Ah'的操作数大小不匹配
hello.S:19: Error: no such instruction:
我需要做什么?
在GAS,常数需要一个$.将该行更改为:
int $10
Run Code Online (Sandbox Code Playgroud)
你的信息应该是:
msg: .byte "Welcome to Track!", 0x0a
Run Code Online (Sandbox Code Playgroud)
甚至更好:
msg: .asciiz "Welcome to Track!\n"
Run Code Online (Sandbox Code Playgroud)