flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > How about new macro style ?!

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 814
Roman
^mm2 repeat cd1 2 times. cd2 repeat 3 times and cd3 repeat 4 times
Code:
^cd1 mov eax,ebx\add ebx,10\add edx,ebx
^cd2 mov eax,ecx\add ebx,8\add edx,ecx\add edx,ebx
^cd3 mov eax,edx\add edx,6\add ebx,edx
^mm2 cd1:2:-2 cd2:3:1 cd3:4:-1 ;i might using from cd0 to cd99 !
    


This generate code:
Code:
        mov eax,ebx ;cd1
        add ebx,10
        add edx,ebx

        mov eax,ecx ;cd2
        add ebx,8
        add edx,ecx 

        mov eax,edx ;cd3
        add edx,6
        add ebx,edx
;---
        mov eax,ebx ;cd1
        add ebx,8
        add edx,ebx

        mov eax,ecx ;cd2
        add ebx,9
        add edx,ecx 

        mov eax,edx ;cd3
        add edx,5
        add ebx,edx
;---        
        mov eax,ecx ;cd2
        add ebx,10
        add edx,ecx 

        mov eax,edx ;cd3
        add edx,4
        add ebx,edx
;--
        mov eax,edx ;cd3
        add edx,3
        add ebx,edx

    


Last edited by Roman on 22 Aug 2020, 17:48; edited 1 time in total
Post 22 Aug 2020, 17:42
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 814
Roman
Exist somthing to generate like this code in Fasmw 1.73 ?
Post 22 Aug 2020, 17:47
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 814
Roman
Or this:
Code:
^cd1 mov eax,ebx\add ebx,#a 10\add edx,#b ebx
^mm2 cd1:3:-2:1
    

Get code:
Code:
mov eax,ebx ;first rep
add ebx,10
add edx,ebx

mov eax,ebx ;second rep
add ebx,8
add edx,ecx

mov eax,ebx ;3 rep
add ebx,6
add edx,edx
    
Post 22 Aug 2020, 17:53
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 814
Roman
Code:
macro a1 {...} ;usual fasm macro.
macro a2 {...}
macro a3 {...}
macro b1 {...} ;usual fasm macro.
macro b2 {...}
macro b3 {...}
^cd1 mov eax,ebx\add ebx,#a 10\add edx,#b ebx\ a%\imul #b eax,2*%\b$
^mm2 cd1:3:-2:1
    

Get code:
Code:
mov eax,ebx ;first rep
add ebx,10
add edx,ebx
a1
imul eax,2*1
b3

mov eax,ebx ;second rep
add ebx,8
add edx,ecx
a2
imul ebx,2*2
b2

mov eax,ebx ;3 rep
add ebx,6
add edx,edx
a3
imul ecx,2*3
b1
    
Post 22 Aug 2020, 18:06
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 814
Roman
Or swap
Code:
^cd1 mov eax,ebx\add ebx,#a 10\add edx,#b ebx
^mm2 &cd1:3:-2:1
    

Get code:
Code:
mov eax,ebx ;1 rep
add ebx,10
add edx,ebx


add edx,ecx ;2 rep
mov eax,ebx ;
add ebx,8


add ebx,6     ;3 rep
add edx,edx
mov eax,ebx 
    
Post 22 Aug 2020, 19:11
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.