flat assembler
Message board for the users of flat assembler.

Index > Windows > Large executable

Author
Thread Post new topic Reply to topic
bo



Joined: 19 Mar 2012
Posts: 2
bo
Hey, I'm working on some code and my arrays are bloating the exe considerably. Is there a better way?

An example of my current code:
Code:
section '.data' data readable writeable
buf rd 800*600
buf2 rd 512*512
buf3 rd 512*512
    
Post 19 Mar 2012, 09:30
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17450
Location: In your JS exploiting you and your system
revolution
Put all your uninitialised data at the end of the section. Note the different size of the following two:
Code:
section '.data1' data readable writeable
buf rd 800*600
buf2 rd 512*512
buf3 rd 512*512
db 'initialised data here will force all of the above into the exe file'

section '.data2' data readable writeable
db 'initialised data here will allow the below to be removed from the exe file'
buf rd 800*600
buf2 rd 512*512
buf3 rd 512*512    
Post 19 Mar 2012, 09:37
View user's profile Send private message Visit poster's website Reply with quote
bo



Joined: 19 Mar 2012
Posts: 2
bo
Thanks for the quick response revolution. It works perfectly. 3 mb condensed to 3 kb!
Post 19 Mar 2012, 09:57
View user's profile Send private message Reply with quote
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek
Why don't you allocate memory dynamically?
Post 23 Mar 2012, 13:39
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
@bzdashek That works also. Wink
Post 23 Mar 2012, 18:15
View user's profile Send private message Reply with quote
majidkamali1370



Joined: 31 Oct 2010
Posts: 50
Location: Iran
majidkamali1370
How to allocate memory dynamically?
(I use linux x86)
Post 23 Mar 2012, 19:14
View user's profile Send private message Send e-mail Yahoo Messenger ICQ Number Reply with quote
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek
@typdef That's a surprise indeed Wink

@majidkamali1370 here's some information you should probably check (in Linux forum):
http://board.flatassembler.net/topic.php?t=3043
Post 23 Mar 2012, 19:47
View user's profile Send private message Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat
bzdashek wrote:
Why don't you allocate memory dynamically?
Since dynamic allocation is more complicated, it should only be used when there's an actual need for it (generally, when the size of some data structure isn't known ahead of time)
Post 24 Mar 2012, 01:47
View user's profile Send private message Reply with quote
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek
Goplat wrote:
bzdashek wrote:
Why don't you allocate memory dynamically?
Since dynamic allocation is more complicated, it should only be used when there's an actual need for it (generally, when the size of some data structure isn't known ahead of time)

I'll take a note of that, thank you.
Post 24 Mar 2012, 07:50
View user's profile Send private message Reply with quote
badc0de



Joined: 13 Apr 2012
Posts: 15
badc0de
Code:
ada_mo: times 88*88 dd 0    
Post 01 May 2012, 09:58
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 YouTube, Twitter.

Website powered by rwasa.