flat assembler
Message board for the users of flat assembler.

Index > Linux > Hello,I'm REALLY new to this linux stuff.

Author
Thread Post new topic Reply to topic
2



Joined: 26 Sep 2006
Posts: 92
2
I recently got a dual boot set up between WinXP and Ubuntu 5.10 .
I downloaded the linux FASM and assembled this program!

Code:
format elf executable ;make the weird elf thing that linux uses

mov eax,4     ;call 4 of int 128 for writing
mov ebx,1     ;ebx is 1 for writing to the screen
mov ecx,msg   ;mov msg into ecx
mov edx,size  ;mov the length of the message into edx
int 128       ;interrupt 128(the linux call)

mov eax,1     ;call 1 for exiting program
int 128

msg db 'Hello linux!',10 ;string ending with a newline
size = $-msg ;makes a constant that equals the length of msg
    


It works as I'd expect,but it's all I can do cause I can't find a complete idiots guide
to using all the system calls. I used ralph browns interrupt list for DOS,but I can't
find the help I need on linux.

What I want to do is write it to a file instead of the screen,but I don't know the
calls for creating and closing files.

So,maybe somebody can help me with an example. That's how I learned what I have in
DOS. Yes,I'm the crazy guy that was also on the DOS forum. Please don't make
a big deal about the fact that I'm using decimal numbers for my interrupts and
stuff. You can write your examples how you want and I'll just figure it out.

but also,if you know a good place where I can get a list of all the calls in great
detail,let me know.

_________________
There are 10 kinds of people in the world.
Those who know binary and those who haven't met me.
Post 17 Oct 2006, 06:29
View user's profile Send private message Reply with quote
arafel



Joined: 29 Aug 2006
Posts: 131
Location: Jerusalem, Israel
arafel
[warning: shameless plug ahead]

Look at the topmost thread in this subforum.
Post 17 Oct 2006, 07:54
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
BTW, is correct to use INT/SYSCALL if you want you program tu run in future versions of the kernel? You can also use INT/SYSCALL on NT based Windowses but you have to call them through the proper API.
Post 17 Oct 2006, 13:20
View user's profile Send private message Reply with quote
arafel



Joined: 29 Aug 2006
Posts: 131
Location: Jerusalem, Israel
arafel
It's safer to use library calls if you want to be 100% sure, but system calls are relatively safe if you make sure not to use any syscalls that have been scheduled for removal or some major rewrite.
Post 17 Oct 2006, 14:06
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
are there some scheduled for removal? if so, be sure to mention it in your docs Smile
Post 17 Oct 2006, 14:15
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
arafel



Joined: 29 Aug 2006
Posts: 131
Location: Jerusalem, Israel
arafel
I spotted about seven syscalls (one of them was some signal related function, don't remember the others) that have comments in the source code along those lines: 'this function superceded by blablabla and maintained only for compatibility'. Not exactly a definite, near future, removal; but I guess not something to be relied upon Smile
I think i have mentioned about all of them in the docs, but will recheck just in case.
Post 17 Oct 2006, 15:04
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
thx a lot
Post 17 Oct 2006, 15:19
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
2



Joined: 26 Sep 2006
Posts: 92
2
Quote:
warning: shameless plug ahead

Look at the topmost thread in this subforum.


I did,but I couldn't find the help I needed still. Well,I guess I'll try it
again next time I'm in ubuntu. I'm booted in XP for some really strange stuff.

_________________
There are 10 kinds of people in the world.
Those who know binary and those who haven't met me.
Post 18 Oct 2006, 03:39
View user's profile Send private message Reply with quote
Quantum



Joined: 24 Jun 2005
Posts: 122
Quantum
A moreless complete reference is here:
http://www.lxhp.in-berlin.de/lhpsyscal.html

Quote:

BTW, is correct to use INT/SYSCALL if you want you program tu run in future versions of the kernel?

It is very safe if you handle the compatibility issues carefully. BTW, you can test for a particular kernel version and OS family (Linux/BSD/...) before performing any syscall. I've seen many bugs in LIBC and other standard libs. You are never safe using LIBC Wink
Post 21 Oct 2006, 02:10
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.