Interrupt On GAS

送分小仙女□ 提交于 2019-12-11 01:27:06

问题


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: Assembler messages:
hello.S:13: Error: operand size mismatch for int'
hello.S:19: Error: no such instruction:
msg db "Hello, World!",0Ah'

What I need to do?


回答1:


In GAS, constants need a $. Change that line to:

int $10

And your message should be:

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

Or even better:

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


来源:https://stackoverflow.com/questions/2931224/interrupt-on-gas

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