flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > [translation help needed] How to convert substr and catstr? |
Author |
|
baldr 18 Jun 2010, 19:28
flat_user,
Preprocessor can't split symbols (AFAIK), but it can join them: Code: macro cipher m { irps reg, a b c d \{ irps half, l h \\{ match =m, reg\\#half \\\{ \\\local .. sub m, '0' cmp m, 10 jb .. sub m, 7 ..: and m, 0Fh \\\} \\} match =m, reg\#x \\{ sub m, '00' irps half, l h \\\{ \\\local .. cmp reg\\\#half, 10 jb .. sub reg\\\#half, 7 ..: \\\} and m, 0F0Fh \\} \} } |
|||
18 Jun 2010, 19:28 |
|
flat_user 19 Jun 2010, 02:59
"Proper backslashing is crucial."
What do you mean by that? Why does it have to be like reg\#x, reg\\\#half, etc.? So it iterates through all registers and when m is equal to ax, it meanwhile has saved the letter 'a' to then append l and h. Thanks, I'm gonna test it, just have to read anew about the match-directive, escaping/concatenating and irp.. |
|||
19 Jun 2010, 02:59 |
|
baldr 19 Jun 2010, 03:28
flat_user,
Number of backslashes before concatenation macro-operator (#) tells at which nesting level it will act. One more, and match directive will try to match macro argument (m) with something like a#x, failing to do that. One less, and you will get literally symbol half (not h or l substituted for it) concatenated with register letter (a, b, c or d), yielding invalid register name like ahalf. |
|||
19 Jun 2010, 03:28 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.