flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > equ & irpv how reset ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1952
Roman 04 Jun 2025, 09:22
fasmw 1.73
Code:
rr equ 1
rr equ 2
rr equ 3

irpv v,rr { add eax,rr } ;get 3 asm commands 

;how reset all rr ? Its only one  way clear do restore ?

rr equ ecx
rr equ ebx

irpv v,rr { add eax,rr };get 2 asm commands

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


Joined: 24 Aug 2004
Posts: 20659
Location: In your JS exploiting you and your system
revolution 04 Jun 2025, 09:32
Firstly the code needs to use v in the irpv block.

To back out of an equ use restore
Code:
rr equ 1
rr equ 2
rr equ 3

irpv v,rr { display `v,10 } ;get 3 asm commands 

;how reset all rr ? Its only one  way clear do purge ?
irpv x,rr { restore rr }

rr equ ecx
rr equ ebx

irpv v,rr { display `v,10 };get 2 asm commands    
Code:
flat assembler  version 1.73.31  (16384 kilobytes memory)
1
2
3
ecx
ebx
1 passes, 0 bytes.    
Post 04 Jun 2025, 09:32
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1952
Roman 04 Jun 2025, 09:41
I try this variant:
Code:
r1 equ edx
r1 equ ecx

r2 equ 1
r2 equ 2
r2 equ 3
tt equ r2
irpv v,tt { add eax,v } ; I get one command add eax,3. But I expected get three asm commands.

tt equ r1
irpv v,tt { add eax,v } ; I get one command add eax,ecx

    

I write neq macro
Code:
macro neq n,s {
       irpv v ,n \{ restore n \}
       irpv x ,s \{ n equ x \}
} 
macro getneq e,n,b {  mm =1
irpv v ,e \{ 
     if mm = n
     b , v
     end if
     mm = mm+1
\} } 
macro pushneq e,[n] {  mm =1
irpv v ,e \{
     if mm = n
     push v
     end if
     mm = mm+1
\} }
macro popneq e,[n] {  mm =1
irpv v ,e \{ 
     if mm = n
     pop v
     end if
     mm = mm+1
\} }
macro irp_ n,e='0' { irpv v ,rr \{ if e eq '0'
n
end if
 if ~ e  eq '0'
n,e
end if
\}}
;in code
         rr1 equ 1
         rr1 equ 16
         rr1 equ 32

         rr2 equ ecx
         rr2 equ edx
         getneq rr1,2,add edx
         neq rr,rr1
         irpv v ,rr {add eax,v }

         neq rr,rr2
         irp_  sub eax,v
         irp_  inc v             
    
Post 04 Jun 2025, 09:41
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.