flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
BAiC
I am using the 'defined' operator/command (with the ~ operator) to conditionally initialize the first of potentially many variable-style labels.
when only one variable is defined then FASM doesn't register its' presence. this macro starts the code: .init.firstCallb is a unique, forward-referenced variable that is defined in the second macro (indeed all 4 labels are defined in the second macro) Code: macro ORB.Fx.Header dot { ali 12, 16 dw (dot # .end.code - dot)/8 dw dot # .init.firstCallb - dot dw dot # .lastCall - dot dw dot # .function - dot } this is the segment of code that declares the only '.init' and therefore the only '.init.firstCall': Code: mov r9d, Color.white cal m.base.2to10l, .init the following is the macro that reads the non-existant '.init.firstCall' and generates the unique '.init.firstCallb' variable. Code: macro ORB.Fx.Footer dot { if ~defined dot # .init.firstCall dot # .init.firstCallb = dot dot # .lastCall = dot else dot # .init.firstCallb = dot # .init.firstCall dot # .lastCall = dot # .init end if dot # .function = dot # .f virtual at $ rali dot, line dot # .end.code: end virtual } finally; this is the definition of the described "cal" macro. Code: macro cal dst, lab;lab is the '.init' in 'cal m.base.2to10l, .init' { if lab eq call dst else if ~ defined lab db 0xE8 ; the op code for CALL rel32 lab = $ ; .init lab # .firstCall = $ ; generating .init.firstCall dd ((dst) and (1 shl (32-bits.ll) - 1)) } I omitted the rest of the "cal" macro in the post. the full macro for "cal" begins on line 419 of 'PseudoInstructions.asm' in the set of files I'll upload next.
_________________ byte me. |
|||||||||||
![]() |
|
revolution
|
|||
![]() |
|
BAiC
revolution:both of your examples involve FASM being incapable of generating the code at all... FASM successfully generates the code I've provided.
_________________ byte me. |
|||
![]() |
|
revolution
BAiC wrote: revolution:both of your examples involve FASM being incapable of generating the code at all... |
|||
![]() |
|
l_inc
BAiC
Quote:
You should clearly understand, that the only situation this condition can be true is when the label lab is defined somewhere below this condition. And that happens exactly when you use the macro cal more than once. |
|||
![]() |
|
BAiC
l_inc: it's easy to say something is obvious after the result is clearly visible.
|
|||
![]() |
|
l_inc
BAiC
I answered, because you asked a question and you didn't show, that you got an answer and understood your mistake. Your question was still open and there was no "after". |
|||
![]() |
|
BAiC
l_inc: regardless of your intentions the words you used did not describe anything new.
|
|||
![]() |
|
l_inc
BAiC
You asked for an explanation of a situation you experienced. I gave it. If the explanation wasn't new for you, you shouldn't have asked. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.