flat assembler
Message board for the users of flat assembler.

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

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1885
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
Post 20 Mar 2023, 10:33
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20563
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.
Post 20 Mar 2023, 10:43
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1885
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
    
Post 20 Mar 2023, 10:50
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1885
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
    
Post 20 Mar 2023, 12:05
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1885
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
    
Post 20 Mar 2023, 13:18
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.