flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Cgtk
Hello, I need to implement a construction like this using fasm macros:
Code: macros recursion{ random 1, 2; min, max if random_result = 2 recursion end if } How i can do this? |
|||
![]() |
|
Cgtk
Thanks!
|
|||
![]() |
|
Roman
And how use this macro ?
|
|||
![]() |
|
DimonSoft
Roman wrote: And how use this macro ? |
|||
![]() |
|
Cgtk
Hello again, I'm trying to implement a recursion construct like this
Code: macro big_macros{ macro num_1 param1 \{ random 1, 2 if param1 = 1 if randnum = 2 num_2 end if end if \} macro num_2 \{ num_1 0 ; error here \} } start: big_macros The compiler throws the error: "illegal instruction" What is wrong? Last edited by Cgtk on 20 Jul 2020, 10:35; edited 1 time in total |
|||
![]() |
|
DimonSoft
DimonSoft wrote: First of all note that you mix preprocessor and compiler stuff. |
|||
![]() |
|
Cgtk
DimonSoft wrote:
I am writing macros on fasm for the first time and don't know how to do it properly. Could you tell me how you can implement a macro similar in functionality to the macro that I described in the post earlier? |
|||
![]() |
|
revolution
There is a problem here:
Code: marco big_macros{ Also use backslash \ to escape the curly brackets, not forward slash / |
|||
![]() |
|
Cgtk
revolution wrote: There is a problem here: Oh, thank you, fixed the post with the code. Unfortunately this is just my typo in the example and the compiler is not swearing because of this. |
|||
![]() |
|
revolution
Works for me.
Code: 1 passes, 0 bytes. |
|||
![]() |
|
Cgtk
Try to compile this
|
|||||||||||
![]() |
|
DimonSoft
Build your source code with Ctrl+F8 if you use FASMW IDE, then feed the fas-file to PREPSRC tool in the %FASM%\TOOLS\WIN32 directory (easily buildable from the source code). PREPSRC might give you sense of what is going on.
|
|||
![]() |
|
Cgtk
DimonSoft wrote: Build your source code with Ctrl+F8 if you use FASMW IDE, then feed the fas-file to PREPSRC tool in the %FASM%\TOOLS\WIN32 directory (easily buildable from the source code). PREPSRC might give you sense of what is going on. I can't compile my code. The compiler throws the error: "illegal instruction". |
|||
![]() |
|
revolution
Cgtk: Please reduce your code from the 55kB you posted there. Just post the necessary parts showing the problem.
|
|||
![]() |
|
Cgtk
revolution wrote: Cgtk: Please reduce your code from the 55kB you posted there. Just post the necessary parts showing the problem.
|
|||||||||||
![]() |
|
Cgtk
DimonSoft wrote: Build your source code with Ctrl+F8 if you use FASMW IDE, then feed the fas-file to PREPSRC tool in the %FASM%\TOOLS\WIN32 directory (easily buildable from the source code). PREPSRC might give you sense of what is going on. Sorry for a very stupid question, but what should I submit as an input and output file? |
|||
![]() |
|
revolution
There is still a lot of extraneous stuff in there, but the error output shows that you are calling gen_trash_func from within itself.
You need to regenerate the macro within itself if you want to do a recursive call. See the fasm win32ax.inc code for how allow_nesting does it. |
|||
![]() |
|
Cgtk
Thank you, I will definitely look at it.
|
|||
![]() |
|
DimonSoft
Cgtk wrote:
The fas-file you got as the input and any file name as output (it will be a text file with step-by-step explanations of what preprocessor sees and how does it (pre)process it). |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.