气体中断 [英] Interrupt On GAS
问题描述
我正在尝试将我的简单程序从Intel语法转换为AT& T(以使用GAS进行编译).我已经成功转换了我的应用程序的很大一部分,但是int
(中断)仍然出现错误.我的功能是这样的:
I'm trying to convert my simple program from Intel syntax to the AT&T(to compile it with GAS). I've successfully converted a big part of my application, but I'm still getting an error with the int
(the interrupts). My function is like this:
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
但是当我编译它时,我得到了:
But when I compile it, I got this:
hello.S:汇编程序消息:
hello.S:13:错误:int'
msg db"Hello,World!",0Ah'
hello.S:19: Error: no such instruction:
hello.S: Assembler messages:
hello.S:13: Error: operand size mismatch forint'
msg db "Hello, World!",0Ah'
hello.S:19: Error: no such instruction:
我需要做什么?
推荐答案
在GAS
中,常量需要一个$
.将该行更改为:
In GAS
, constants need a $
. Change that line to:
int $10
您的信息应该是:
msg: .byte "Welcome to Track!", 0x0a
甚至更好:
msg: .asciiz "Welcome to Track!\n"
这篇关于气体中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!