flat assembler
Message board for the users of flat assembler.

Index > Main > an executable format with segments instead of labels.

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 11 Nov 2009, 11:58
the Q is in the title.

is it posible to define as many segemnts in a code that there are labels for objects or functions?

then, to call an object or a function, the segment register DS or CS will point to the desired item.

in PM, the limit is 8195 descriptors in LDT and GDT.

in real mode, the limit is 65536 segments.

but in fasm, i don't see an easy way to define as many segments (at least 500) as i want.
Post 11 Nov 2009, 11:58
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 11 Nov 2009, 13:03
Which output format are you using? MZ, PE, ELF, binary, other?
Post 11 Nov 2009, 13:03
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 11 Nov 2009, 13:59
i use .com and .bin by default.
with org XXXX only.
and maybe, with many orgs, for each item segments.
Post 11 Nov 2009, 13:59
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 11 Nov 2009, 15:23
What you write is wrong in so many things it makes your question almost impossible to answer.

But anyway...
Quote:
in PM, the limit is 8195 descriptors in LDT and GDT.
in real mode, the limit is 65536 segments.
but in fasm, i don't see an easy way to define as many segments (at least 500) as i want.

FASM is not the option in same category as PM or real mode. It is assembler that can use both PM and real mode, and doesn't put any limit on how many segment your code uses.
Post 11 Nov 2009, 15:23
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 11 Nov 2009, 19:28
vid wrote:
What you write is wrong in so many things it makes your question almost impossible to answer.

But anyway...
Quote:
in PM, the limit is 8195 descriptors in LDT and GDT.
in real mode, the limit is 65536 segments.
but in fasm, i don't see an easy way to define as many segments (at least 500) as i want.

FASM is not the option in same category as PM or real mode. It is assembler that can use both PM and real mode, and doesn't put any limit on how many segment your code uses.
I think he meant his code needs to run in PM and wants to know how to set up the segments.


If that's the case I also want to know. I thought you had to be in ring 0 to change them.

_________________
Post 11 Nov 2009, 19:28
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 11 Nov 2009, 19:47
Are you wanting to classify objects and procedures in their own segments?
This seems like a terrible waste but i may not understand what you intend...
Generally you only need a few descriptors like linear,code,data,tss...
There may be a much simpler approach but what exactly is your goal?
Post 11 Nov 2009, 19:47
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 11 Nov 2009, 22:21
the goal is to call a part of a program from an other program.

when label for an item is a relative ofset (relative rom org) it is hard to separate it from it's container.

i want to make something like modular "hot" programming.

something that let you use the strictlly same object or many different programms, or many times inside the same program.
to import items without the need to recompile it. etc.

for the lib, it is still the case, the same function can be called from many objecs at the same time.

i want the same stuff for items and programms.
of course, not everything will be segmented, but call items from other segments will be possible.

i cannot find a better explanation for what i want to do.
Post 11 Nov 2009, 22:21
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 12 Nov 2009, 00:34
edfed: Do you mean you want to make thread safe code? Or do you mean you want relocatable code? Or both?
Post 12 Nov 2009, 00:34
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 12 Nov 2009, 01:03
both. as well as for very big programs, as for a single instruction.
idem for datas.
Post 12 Nov 2009, 01:03
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 12 Nov 2009, 01:41
For thread safe code just use the stack. For relocatable code just eliminate global data pointers. In a .com file type both of these are easy to do, just adjust DS/ES/FS/GS/SS based upon CS.
Post 12 Nov 2009, 01:41
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 12 Nov 2009, 02:33
I once did an API for a hobby OS by making a lookup table at
the top of the file (where offset was known) then other modules
in different segments could access these functions with far calls.
Does this sound like something you want to do in your code?
Post 12 Nov 2009, 02:33
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 12 Nov 2009, 12:49
yes, it sounds like what i want to do.
but as it will be completely modular, i think about a tree access to items.
with a path or anything that brings the location, independentlly from where it is really.
Post 12 Nov 2009, 12:49
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 12 Nov 2009, 12:53
DLL?
Post 12 Nov 2009, 12:53
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 12 Nov 2009, 13:05
a little like DLL.
in some case, the same item could be imported from an external programm, like a sound generator in a synthetiser, or a character from a 3D game.
sometimes, it will not be imported, but just called from destination.
and sometimes, it will be cloned to destination.

it is a sort of plug in scheme that i want, like in electronics.
transistor have 3 pins, resistors have 2.
items, functions or applications will have N pins.

at the end, the goal is to plug an entire application insisde an other.
Post 12 Nov 2009, 13:05
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 12 Nov 2009, 13:11
OLE! Windows already has that, perhaps you can go to the MS site and see how they achieve it.
Post 12 Nov 2009, 13:11
View user's profile Send private message Visit poster's website 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.