flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > inc value in macro

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1769
Roman 28 Feb 2016, 07:22
Code:
v = 1
macro up {
 v = v + 1
mov al,v
}    


I want do up five cycles and get:
mov al,1
mov al,2
mov al,3
mov al,4
mov al,5

How do this ?
Post 28 Feb 2016, 07:22
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1769
Roman 28 Feb 2016, 07:37
and how apply in macro v to string ?
i mean: MessageBox,0,'ok '#`v,0,0

And get text:
'ok 1'
'ok 2'
'ok 3'
'ok 4'
'ok 5'
Post 28 Feb 2016, 07:37
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20303
Location: In your JS exploiting you and your system
revolution 28 Feb 2016, 12:59
Code:
rept 5 v:1 {
 mov al,v
}    
Code:
rept 5 v:1 {
 invoke MessageBox,0,<'ok ',`v>,0,0 
}    
Post 28 Feb 2016, 12:59
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1769
Roman 28 Feb 2016, 13:07
Revolution.
Thanks !
Post 28 Feb 2016, 13:07
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1769
Roman 28 Feb 2016, 13:10
rept good, but if i need :
some code...
macro up
some code...
some code...
macro up
macro up

And get this asm code:
Code:
some code...
mov al,1 ;//this macro up
some code...
some code...
mov al,2 ;//this macro up
some code...
mov al,3 ;//this macro up

    


Last edited by Roman on 28 Feb 2016, 13:13; edited 1 time in total
Post 28 Feb 2016, 13:10
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1769
Roman 28 Feb 2016, 13:11
And i found
Code:
ordinal: count = 0    

But if i want create string i get word 'count' but not count value !
Post 28 Feb 2016, 13:11
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20303
Location: In your JS exploiting you and your system
revolution 28 Feb 2016, 13:25
Your original macro would appear to work fine except that the increment is too early or the initial value should be zero.
Code:
v = 1
macro up {
 mov al,v
 v = v + 1 ;do this last
}    
Code:
v = 1
macro up {
 mov al,v
 v = v + 1
}
;code here
up
;more code
up
;...    
Post 28 Feb 2016, 13:25
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1769
Roman 28 Feb 2016, 14:00
But i cant get string `v.
I get text 'v' but not text-value. How about this ?
Post 28 Feb 2016, 14:00
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1769
Roman 29 Feb 2016, 14:27
O ! Eureka !
I understood how create string from v value Smile
Post 29 Feb 2016, 14:27
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.