flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > [F1] MULTISECTION .code .data .stream (update on first post) Goto page 1, 2, 3, 4 Next |
Author |
|
revolution 21 Jul 2020, 11:30
|
|||
21 Jul 2020, 11:30 |
|
Overclick 21 Jul 2020, 11:36
Seems like idea is to use some sort of different names, but I think we can use files to store all subsections together.
|
|||
21 Jul 2020, 11:36 |
|
Roman 22 Jul 2020, 12:39
Good macro somthing like this:
macro .dll [arg] { section '.idata' import data readable writeable library arg,`arg#'.DLL',\ import_#arg } In code: .dll kernel32,user32,gdi32 |
|||
22 Jul 2020, 12:39 |
|
fasmnewbie 24 Jul 2020, 01:03
Overclick wrote: This is why I like masm -- simple sections, sticked together by compilation. I mean .code .data...Any macro can make parts for sections. What's wrong with fasm? I don't know man, the last time I tried, MASM's '.data' macro still unable to align to 32-byte boundaries. Horrible macro for dealing with YMM data. Had to move down to raw "dseg segment". I hope it is already fixed by now. |
|||
24 Jul 2020, 01:03 |
|
Overclick 30 Jul 2020, 14:01
I did it
Code: macro .multisection entry_file { macro .data \{ end if if current='data' \} macro .idata \{ end if if current='idata' \} macro .code \{ end if if current='code' \} current='idata' section '.idata' import data readable writeable if current='idata' include entry_file end if current='data' section '.data' data readable writeable if current='data' include entry_file end if current='code' section '.text' code readable executable entry $ sub rsp,8 if current='code' include entry_file end if } .multisection 'MyWorkFile.asm' |
|||
30 Jul 2020, 14:01 |
|
Roman 30 Jul 2020, 14:50
How use this ?
What code in MyWorkFile.asm ? |
|||
30 Jul 2020, 14:50 |
|
Overclick 30 Jul 2020, 14:57
Put this macro on header/Main file or include it to there.
Write your program on some separate file then put it there by .multisection '<your program>' |
|||
30 Jul 2020, 14:57 |
|
Overclick 31 Jul 2020, 16:14
Upd: Use it carefully with "fix" where you need it. Declare it before or after multisection.
|
|||
31 Jul 2020, 16:14 |
|
Overclick 07 Aug 2020, 06:26
UPDATED RELEASE :
Code: macro .multisection [entry_file] { common macro proc [param] \{ end if if cuRRent='code' \} macro endp \{ end if if cuRRent='code' \} macro .data \{ end if if cuRRent='data' \} macro .idata \{ end if if cuRRent='idata' \} macro .code \{ end if if cuRRent='code' \} macro .comment \{ end if if cuRRent='comment' \} section '.idata' import data readable writeable cuRRent='idata' forward if cuRRent='idata' include entry_file end if common section '.data' data readable writeable cuRRent='data' forward if cuRRent='data' include entry_file end if common cuRRent='code' purge proc purge endp macro proc [param] \{ \common end if proc param if cuRRent='code' \} macro endp \{ end if endp if cuRRent='code' \} section '.text' code readable executable entry $ sub rsp,8 forward if cuRRent='code' include entry_file end if } FEATURES: 1. Linker. It will combine all your sections in all project files at same time. 2. Proc. You can use multisections inside procedures. 3. Unlimited sections any time you need it. 4. Easy to add some more kind of sections like .rsrc 5. Short names like masm .code .data (up to you actually) 6. No need of .end 7. Comment whole block by .comment Do not use fix inside linked files. Do not declare sections inside if operators. To enjoy it put(include) the macro to Header(Main file) then link your project files by: Code: .multisection '<your project file 1>','<your project file 2>','<your project file n...>' Last edited by Overclick on 09 Sep 2020, 23:45; edited 1 time in total |
|||
07 Aug 2020, 06:26 |
|
Overclick 09 Sep 2020, 23:43
New feature:
.comment Code: macro .comment \{ end if if cuRRent='comment' \} Easiest way to comment whole block of code when you need it. Enjoy |
|||
09 Sep 2020, 23:43 |
|
Overclick 11 Apr 2021, 12:38
New feature:
.dataonce <unique name> Code: macro .dataonce name { end if if name=0 &cuRRent='data' name=1 } Example: Code: dataSomeMacro = 0 ;declare unique name macro SomeMacro [arg] .dataonce dataSomeMacro ;once again Param1 db ? Param2 db ? .code ;finish job by declaring next section. mov [Param1],1 lea arg,[Param2] } SomeMacro rsi ... SomeMacro rdi ... SomeMacro rax Data block will be added to data section just once. No matter how many times you use your macro. Don't try to use multisection blocks inside 'if -end if' constructions, just in main macro body. But you can use 'if - end if' inside that sections as normally do. Have a look to my new macro .function. That one can be used with 'if - and if' without problems. https://board.flatassembler.net/topic.php?t=21847 I tried to hide that ugly unique names for all, but not success. Have to be used with names for a while |
|||
11 Apr 2021, 12:38 |
|
Overclick 05 Apr 2022, 02:11
Release updated, check the first comment
Added .namespace Fixed .dataonce -- no need to declare unique name before macro any more, only next to directive |
|||
05 Apr 2022, 02:11 |
|
macomics 05 Apr 2022, 06:04
Overclick wrote:
Is only `dd` enough? And, in my opinion, when using the argument with &, it is necessary to check for <empty>. Code: struc dd data& { if ~ data eq ... end if } |
|||
05 Apr 2022, 06:04 |
|
Overclick 05 Apr 2022, 13:56
Quote:
empty data gonna generate some error, but why not dd just for demonstration. I created db dw and dq but need to fix proc before release. Some passed values undefined yet. |
|||
05 Apr 2022, 13:56 |
|
Overclick 11 Apr 2022, 09:04
All fixed.
I'll do structures and jumps later |
|||
11 Apr 2022, 09:04 |
|
Overclick 20 Apr 2022, 14:48
How about this? Do you like single line data includes? Even more it works inside labelspaces )
|
||||||||||
20 Apr 2022, 14:48 |
|
Overclick 20 Apr 2022, 15:05
I'm trying to get possible to use subsections inside label-spaces but it woun't. So the solution is a single line data macro only. (Not updated yet)
|
|||
20 Apr 2022, 15:05 |
|
Overclick 20 Apr 2022, 15:20
OMG I fixed that issue too
|
||||||||||
20 Apr 2022, 15:20 |
|
Overclick 21 Apr 2022, 08:53
Anonce:
New superior directives coming soon: .frame <unique name> .stream <unique name> Absolute modular programming. Your may place any data/code to any predefined places. Example: Code: .data ;... somestructure: .stream one .code ;... .stream one .stream two ;... .data ;may be a macros .frame one >>elements of structure or any other data sticked together .code .frame one >>element of code sticked together .frame two ;... .data ;may be macros .frame one >>elements of structure or any other data sticked together .code .frame one >>element of code sticked together You also may stream frames multiply times |
|||
21 Apr 2022, 08:53 |
|
Goto page 1, 2, 3, 4 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.