How interrupts work
Thanks, but which assembler must I use for this code? GNU as? I'm asking that because I am only familiar with nasm.
Thanks Again,
RCS
Em Aug 2002, Dmitry Trunikov escreveu:
Quoted 5 lines
Quoted 3 lines · RCS
I need some help to understand how interrupts work on Intel. For example, how do I print a character in the screen? Wich register must contain the character for that? Is "int 10h" the
correct
Quoted 25 lines
Quoted 3 lines
interrupt for that?
It depends on which pc or OS you use. "int 10h" is a BIOS (base input output system) interrupt i.e. it can be used AFAIK only in real CPU mode. Usually for character output is used OS API. In MSDOS you can uset "int 10h" or "int 21h" for input/output. Under linux you can use system call "int 80h".
This is an example for output string under linux://
ssize_twrite(int fd, const void *buf, size_t count); //write(fileno(stdout), "hello", 6);.data
hello:
.string "hello world\n"
.text
.globl_start_start:
movl 4,%eax // 4 - sys function 'write'
movl 1,%ebx // fd = fileno(stdio)
movl $hello,%ecx // buf = str
movl $12,%edx // count
int $0x80
Quoted 5 lines
movl 1,%eax // sys function 'exit'
xorl %ebx,%ebx
int $0x80----------
_________________________________________________________
Oi! Você quer um iG-mail gratuito?
Então clique aqui: http://registro.ig.com.br/
Quoted 18 lines · RCS
Thanks, but which assembler must I use for this code? GNU as? I'm asking that because I am only familiar with nasm.
Quoted 15 lines
.data
hello:
.string "hello world\n"
.text
.globl_start_start:
movl 4,%eax // 4 - sys function 'write'
movl 1,%ebx // fd = fileno(stdio)
movl $hello,%ecx // buf = str
movl $12,%edx // count
int $0x80movl 1,%eax // sys function 'exit'
xorl %ebx,%ebx
int $0x80
This is GNU as syntax. You can use 'intel2gas' to convert from gas to nasm and vice versa. (see
http://www.niksula.cs.hut.fi/~mtiihone/intel2gas )
Regards,
Stephan
RE: Intel2GAS (was How interrupts work)
As I discovered two weeks ago, Intel2Gas is no longer available. I found an older version of it's source code using a Internet cache service. But if anyone can provide the most recent binary, I'd appreciate it.
Jim Watters
-----Original Message-----
From: Stephan Walter
This is GNU as syntax. You can use 'intel2gas' to convert from gas to nasm and vice versa. (see
http://www.niksula.cs.hut.fi/~mtiihone/intel2gas )
Re: Intel2GAS (was How interrupts work)
Quoted 6 lines · Jim Watters
As I discovered two weeks ago, Intel2Gas is no longer available. I found an older version of it's source code using a Internet cache service. But if anyone can provide the most recent binary, I'd appreciate it.
I had no problems downloading the source it from:
http://www.niksula.cs.hut.fi/~mtiihone/intel2gas/
and there's even an Debian package...
You can try the attached binary... might work if you've got the right libs :-)
Regards,
Stephan
RE: Intel2GAS (was How interrupts work)
Great! Thanks Stephan. I had spent many hours looking for this.
Jim Watters
-----Original Message-----
From: Stephan Walter
I had no problems downloading the source it from:
http://www.niksula.cs.hut.fi/~mtiihone/intel2gas/
and there's even an Debian package...
You can try the attached binary... might work if you've got the right libs :-)
Regards,
Stephan