flat assembler
Message board for the users of flat assembler.

Index > Linux > arrays,size,and so on,basic problems

Author
Thread Post new topic Reply to topic
h0



Joined: 05 Aug 2005
Posts: 2
h0 05 Aug 2005, 11:07
Hello..
I have got some problems..
Most of these are probably due to 32bit instead of 16bit as i did before.

If someone can write some simple examples/explanations to my questions it would be nice.

Here it comes:

1.
Arrays? In dos, they are really easy, however on Linux I can`t figure out how to
declare them(mayby i can, it can be question number 2`s problem) and how to find 1 element.

2.
This size thing, $-word how do i use it, with an array?
As far as I can figure out, its how many bytes I want to send to stdout.
So, is it posible, (without looping and counting each char each time which would take some CPU)?,
Basicly I want to know whether or not I can use this $-word to find a number of bytes
in a single array cell. (I am able to write arrays out..but only the whole array.)
I want to use it dynamicly, (if the user press 1, it takes [array+1]..but it only writes 4 chars, because [array+0]
is 4!).

3.
How do i use es and ds on 32bit Linux?

Ehhrm before you think Iam too lame..This must be enough for now.

Here at the end, is Linux assembly lacking documentation? or where is it? The only docs I can find is
well written but really small, a half to 1 page or so.

Thanks.
Post 05 Aug 2005, 11:07
View user's profile Send private message Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 509
Location: Czech republic, Slovak republic
Feryno 05 Aug 2005, 13:18
Hello h0,
why you don't try to serach by google with keywords Linux+assembler ?
There is a lot of pages, e.g. http://linuxassembly.org with tutorials and samples. If you take a look to example hello.asm included in fasm-x.xx.tgz you can find here how to grab a string_size to register without counting and waste CPU time. Segment prefixes es: and ds: are useless on Linux, you needn't them. You have everything in one 2^32 bit=4GB page, no 2^16=64KB as on 16-bit OS.
Post 05 Aug 2005, 13:18
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 05 Aug 2005, 14:39
arrays are declared just as in DOS, the difference may be that you want to declare arrays of dwords instead of words. be more specific.
look for "protected mode programming" or "protected mode programming in ring0" about the segment registers
Post 05 Aug 2005, 14:39
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
h0



Joined: 05 Aug 2005
Posts: 2
h0 08 Aug 2005, 01:12
Sorry for the delay.
I searched google for hours before posting..However after some more hours i found a lot of nasm source code, which are perfect.
I found some articles about protected mode too, without understanding all of it, i got the most importent things(i hope).
Until now Linux assembly has been much more fun than dos asm!, its much easier with 32 bit registers, (until now).
So, i solved my problems. Thank you for answering.
Post 08 Aug 2005, 01:12
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.