flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Postpone to specific section

Author
Thread Post new topic Reply to topic
3D_FASM



Joined: 11 May 2023
Posts: 24
3D_FASM 23 May 2023, 08:50
By default, postpone adds code to the end of the file. Is it possible to postpone to the end of the specified section, and not the end of file?

like:

postpone '.code' {
...
}
Post 23 May 2023, 08:50
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20298
Location: In your JS exploiting you and your system
revolution 23 May 2023, 09:02
Postpone doesn't know about sections.

An option is to make a named macro.
Code:
;...
section 'code' ...

macro after_code {
 ;...
}

 mov eax,0x1234
;...

after_code
;...    
Post 23 May 2023, 09:02
View user's profile Send private message Visit poster's website Reply with quote
3D_FASM



Joined: 11 May 2023
Posts: 24
3D_FASM 23 May 2023, 09:15
Yes, but there is a problem... how to find or put label to the end of the .code section automatically...
Post 23 May 2023, 09:15
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 926
Location: Russia
macomics 23 May 2023, 10:21
Code:
; header
macro end_of_section {} ; start end_of_section
postpone { end_of_section } ; last end_of_section
macro section args& { end_of_section ; previous end_of_section
section args
macro end_of_section \{ \}} ; new end_of_section

; main code
section '.text' readable executable
macro end_of_section { end_of_section ; recursive call
    invoke ExitProcess, 0 }
entry $
section '.rsrc' data readable resource from 'rsrc.res'    
Post 23 May 2023, 10:21
View user's profile Send private message Reply with quote
3D_FASM



Joined: 11 May 2023
Posts: 24
3D_FASM 23 May 2023, 21:34
Not bad
Post 23 May 2023, 21:34
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.