flat assembler
Message board for the users of flat assembler.

Index > Linux > some examples for linux

Author
Thread Post new topic Reply to topic
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1 24 Sep 2007, 05:22
i will post my useless examples for linux here.
i hope no one will have any problem with that Wink

_________________
Code:
 o__=-
 )
(\
 /\  
    
Post 24 Sep 2007, 05:22
View user's profile Send private message Reply with quote
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1 24 Sep 2007, 05:24
print first N prime numbers.


Description: print first N prime numbers.
Download
Filename: hello2.asm
Filesize: 1.4 KB
Downloaded: 623 Time(s)


_________________
Code:
 o__=-
 )
(\
 /\  
    
Post 24 Sep 2007, 05:24
View user's profile Send private message Reply with quote
0.1



Joined: 24 Jul 2007
Posts: 474
Location: India
0.1 25 Sep 2007, 05:02
Print first N terms of Fibonacci sequence.


Description: Print first N terms of Fibonacci sequence.
Download
Filename: fib.asm
Filesize: 1.47 KB
Downloaded: 625 Time(s)


_________________
Code:
 o__=-
 )
(\
 /\  
    
Post 25 Sep 2007, 05:02
View user's profile Send private message Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 03 Dec 2007, 17:38
0.1 wrote:
i will post my useless examples for linux here.
i hope no one will have any problem with that Wink


There is no code, that is "useless"; in fact, these were the first two files I compiled under Linux using fasm. And that's use enough! I'ld be glad, finding more of these files to learn. Rolling Eyes
Post 03 Dec 2007, 17:38
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 03 Dec 2007, 19:19
The examples inside http://lscr.sourceforge.net/ are worth for reading IMHO
Post 03 Dec 2007, 19:19
View user's profile Send private message Reply with quote
Gilneas



Joined: 02 Nov 2007
Posts: 2
Gilneas 04 Dec 2007, 22:22
Curses! That lscr archive is a tar bomb!
Post 04 Dec 2007, 22:22
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 05 Dec 2007, 00:13
write to user "arafel" on this board about problem.


Last edited by vid on 05 Dec 2007, 02:34; edited 1 time in total
Post 05 Dec 2007, 00:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 05 Dec 2007, 01:39
haha, I interpreted that as "the package is great!" Razz

I have noticed a problem with it, the directories are all marked as not executable so only root can enter on them... I fixed it by using a recursive chmod +x but that also gave execution permission to anything...

I'm on Windows now but I think I did "chmod -R +x lscr". Perhaps there is a way to uncompress it without this problem but I don't know and in fact this is the only TAR with that I have this trouble so far.

I have not contacted him about this because I'm still unsure of the problem's cause, so if someone confirms that the package is improperly TARed please report.
Post 05 Dec 2007, 01:39
View user's profile Send private message Reply with quote
Gilneas



Joined: 02 Nov 2007
Posts: 2
Gilneas 06 Dec 2007, 06:33
Find is really convenient in this case (instead of chmod -R)
cd lscr
find -type d -exec chmod u+x {} \;
Post 06 Dec 2007, 06:33
View user's profile Send private message Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 06 Dec 2007, 08:18
Apropos roots and rights and attributes...
I found somewhere this little asm-prog, which creates a file and saves a string in it, but it doesn't care for user rights, so the normal user can't read, what is written in the file. (Surely can he chmod it in the necessary way as root, but it would be comfortable, if the asm-prog would do this automatically)
I hope U understand, what I mean.

Here's the code, what have I to insert, for correcting the read-write-rights of the data file?

Code:
format elf executable

mov eax,8 ;call 8 for creating file
mov ebx,f ;ebx is loaded with the filename
int 128
mov ebx,eax ;mov file descriptor into ebx

mov eax,4    
mov ecx,msg  
mov edx,size
int 128

mov eax,6 ;call 6 for close file
int 128

mov eax,1
int 128
f db 'Hello',0
msg db 'Hello File!!!',10
size = $-msg
    


BTW, I don't know, who's the origin author of this code, so please don't blame me for ripping code... Wink
Post 06 Dec 2007, 08:18
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 06 Dec 2007, 20:41
Try this:
Code:
format elf executable

mov eax,8 ;call 8 for creating file
mov ebx,f ;ebx is loaded with the filename
mov ecx,0x1a4
int 128
mov ebx,eax ;mov file descriptor into ebx

mov eax,4
mov ecx,msg
mov edx,size
int 128

mov eax,6 ;call 6 for close file
int 128

mov eax,1
int 128
f db 'Hello',0
msg db 'Hello File!!!',10
size = $-msg
    
Post 06 Dec 2007, 20:41
View user's profile Send private message Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 07 Dec 2007, 13:29
OK, tested, works. Smile
But... why?
1a4hex is 420 in dezimal
...and about chmod i think 1 is executable
2 is write
4 is read

So I would have expected something like 644 or 664?

I don't understand this one.
Post 07 Dec 2007, 13:29
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 07 Dec 2007, 14:50
0x1a4 is 420 dec and 644 Octal, most write it as a Octal number

See here may help http://en.wikipedia.org/wiki/File_system_permissions#Octal_notation
Post 07 Dec 2007, 14:50
View user's profile Send private message Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 07 Dec 2007, 16:38
OK, that's it! Very Happy
I think I understood.
Thanks for the help! Wink
Post 07 Dec 2007, 16:38
View user's profile Send private message Visit poster's website Reply with quote
m



Joined: 28 Dec 2006
Posts: 304
Location: in
m 18 Sep 2008, 15:20
lookup IP address of give host name.
usage: mygetip google.com


Description: mygetip.asm
Download
Filename: mygetip.asm
Filesize: 922 Bytes
Downloaded: 623 Time(s)


_________________
Attitude!
Post 18 Sep 2008, 15:20
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.