flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > How compare two irpv lists?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 14 Mar 2023, 12:51
Code:
A equ in1
A equ in2 ;many values 35
B equ in1
B equ in2 ;many values 35
C equ call procA
C equ call procB ;many values 35

irpv v, A { compare v with B 
and if equal do C}     


Or something else way compare A with B.
Post 14 Mar 2023, 12:51
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 14 Mar 2023, 14:15
I try this, but doubled c
Code:
AA equ ccc
AA equ ccc3
BB equ ccc
BB equ ccc3
CC equ inc eax
CC equ inc ebx
 

   irpv c, CC    {   urr = 1
   irpv b, AA    \{
   irpv v, BB \\{
 
   if v eq b
       display 'ok;;'
       if urr = 1
       c
       urr = 0
       end if
       end if
   \\}
    \}
    }               
    
Post 14 Mar 2023, 14:15
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4071
Location: vpcmpistri
bitRAKE 14 Mar 2023, 14:30
We have eight copies of the inner branch, and four cases that pass the first if.
Post 14 Mar 2023, 14:30
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 804
Location: Russian Federation, Sochi
ProMiNick 14 Mar 2023, 14:31
Code:
field@struct equ hello
field@struct equ hello2
field2@struct equ hello
field2@struct equ hello2
field3@struct equ hello3
field3@struct equ hello2
irpv fields,field@struct { common define fields@name fields } ; taken from struct macroset
irpv fields,field2@struct { common define fields2@name fields }
irpv fields,field3@struct { common define fields3@name fields }
if fields@name eq fields2@name
        display 'OK',13,10
end if
if fields3@name eq fields2@name
        display 'noOK',13,10
end if
if fields3@name eq fields@name
        display 'noOKtoo',13,10
end if     
Post 14 Mar 2023, 14:31
View user's profile Send private message Send e-mail Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 14 Mar 2023, 14:46
ProMiNick
Your joined all names to one.
And this geting problems with compare different names.

You variant compare
hello,hello2 with hello,hello2

This variant not for my case.
Post 14 Mar 2023, 14:46
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 14 Mar 2023, 14:54
bitRAKE wrote:
We have eight copies of the inner branch, and four cases that pass the first if.

We needed normal irpvs ! And we might compared many lists(More then two).

Then code look like this
Code:
A equ in1
A equ in2 ;many values 35
B equ in1
B equ in2 ;many values 35
C equ call procA
C equ call procB ;many values 35

irpvs x,y,z A B C {
if x eq y
 z
end if
}
    
Post 14 Mar 2023, 14:54
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 14 Mar 2023, 15:08
As I understand, you want to iterate several lists in parallel. You could do that with numbered names:
Code:
struc equs value&
{
  match =.#%, .#% \{ .#% equ 0 \}
  rept 1 i:.#%+1 \{ .#% equ i
                    .\#i equ value \}
}

A equs in1 ; A1 equ 1
A equs in2 ; A2 equ 2
; ...
B equs in1
B equs in2
; ...
C equs call procA
C equs call procB
; ...

; A%, B%, C% are counts of values in each list
rept A% i:1 {
        if A#i eq B#i
                C#i
        end if
}    
Post 14 Mar 2023, 15:08
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 14 Mar 2023, 15:10
Wow !
Shocked

Thanks Tomasz Grysztar.
This is i wanted.
Post 14 Mar 2023, 15:10
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 14 Mar 2023, 17:28
Problem with macro.
Code:
macro attt  { invoke MessageBox,0,0,0,0 }
C equs attt  

rept A% i:1 {
        if A#i eq B#i
                C#i  ;fasm error illegal instruction attt
        end if
}    
Post 14 Mar 2023, 17:28
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1040
Location: Russia
macomics 14 Mar 2023, 17:34
Code:
struc equs value&
{
  match =.#%, .#% \{ .#% equ 0 \}
  rept 1 i:.#%+1 \{ .#% equ i
                    .\#i equ value \}
}
macro invoke [name] {}
macro attt { invoke MessageBox,0,0,0,0 }

A equs in1 ; A1 equ 1
A equs in2 ; A2 equ 2

B equs in1
B equs in2

C equs attt
C equs attt

rept A% i:1 {
    if A#i eq B#i
    match x,C#i \{ x \};fasm error illegal instruction
    end if
}    
Post 14 Mar 2023, 17:34
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 14 Mar 2023, 17:39
macomics
Thanks.
Now work fine.

And work without macro invoke [name] {}
Post 14 Mar 2023, 17:39
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.