flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Roman 07 Dec 2021, 13:58
Quote:
If smacto. Do fields in smacto : Data,Initialize,code,procs,destroy More excellent variant. Field Data auto place in section data or section '.bss' For example smacto A copy data to smacto B data. Quote: A::B 5,4 Mean copy from five element four elements. Last edited by Roman on 08 Dec 2021, 03:52; edited 1 time in total |
|||
![]() |
|
macomics 07 Dec 2021, 17:56
DimonSoft wrote:
Code: ; Once for any other structure macro That struct*, params& { local ..a ..a struct params } struc Foo params& { ; All stuff goes here ... } struc Foo1 par*, arg& { ; All stuff goes here ... } struc Foo2 { ; All stuff goes here ... } That Foo arg0, arg1, arg2, "str" That Foo arg3, arg1, arg4, "new" That Foo1 arg5, arg6 That Foo2 add: Code: times 5 That Foo arg0, $, arg1+% Last edited by macomics on 09 Dec 2021, 19:31; edited 1 time in total |
|||
![]() |
|
Roman 09 Dec 2021, 03:54
macomics
And how using this? And how run Function in struct? And what mean All stuff goes here? Please give more concrete info. |
|||
![]() |
|
macomics 09 Dec 2021, 05:33
Roman wrote: macomics DimonSoft wrote: The idea is that I sometimes want to have a more readable and flexible way for defining complex data but I definitely don’t want to repeat myself twice, so the “fake” label is a way to go. While the macro is pretty small, it still is boilerplate and gets quite annoying soon. Code: That Foo arg1 ; macro That struct*="Foo arg1", params&="" { ; local ..label ; ..label Foo arg1, } ; struc Foo params&="arg1," { . db arg1, } ;<- incorrect ; struc Foo params&="arg1," { label . ; match any, arg1, \{ db arg1 \} } ; <- correct ; OR That Foo, arg1 ; macro That struct*="Foo", params&="arg1" { ; local ..label ; ..label Foo arg1 } ; struc Foo params&="arg1" { . db arg1 } ;<- correct ; struc Foo params&="arg1" { label . ; match any, arg1 \{ db arg1 \} } ; <- correct ; OR macro That struct*, params& { local ..label match any, params \{ common ..label struct, params \} match , params \{ ..label struct \} } ADD: More examples: Code: struc STRA txt& { . db .Length, txt .Length = $ - . - 1 db 0 .Bytes = $ - . } TextBlock STRA "Text text text", 13, 10 That STRA "More text, second string", 13, 10 That STRA "One more string", 13, 10, 0 ; TextBlock db 16, "Text text text", 13, 10, 0, 26, "More text, second string", 13, 10, 0, 17, "One more string", 13, 10, 0, 0 |
|||
![]() |
|
Roman 09 Dec 2021, 14:50
macomics
You example not useful. This easy write another way and not use macro that. And I don't understand yet why we need use macro that(for struct) in your example ? Quote: Where did you see function calls in the examples? I propose put functions in struct. Do struct more like a class. We talk about smacto. |
|||
![]() |
|
macomics 09 Dec 2021, 15:54
Roman wrote: And I don't understand yet why we need use macro that(for struct) in your example ? Read: DimonSoft wrote: I often find myself writing something like Roman wrote: I propose put functions in struct. Do struct more like a class. ADD: Although I noticed that you use the word struct - so what prevents you from modifying your implementation of this macro for Windows by adding to it the ability to add data to sections. I would like to see from you an example of using the concurrent definition of struc and macro with the same names, where you can't do without it. |
|||
![]() |
|
Roman 10 Dec 2021, 05:45
I mean more cool features for struc.
For example struc have pointer procs tab and pointer to texts and data and state flags. Run first proc from this struc and get New thread. Thread run automaticly all next procs this struc. We get more easy, flexible way and more powerful struc. Because modern Cpu have many cores. Now 8 cores for Cpu its usual things. |
|||
![]() |
|
macomics 10 Dec 2021, 14:02
Repeat: Maybe then we'll go directly to writing in C#.
Roman wrote: For example struc have pointer procs tab and pointer to texts and data and state flags. Roman wrote: Run first proc from this struc and get New thread. Everything that you have described does not require an additional directive for yourself. It is quite possible to implement this using macro instructions/programs for a specific format/operating system. Although all these features mainly appear in multiplatform mechanisms in high-level languages. |
|||
![]() |
|
Overclick 01 Feb 2022, 11:53
Code: .code macro smacto arg& { struc arg macro arg } smacto FUN { db 5 } FUN forr FUN |
|||
![]() |
|
Furs 01 Feb 2022, 18:50
Overclick wrote:
|
|||
![]() |
|
Overclick 01 Feb 2022, 21:38
Quote:
Idea is to define macro and struc at once by same name (FUN). My example works with single lined body, but it can call another macros where needed. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.