gpt4 book ai didi

assembly - 气体中断

转载 作者:行者123 更新时间:2023-12-02 14:42:06 25 4
gpt4 key购买 nike

我正在尝试将我的简单程序从 Intel 语法转换为 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

但是当我编译它时,我得到了这个:

hello.S: Assembler messages:
hello.S:13: Error: operand size mismatch for int'<br/>
hello.S:19: Error: no such instruction:
msg db "Hello, World!",0Ah'

我需要做什么?

最佳答案

GAS中,常量需要一个$。将该行更改为:

int $10

您的消息应该是:

msg: .byte "Welcome to Track!", 0x0a

或者更好:

msg: .asciiz "Welcome to Track!\n" 

关于assembly - 气体中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2931224/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com