flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Can't get % to work |
Author |
|
LocoDelAssembly 19 Aug 2009, 19:39
You'll need to do the following change:
Code: macro hashtable_define2 hashtable, size { rept size i\{ list_define hashlist_#hashtable\#i \} } % is available in assembler stage but you need to create symbols so you need preprocessor stage. |
|||
19 Aug 2009, 19:39 |
|
Plue 19 Aug 2009, 19:43
Ok, thanks.
Another question: how can I check whether a macro parameter was passed or not (I think I want assembly stage here)? |
|||
19 Aug 2009, 19:43 |
|
LocoDelAssembly 19 Aug 2009, 19:52
Code: macro wasPassed arg { local passed passed equ match any, arg \{ display "Something was passed!", 13, 10 passed equ 1 \} match ,passed \{ display "Nothing was passed...", 13, 10 \} } ; Tests wasPassed alfa-beta-gamma wasPassed |
|||
19 Aug 2009, 19:52 |
|
Plue 20 Aug 2009, 08:43
Thank you!
|
|||
20 Aug 2009, 08:43 |
|
Plue 20 Aug 2009, 09:49
Is there any reason why I can't use match ,arg directly (instead of using passed)?
|
|||
20 Aug 2009, 09:49 |
|
LocoDelAssembly 20 Aug 2009, 18:41
No reason, my answer simulated an "If passed/Else" instead of an "If passed/If not passed"
|
|||
20 Aug 2009, 18:41 |
|
Plue 21 Aug 2009, 09:19
Is it not possible to create a new macro inside a macro?
Code: macro hashtable_define table, size { if (size and (size-1)) <> 0 __ error: size must be a power of 2 end if macro hash_#table reg \{ ; doesn't seem to work and reg, size - 1 \} } |
|||
21 Aug 2009, 09:19 |
|
revolution 21 Aug 2009, 09:29
Works for me:
Code: macro hashtable_define table, size { if (size and (size-1)) <> 0 __ error: size must be a power of 2 end if macro hash_#table reg \{ and reg, size - 1 \} } hashtable_define testing,8 hash_testing eax |
|||
21 Aug 2009, 09:29 |
|
Plue 21 Aug 2009, 18:08
Thanks for testing it. It seems like it won't work when the invokation of hashtable_define is placed after the invokation of hash_testing.
|
|||
21 Aug 2009, 18:08 |
|
revolution 21 Aug 2009, 22:29
Plue wrote: Thanks for testing it. It seems like it won't work when the invokation of hashtable_define is placed after the invokation of hash_testing. |
|||
21 Aug 2009, 22:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.