flat assembler
Message board for the users of flat assembler.

Index > Windows > reserve directive

Author
Thread Post new topic Reply to topic
darlok



Joined: 04 Aug 2003
Posts: 4
Location: Tomsk, Russia
darlok 04 Aug 2003, 09:13
I think it isnt great that when I code this: somevar rb 1000, size of my program increases by 1000. Other assemblers didnt do that. Of course, I may reserve memory dynamically, but sometimes it isnt comfortable Sad

_________________
Cheers!
Post 04 Aug 2003, 09:13
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 04 Aug 2003, 09:26
It's not because of FASM it's because of PE format. Other assemblers simply hides this from you. The right approach is to put all your uninitialized data as last data in the section, to allow FASM to shrink the size of the section to only initialized data. Another right approach is to make one section for initialized data and one for uninitialized.

Regards.
Post 04 Aug 2003, 09:26
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica 04 Aug 2003, 12:06
Code:
format PE
entry start
section '.bss' data readable writeable
 BigOne rb 1024
 EvenBigger rd 1024*1024
section '.text' code readable executable
start:
 ret    

This will generate a 1024 byte large exe. I always try to put all my uninitialised in a section called .bss (it seems to be the common name for it, as for the code, sometimes i use '.code' others '.text' - is there some document on the naming of the sections, does it matter what name they have?)

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 04 Aug 2003, 12:06
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.