flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Get value from dd

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 672
Roman
Code:
Zval dd 10,55
Mov eax, [Zval] ;it's ok
    

But how get value to eax, 10?


I know abaut EQU.
But some times not handful EQU.
Code:
Mov eax, magic Zval;= Mov eax, 10
    
Post 10 Feb 2020, 15:23
View user's profile Send private message Reply with quote
sts-q



Joined: 29 Nov 2018
Posts: 32
sts-q
zval = 1055h
zval_location dd zval

mov eax, zval ; eax = 1055h
mov ax, [zval_location] ; ax = 1055h

Rolling Eyes


Last edited by sts-q on 10 Feb 2020, 15:35; edited 1 time in total
Post 10 Feb 2020, 15:33
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17452
Location: In your JS exploiting you and your system
revolution
If you mean the address of Zval then:
Code:
org 0x100
Zval dd 1,2,3,4
mov eax, Zval ;<--- the address, 0x100
mov ebx, [Zval} ;<--- the first value, 1
mov ecx, [eax] ;<--- also the first value, 1    
Post 10 Feb 2020, 15:35
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 672
Roman
Not I mean get value from Zval,
But not Mov eax, [Zval]
Its read from memory slow
I want get to eax 10 from Zval!

Unusual method. And for this need unusual macros!
Post 10 Feb 2020, 16:00
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7750
Location: Kraków, Poland
Tomasz Grysztar
You probably mean this then:
Code:
Zval dd 10,55

load tmp dword from Zval
Mov eax, tmp    
If you switch sections, then you also need addressing space label:
Code:
__DATA::
Zval dd 10,55

; ...in another section:
load tmp dword from __DATA:Zval
Mov eax, tmp    
Note that in fasm 1 you can only LOAD from previously generated data. Forward-referencing LOAD is possible only with fasmg.
Post 10 Feb 2020, 16:06
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 672
Roman
Thanks this is I want.
Post 10 Feb 2020, 16:09
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 672
Roman
What about load tmp peace of code from?
Code:
Lb: Inc ebx
Load tmp lb 
Tmp ; in this place we get Inc ebx
    
Post 10 Feb 2020, 16:34
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7750
Location: Kraków, Poland
Tomasz Grysztar
Roman wrote:
What about load tmp peace of code from?
Code:
Lb: Inc ebx
Load tmp lb 
Tmp ; in this place we get Inc ebx
    
You need to know the size of what you're copying:
Code:
Lb: Inc ebx
Load tmp byte from Lb
db tmp    
In general:
Code:
Lb: Inc ebx
.size = $ - Lb

repeat Lb.size
        Load tmp byte from Lb+%-1
        db tmp
end repeat    
Post 10 Feb 2020, 16:47
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 672
Roman
Amazing and cool!
Thanks.
Post 10 Feb 2020, 17:22
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 YouTube, Twitter.

Website powered by rwasa.