flat assembler
Message board for the users of flat assembler.

Index > Main > Virtual Word marker.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1766
Roman 20 Jun 2022, 09:06
Fasmw 1.73
How apply some marker name to virtual?
Expand opportunities virtual.
Code:

Virtual. ;I want apply Word df mean float data
  dd -45.887
  load dword .value at $ - 4
end virtual
    

This good to tell macro what type have this virtual.
Code:
Virtual.df
End virtual
    


I found in fasm docs this
Code:
GDTR dp ?
    virtual at GDTR; how macro might chek name GDTR? 
        GDT_limit dw ?
        GDT_address dd ?
    end virtual

    
Post 20 Jun 2022, 09:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 20 Jun 2022, 10:39
Code:
macro Virtual.df value {
  virtual
    dd value
    load .value dword from $$
  end virtual
}
Virtual.df -45.887
mov eax,.value    
Post 20 Jun 2022, 10:39
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 926
Location: Russia
macomics 20 Jun 2022, 11:34
Roman wrote:

I found in fasm docs this
Code:
GDTR dp ?
    virtual at GDTR; how macro might chek name GDTR? 
        GDT_limit dw ?
        GDT_address dd ?
    end virtual    

Nothing. The programmer adjusts the block described by virtual to the size of the dp type.
Code:
srtruc uint64 val& { . dq val
 label .low dword at .
 label .high dword at . + 4 }
struc gdt_ptr off, lim { label . pword
 .lim dw lim
 .off dd off }    
Post 20 Jun 2022, 11:34
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1766
Roman 20 Jun 2022, 14:56
Quote:

macro Virtual.df value {
virtual
dd value
load .value dword from $$
end virtual
}
Virtual.df -45.887
mov eax,.value

What is the difference compared with equ ? In this macro.
I mean simple write .value EQU -45.887
Post 20 Jun 2022, 14:56
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 20 Jun 2022, 15:00
EQU is just a textual replacement. It doesn't compute anything.
Code:
value equ -45.887
dd_value = dword value
dq_value = qword value
dt_value = tword value    
You don't need virtual for your example. Just use:
Code:
.value = dword -45.887    
Post 20 Jun 2022, 15:00
View user's profile Send private message Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.