flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Macroinstructions > Basic / Newbie question about irp (+similar irps, irpv)

Author
Thread Post new topic Reply to topic
fabbel



Joined: 30 Oct 2012
Posts: 3
Basic / Newbie question about irp (+similar irps, irpv)
Hello

Can someone pls help in understanding why this does not iterate :

Code:
-----
list equ 'X','Y','Z'

display "list=", list, 0Dh, 0Ah
irp item, list {display item,"-",0Dh, 0Ah}
-----


=> this displays :
list=XYZ
XYZ-

so 1st line with display directive looks to view 'list' symbols as a list of comma separated arguments,
but second line using irp looks to fail.


I expected to get output as follows :
list=XYZ
X- <followed by newline>
Y- <followed by newline>
Z- <followed by newline>


What am i doing wrong ? what am i missing ?
Can u pls help / advise about the best way to iterate such 'list' symbol, processing individual item one at a time.
wud other macro directives be more suited to the task ==> irps and/or irpv maybe ?
I've read the manual but somehow can't figure it out.. could someone pls kindly
(re)explain/clarify the differences betw. those and how to use them.

Sorry for the newbie questions...

Thx
Post 21 Nov 2017, 16:22
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15301
Location: Bigweld Industries
IRP doesn't evaluate symbolic equates for the second operand. You can use MATCH to translate:

Code:
match x,list {
        irp itemx \{display item,"-",0Dh0Ah \}
}

Post 21 Nov 2017, 16:40
View user's profile Send private message Visit poster's website Reply with quote
fabbel



Joined: 30 Oct 2012
Posts: 3
Hello

Thx revolution for the quick answer.

What about using irps and / or iprv (for me to get idea of situations where one of those may be preferred over the others..) ?
Post 21 Nov 2017, 17:14
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15301
Location: Bigweld Industries
IRPS is a symbol version of IRP so each symbol is iterated including commas, whereas IRP uses commas as a separator. Try this:

Code:
irp xfoo,bar {display `x,13,10}
display '------------------------------',13,10
irps xfoo,bar {display `x,13,10}

IRPV is different though. It is used to iterate through overloaded equates. Try this:

Code:
y equ 1
y equ 2
y equ 3
irpv xy {display `x,13,10}

Post 21 Nov 2017, 17:34
View user's profile Send private message Visit poster's website 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.