flat assembler
Message board for the users of flat assembler.

 Index > Macroinstructions > Get value from dd
Author
Roman

Joined: 21 Apr 2012
Posts: 813
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
```
10 Feb 2020, 15:23
sts-q

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

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

Last edited by sts-q on 10 Feb 2020, 15:35; edited 1 time in total
10 Feb 2020, 15:33
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17621
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    ```
10 Feb 2020, 15:35
Roman

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

Unusual method. And for this need unusual macros!
10 Feb 2020, 16:00
Tomasz Grysztar

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

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

; ...in another section:
Mov eax, tmp    ```
Note that in fasm 1 you can only LOAD from previously generated data. Forward-referencing LOAD is possible only with fasmg.
10 Feb 2020, 16:06
Roman

Joined: 21 Apr 2012
Posts: 813
Roman
Thanks this is I want.
10 Feb 2020, 16:09
Roman

Joined: 21 Apr 2012
Posts: 813
Roman
Code:
```Lb: Inc ebx
Tmp ; in this place we get Inc ebx
```
10 Feb 2020, 16:34
Tomasz Grysztar

Joined: 16 Jun 2003
Posts: 7781
Location: Kraków, Poland
Tomasz Grysztar
Roman wrote:
Code:
```Lb: Inc ebx
Tmp ; in this place we get Inc ebx
```
You need to know the size of what you're copying:
Code:
```Lb: Inc ebx
db tmp    ```
In general:
Code:
```Lb: Inc ebx
.size = \$ - Lb

repeat Lb.size
db tmp
end repeat    ```
10 Feb 2020, 16:47
Roman

Joined: 21 Apr 2012
Posts: 813
Roman
Amazing and cool!
Thanks.
10 Feb 2020, 17:22
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum