flat assembler
Message board for the users of flat assembler.

Index > Main > Question about conditional if

Author
Thread Post new topic Reply to topic
Fulgurance



Joined: 27 Nov 2017
Posts: 259
Fulgurance
Hello, today I have read into code conditional function with ~ symbol, what is this symbol for fasm?

And I have one other question, when I make for example macro with many arguments, how can I do arg1.arg2 (I want to use arg as label), because when I do #arg1.#arg2,this don't work.

I think it's because just one diese concatenate all, but I don't found the way to do that.
Post 17 Nov 2020, 13:56
View user's profile Send private message Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 259
Fulgurance
Code:
macro UEFI Interface*,Protocol*,Function*,Argument1,Argument2,Argument3,Argument4,Argument5,Argument6,Argument7,Argument8,Argument9,Argument10
{
    ArgumentsNumber = 10
    if Argument10 eq
        ArgumentsNumber = ArgumentsNumber-1
    end if
    if Argument9 eq
        ArgumentsNumber = ArgumentsNumber-1
    end if
    if Argument8 eq
        ArgumentsNumber = ArgumentsNumber-1
    end if
    if Argument7 eq
        ArgumentsNumber = ArgumentsNumber-1
    end if
    if Argument6 eq
        ArgumentsNumber = ArgumentsNumber-1
    end if
    if Argument5 eq
        ArgumentsNumber = ArgumentsNumber-1
    end if
    if Argument4 eq
        ArgumentsNumber = ArgumentsNumber-1
    end if
    if Argument3 eq
        ArgumentsNumber = ArgumentsNumber-1
    end if
    if Argument2 eq
        ArgumentsNumber = ArgumentsNumber-1
    end if
    if Argument1 eq
        ArgumentsNumber = ArgumentsNumber-1
    end if

    mov rdx,[UEFISystemTable]
    
    if ArgumentsNumber > 4
        sub rsp,ArgumentsNumber*8
    else
        sub rsp,0x20
    end if

    mov rbx,[rdx+SystemTable.#Interface]
    mov rax,[rbx+#Protocol.#Function]
    
    if ArgumentsNumber > 0
        mov rcx,Argument1
    end if
    
    if ArgumentsNumber > 1
        mov rdx,Argument2
    end if
    
    if ArgumentsNumber > 2
        mov r8,Argument3
    end if
    
    if ArgumentsNumber > 3
        mov r9,Argument4
    end if
    
    if ArgumentsNumber > 4
        mov qword[rsp + 8*4],Argument5
    end if
    
    if ArgumentsNumber > 5
        mov qword[rsp + 8*5],Argument6
    end if
    
    if ArgumentsNumber > 6
        mov qword[rsp + 8*6],Argument7
    end if
    
    if ArgumentsNumber > 7
        mov qword[rsp + 8*7],Argument8
    end if
    
    if ArgumentsNumber > 8
        mov qword[rsp + 8*8],Argument9
    end if
    
    if ArgumentsNumber > 9
        mov qword[rsp + 8*9],Argument10
    end if
    
    call rax

    if ArgumentsNumber > 4
        add rsp,ArgumentsNumber*8
    else
        add rsp,0x20
    end if
}
    


Look this, I want to assemble this: mov rax,[rbx+#Protocol.#Function]
Post 18 Nov 2020, 17:32
View user's profile Send private message Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 259
Fulgurance
If I do that, it's almost the good result, but assembly put space.... Why?
Code:
mov rax,[rbx+#Protocol\.#Function]    

Result:
UEFI ConOut,SimpleTextOutputProtocol,ClearScreen
UEFI/UEFI.fasm [44] UEFI [42]:
mov rax,[rbx+#Protocol\\.#Function]
processed: mov rax,[rbx+SimpleTextOutputProtocol \.ClearScreen]
error: invalid address.
Post 18 Nov 2020, 17:41
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17892
Location: In your JS exploiting you and your system
revolution
The dot is not a special character.
Code:
mov rax,[rbx+#Protocol#.#Function]    
Post 18 Nov 2020, 22:32
View user's profile Send private message Visit poster's website Reply with quote
Fulgurance



Joined: 27 Nov 2017
Posts: 259
Fulgurance
Oh thanks
Post 20 Nov 2020, 18:35
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.