气体中断 [英] Interrupt On GAS

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

问题描述

我正在尝试将我的简单程序从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'
hello.S:19: Error: no such instruction:
msg db"Hello,World!",0Ah'

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

我需要做什么?

推荐答案

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屋!

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