Hello Danny,
Danny Phillips wrote to All :
DP> If I write a program:
DP> mov ah,2 int 21
DP> For DOS it does somthing spectacular ;-0 What about in Linux or
DP> UNIX?? How would I make an interupt call in Linux or UNIX. Does
DP> Linux or UNIX make interupt calls even? What do they use? Where are
DP> the interupts stored?? Please, someone tell me...
A little extract of my HomePage :
/* An extract of (/home/jan/assembler/Mijn_HomePage/eng.html)
In this example call puts is used to print a text on the screen.
Puts comes from 'C', and is standard present in the libraries
that are loaded by Linux. But there is a second way to do certain things by
assembly, it is INTerrupts. But it is not recommended to use these
interrupts because it is possible that they change in a later version of the
Linux-Kernel.
2.1.2. And now, two examples for Gas :
From assembler.028, thanks to Pieter de Jong
for these nice examples.
Example 1. By making use of call puts.
.text
message:
.ascii "Hello world!\0"
.align 4
.globl main
main:
pushl %ebp
movl %esp,%ebp
#call ___main
pushl $message
call puts
addl $4,%esp
xorl %eax,%eax
movl %ebp,%esp
popl %ebp
ret
as hello.s -o hello.o
gcc hello.o -o hello
Example 2. By making use of INT 80h.
.text
message:
.ascii "Hello, World!\12\0"
.align 4
.globl _hw
_hw:
movl $4, %eax
movl $1, %ebx
movl $message, %ecx
movl $15, %edx
int $0x80
movl $1, %eax
movl $0, %ebx
int $0x80
as hello.s -o hello.o
ld hello.o -e _hw -o hello
(_hw = entry-point)
*/
Have a nice day. - Jan Wagemakers -
o_o Please forgive my flinstone-english ;-)
--- Terminate 5.00/Pro /Linux.DosEmu.PTS-DOS
---------------
* Origin: Someone somewhere (2:292/854.19)
|