flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [solved] Macro purge and how do set macro to last ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1869
Roman 20 Sep 2024, 19:54
Code:
macro mA r {pop r}        ;1
macro mA r {mov r,edx}    ;2
macro mA r {push r}       ;3

;in code
mA eax
purge mA
mA eax
purge mA
mA eax

;I want set again mA as 3. How do this ?
mA ecx
purge mA
mA ecx
purge mA
mA ecx
    
Post 20 Sep 2024, 19:54
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1869
Roman 20 Sep 2024, 20:12
I do this variant. Work.
Code:
macro mA { macro mA r \{ pop r \}
           macro mA r \{ mov r,edx \}
           macro mA r \{ push r \}
}
macro mA r {pop r}        ;1
macro mA r {mov r,edx}    ;2
macro mA r {push r}       ;3
;in code
mA eax
purge mA
mA eax
purge mA
mA eax
purge mA
mA

mA ecx
purge mA
mA ecx
purge mA
mA ecx
purge mA
mA          
    
Post 20 Sep 2024, 20:12
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1051
Location: Russia
macomics 21 Sep 2024, 02:18
Code:
macro SetMA { macro mA r \{ pop r \}
           macro mA r \{ mov r,edx \}
           macro mA r \{ push r \}
}

SetMA
mA eax
purge mA
mA eax
purge mA
mA eax
purge mA

SetMA
mA ecx
purge mA
mA ecx
purge mA
mA ecx
purge mA    


Code:
$ hexdump -C /tmp/test.bin
00000000  50 89 d0 58 51 89 d1 59                           |P..XQ..Y|    
Post 21 Sep 2024, 02:18
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1869
Roman 21 Sep 2024, 02:48
I do this variant too.
But this variant more useful and flexible. No needed do all times purge and SetmA.
Code:
macro mA1 r {pop r}       
macro mA2 r {mov r,edx}   
macro mA3 r {push r}     
;in code
rept 3 n:1 { reverse ;and support reversing !
        mA#n edi
        call dword [edx+n*4-4]
        } 
 mA2 eax
    
Post 21 Sep 2024, 02:48
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.