flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Define symbolic constants with sequential number in name |
Author |
|
Tomasz Grysztar 25 Dec 2020, 17:33
Code: define DEFCNT 0 macro def val { rept 1 current:DEFCNT, next:DEFCNT+1 \{ define _var\#current val define DEFCNT next \} } |
|||
25 Dec 2020, 17:33 |
|
Jin X 25 Dec 2020, 18:03
Thanks!
|
|||
25 Dec 2020, 18:03 |
|
Jin X 02 Jan 2021, 22:38
Is there more simple way for access to complex names than this 3-level rept-structure?
Code: cur_set equ 0 const0_num equ 3 const0_val0 equ 1.0 const0_val1 equ 1.5 const0_val2 equ 3.14 macro def { rept 1 set:cur_set \{ rept const\#set\#_num % \\{ rept 1 n:%-1 \\\{ ; to start from 0 dd const\\\#set\\\#_val\\\#n \\\} ; rept \\} ; rept \} ; rept } |
|||
02 Jan 2021, 22:38 |
|
revolution 02 Jan 2021, 22:41
A simpler way would be to replace equ with dd, and delete the macro.
|
|||
02 Jan 2021, 22:41 |
|
Jin X 02 Jan 2021, 22:46
All these equ's are generated by another macro. So it's not a good idea |
|||
02 Jan 2021, 22:46 |
|
revolution 02 Jan 2021, 22:48
Instead of equ use dd. I was serious. Don't generate equates in the macro. Build a macro that places dd.
ETA: See here for building lists: https://board.flatassembler.net/topic.php?t=12012 |
|||
02 Jan 2021, 22:48 |
|
Jin X 02 Jan 2021, 23:09
I want to declare aliases (names) for numbers.
I will refer to them by names in macro A and define (place to code) in macro B. So I need names anyway, I can't just place dd without names... Moreover I need arrays of numbers |
|||
02 Jan 2021, 23:09 |
|
revolution 02 Jan 2021, 23:17
The names are part of the dd.
Code: name_1 dd 2.718281828 |
|||
02 Jan 2021, 23:17 |
|
Jin X 02 Jan 2021, 23:24
I know but I need to generate these names...
E.g. I want to be able to use both numeric and symbolic names (just 7.0 or seven), so I need prefixes (for numbers). And I want to be able to use the same names for different arrays. But I'll thinks about simplification of this, thanks |
|||
02 Jan 2021, 23:24 |
|
revolution 02 Jan 2021, 23:28
You can't use numeric values as names:
Code: name_4e-3 equ 4e-3 ; this can't work |
|||
02 Jan 2021, 23:28 |
|
DimonSoft 03 Jan 2021, 12:12
I guess, a valid reason to avoid simply generating dd instead of equ’s is to be able to push such values as immediates with stdcall-like calling conventions. Referring to data in memory is less efficient in such cases, so, having both (if used for dd declarations) might have sense.
|
|||
03 Jan 2021, 12:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.