flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > match inside struc |
Author |
|
revolution 31 Jul 2020, 11:28
match can't work with partial strings. You would need a separator of some type, like a space, or a comma.
You can work the other way, just pass the final part of the name to the structure and build the full name inside. Code: struc my_struc suffix { IDC_#suffix dw 0 } |
|||
31 Jul 2020, 11:28 |
|
Overclick 31 Jul 2020, 11:41
what about
match a=_b,. { .addr dq b} |
|||
31 Jul 2020, 11:41 |
|
revolution 31 Jul 2020, 11:45
The underscore is not a separator character. So, no, it won't work.
We can see in the source code TABLES.INC Code: symbol_characters db 27 db 9,0Ah,0Dh,1Ah,20h,'+-/*=<>()[]{}:,|&~#`;\' |
|||
31 Jul 2020, 11:45 |
|
Overclick 31 Jul 2020, 12:14
Code: match a_b, . \{ .addr dd b\} It's trying something processed: test_3.addr dd b error: undefined symbol 'b'. It identified first part of condition, otherwise it's ignore match at all |
|||
31 Jul 2020, 12:14 |
|
revolution 31 Jul 2020, 12:16
All that does is define "a_b" to the value "."
|
|||
31 Jul 2020, 12:16 |
|
Overclick 31 Jul 2020, 12:40
Can I use macro processor to get interesting part of name?
Guess I can |
|||
31 Jul 2020, 12:40 |
|
revolution 31 Jul 2020, 12:43
You can't use the preprocessor to split strings. There is no code in fasm to do that. You always need one of the separator characters.
|
|||
31 Jul 2020, 12:43 |
|
Overclick 31 Jul 2020, 13:49
Hmm, nope
Code: struc my_equ [somedata] { common . equ somedata .id dd 0 local ..string, ..length virtual at 0 ..string:: db `. ..length = $ end virtual separ=0 while % <= ..length load b_1 byte from ..string: (%-1) if separ=1 namefinish=namefinish shl 8 + b_1 end if if b_1 = '_' separ=1 namefinish='' end if end while if separ=0 .addr dq 0 else .addr dq namefinish end if } |
|||
31 Jul 2020, 13:49 |
|
revolution 31 Jul 2020, 13:55
That mixes the assembler with the preprocessor.
You also can't construct label names with the assembler. There is no code in fasm to do that either. |
|||
31 Jul 2020, 13:55 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.