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 > irp-macro invalid

Author
Thread Post new topic Reply to topic
l4m2



Joined: 15 Jan 2015
Posts: 605

irp-macro invalid


Code:
irp tydbdwdddq {
  macro ty a, [b] \{
    common
    if `a == 'byte'
      db b
    else if `a == 'word'
      dw b
    else if `a == 'dword'
      dd b
    else if `a == 'qword'
      dq b
    else
      ty a b
    end if
  \}
  macro ty [args] \{
    forward
    match a bargs \\{
      ty ab
    \\}
  \}
}
dd word 34

Post 16 Jul 2016, 04:40
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6685
Location: Kraków, Poland

You need to escape "common", "forward", and "`" too. Otherwise they are processed by the "irp" macro instead of becoming part of the inner ones.

Code:
irp tydbdwdddq {
  macro ty a, [b] \{
    \common
    if \`a = 'byte'
      db b
    else if \`a = 'word'
      dw b
    else if \`a = 'dword'
      dd b
    else if \`a = 'qword'
      dq b
    else
      ty a b
    end if
  \}
  macro ty [args] \{
    \forward
    match a bargs \\{
      ty ab
    \\}
  \}
}

Post 16 Jul 2016, 07:24
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6685
Location: Kraków, Poland

I may also suggest a bit different approach:

Code:
irp tydbdwdddq {
  macro ty [args] \{
      if 0
    match a bargs \\{
      else if a eq byte
        db b
      else if a eq word
        dw b
      else if a eq dword
        dd b
      else if a eq qword
        dq b
    \\}
      else
        ty args
      end if
  \}
}

dd word 34

Post 16 Jul 2016, 08:15
View user's profile Send private message Visit poster's website Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 605

Okay I wanted to make PUSH QWORD 3 compied into PUSH DWORD 3 DWORD 0 but even with the macro seem not so easy
Post 25 Jul 2016, 11:04
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


Powered by phpBB © 2001-2005 phpBB Group.

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