flat assembler
Message board for the users of flat assembler.

 Index > Macroinstructions > [Solved]macro for equ values problem.
Author
 Thread
Roman

Joined: 21 Apr 2012
Posts: 1370
Roman 20 Mar 2023, 10:33
Fasm 1.73
Code:
```macro vequ a,[p] {
ii equ 1
forward
a#.ii equ p
display a#.ii;This show eax. But how show oo.1 or oo.2 ? Or what name created ?
ii equ ii + 1
display ii+48 ; show 2,3,4,5
}
;i want get oo.1 equ eax.   oo.2 equ ebx   oo.3 equ ecx
vequ    oo,eax,ebx,ecx,edx

mov     edx,oo.2                  ;fasm error undefined symbol oo.2
```

Last edited by Roman on 20 Mar 2023, 16:14; edited 5 times in total
20 Mar 2023, 10:33
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 19256
Location: In your JS exploiting you and your system
revolution 20 Mar 2023, 10:43
Use rept
Code:
`rept 1 x:ii+1 { ii equ x }    `
When you use equ like you end up with ii+1+1+1+1+1+1. It just keeps appending "+1" each time.
20 Mar 2023, 10:43
Roman

Joined: 21 Apr 2012
Posts: 1370
Roman 20 Mar 2023, 10:50
I not understood, how rept help me get oo.1,oo.2,oo.3 ?

I try this.
Code:
```macro vequ a,[p] {
ii equ 0
forward
rept 1 x:ii+1 \{ ii equ \x \}
a#ii equ p
display a#.\#ii ; show oo.#1 and fasm error

}
```

Sometimes fasm logic not clear.
And driving me crazy.

Its right ?
Code:
```macro vequ a,[p] {
ii equ 0
forward
rept 1 x:ii+1 \{ ii equ x \}
a#.#\ii equ p      ;must do oo.1 then oo.2 then oo.3 or not ?
}
vequ    oo,eax,ebx,ecx,edx
```
20 Mar 2023, 10:50
Roman

Joined: 21 Apr 2012
Posts: 1370
Roman 20 Mar 2023, 12:05
Code:
```;This work fine.
rept 3 n:1 { oo.#n equ n }
mov     edx,oo.2  ;no error. Compiled ok.

;But this error
macro vequ a,[p] {
ii equ 0
forward
rept 1 x:ii+1 \{ ii equ x
a#.\\#ii   equ p           ;This fasm error oo.#1 equ eax
a#.\#ii  equ p ;This ok. But in code error mov edx,oo.2 undefined oo.2
\}
}
vequ    oo,eax,ebx,ecx,edx
mov     edx,oo.2 ;error  undefined oo.2
```
20 Mar 2023, 12:05
Roman

Joined: 21 Apr 2012
Posts: 1370
Roman 20 Mar 2023, 13:18
F..ck. Fasm abracadabra.
I do this !
Code:
```macro vequ a,[p] {
ii equ 0
forward
rept 1 x:ii+1 \{ ii equ x
a#.\#x  equ p
\}
}

vequ    oo,eax,ebx,ecx,edx

mov     edx,oo.2 ; no error. Get mov edx,ebx
```
20 Mar 2023, 13:18
 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

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

Website powered by rwasa.