flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > operand metadata 1 : Error: invalid expression

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 489
Location: Belarus
Below is a working example, where I get error on the 3rd and 4th calls. Cannot understand why this happens. What am I missing? Why does match miss the correct block?

Code:
define op macro call? dest* local operand, size, type, prefixes define operand dest type = 1 match =near? more, dest type = 1 redefine operand more else match =far? more, dest type = 2 redefine operand more end match parse_operands type, operand end macro macro parse_operands t:0, operands*& local operand, size irp ops, operands define operand ops size = 0 match =tbyte? more, ops size = 10 redefine operand more end match parse_operand operand end irp end macro macro parse_operand operand* local m match segment:offset, operand match [addr], offset display 'wrong',13,10 else display 'wrong',13,10 end match else match [addr], operand display 'CORRECT!',13,10 else m = operand metadata 1 display 'wrong',13,10 end match end macro element rax? : 1 call tbyte [rax] call far tbyte [rax] call far [rax] call [rax]
Post 21 Mar 2017, 20:14
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6873
Location: Kraków, Poland
When "parse_operand" receives the symbolic variable as a parameter, this line:
Code:
define operand ops
defines a symbolic variable that contains just the identifier of the one defined by the outer macro (because DEFINE does not evaluate symbolic values). To extract the text from the variable you could just use EQU instead:
Code:
operand equ ops
since EQU does replace symbolic variable with their values (this is just like in fasm 1). Or, alternatively, you could rewrite the entire sequence:
Code:
match =tbyte? more, ops size = 10 redefine operand more else match any, ops size = 0 define operand any end match
Post 21 Mar 2017, 20:29
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


Copyright © 2004-2018, Tomasz Grysztar.

Powered by rwasa.