flat assembler
Message board for the users of flat assembler.

Index > Main > data,import,export sections..

Author
Thread Post new topic Reply to topic
metalfishx



Joined: 30 Sep 2004
Posts: 65
Location: Florida, Uruguay
metalfishx
Hello. Im just wondering, theres a way to let FASM take the section specific code on all the source code, and put it togheter in the same section?
For exmaple, if i do this:

Code:
format PE GUI 4.0
entry MAIN
include "%fasminc%\win32a.inc"

section '.idata' import data readable
  library kernel,'KERNEL32.DLL'
  import kernel,\
         ExitProcess,'ExitProcess'

section '.data' data readable writable
        varStrBuffer rb 65535

section '.code' code readable executable
proc MAIN
      invoke ExitProcess,0
     return
endp
    


i obtain an executable size of 1536
but, if i just add an extra var in other part of the code, but still a data section....

Code:
format PE GUI 4.0
entry MAIN
include "%fasminc%\win32a.inc"


section '.idata' import data readable
  library kernel,'KERNEL32.DLL'
  import kernel,\
         ExitProcess,'ExitProcess'

section '.data' data readable writable
        varStrBuffer rb 65535

section '.code' code readable executable
proc MAIN
     invoke ExitProcess,0
     return
endp

section '.data' data readable writable
        varStr db "hello",0
    


Is supposed taking the result before, this for logic, this can bump i think, 7 bytes right?
Well, with this lite modification, im obtaining an executable of 2550 bytes, more than 1000 bytes.

I think is ussefull if we can use for example, the section definitions in macros for example, and when fasm clean the code, these code that are declared in section are ordered in the correspondent section... in this case, if fasm take the first variable defined, and memorize, and after the last section take the other variable, and memorize them, and at last, after end of the code, declares a section in the exe with all the data... Smile

hehe, maybe im crazy.. but can be good if theres a way to do that Very Happy

Thanks!

_________________
---------------------------------------
Roberto A. Berrospe Machin
Ruta Internet, Florida Uruguay
---------------------------------------
Post 27 Oct 2004, 04:16
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
no, fasm is great because it doesn't do such "smart" "optimizations", what means you always know what will be result. Any time you type "section" you have a new section declared.
Post 27 Oct 2004, 11:05
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
metalfishx



Joined: 30 Sep 2004
Posts: 65
Location: Florida, Uruguay
metalfishx
Yes, you rigth, is more handly.. I just ask because i have thinked about make a basic like language with pure macros; but things like this, limites a little the process.. Now im thinking to build a "front" compiler that will do these corrections.

Thanks for your answer.
Post 29 Oct 2004, 02:46
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.