flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [BUG] Macro doesn't always pass arguments

Author
Thread Post new topic Reply to topic
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend 12 Oct 2005, 20:42
I noticed that my macro doesn't pass arguments to the macro body as it should. Here's the macro and code:
Code:
 macro vmi_mov op1, arg2 {
  db 00h
  if arg2 > 16 ; error should be pointed here
   if op1 > 7
    db 1
    dq arg2
   else
    db 2
    db (op1 shl 4) or arg2 ; fasmw shows error here 'db(8 shl 4)or 100.0' Error: Invalid name
   end if
  else if arg2 = -1 | arg2 = -2
   db 3
   db op1
   db arg2
  else
   db 4
   db op1
   if op1 < 4
    dd arg2
   else
    dq arg2
   end if
  end if
 end if }

        vmi_mov 8, 100.0    
Error should be pointed before because when for example I created new asm file and put there:
Code:
if 100.0 < 16    
The error was pointed there and showing 'Error: Extra characters on line'
Post 12 Oct 2005, 20:42
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 12 Oct 2005, 21:57
The "db(8 shl 4)or 100.0" error is detected at the parsing stage, which is before the actual assembly (when the errors like "if 100.0 > 16" are detected).

In general, do not rely that errors will be detected exactly in the order they occur in source. The other example are the "recoverable" errors, like the negative counts for data reservations of repeats, which are not signaled during the intermediate passes, since the bad values may become valid after the code get resolved better (see section 2.2.5 in manual), in opposite to "unrecoverable" errors, like the syntax ones.
Post 12 Oct 2005, 21:57
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 © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.