Re: A82: Re: Reeeeeeeeeeeally strange TASM problem!


[Prev][Next][Index][Thread]

Re: A82: Re: Reeeeeeeeeeeally strange TASM problem!




In a message dated 98-07-16 17:31:00 EDT, you write:

> TASM has problems with DEFINE's and IF's, specially if the IF's are nested
>  or you use very long names. If you use something like the following in
>  your program:
>  
>  THIS_IS_A_VERY_LONG_NAME = 10
>  #DEFINE THIS_IS_A_STUPID_MACRO(x) ld A,x
>  
>  THIS_IS_A_STUPID_MACRO(THIS_IS_A_VERY_LONG_NAME)
>  
>  TASM will sometimes interpet this as:
>  
>  THIS_IS_A_STUPID_MACRO(THIS_NAME)

That's weird!  I wonder why it wouldn't interpret it as
THIS_IS_A_STUPID_MACRO(THIS_IS_A) or something like that?

>  
>  The same tihng happens with IF's inside DEFINES, so TASM might see you
>  macro as:
>  
>  #DEFINE fixpt(sign,iPart,fPart) #IF0
>  #DEFCONT  \ iPart*256+(fPart/390625)
>  #DEFCONT  \ #ELSE
>  #DEFCONT  \ %11111111^iPart*256+(1+(fPart/390625))
>  #DEFCONT  \ #ENDIF
>  
>  (since IF0 does not exist it gives you an error, and when there is no IF
>  ENDIF will give another error).
>  
>  The best way to solve the problem is not to use IF's inside defines. Try
>  something like this instead:
>  
>  #DEFINE fixpt(sign,iPart,fPart)
>
sign*(%11111111^iPart*256+(1+(fPart/390625)))+((sign+1)&1)*(iPart*256+(fPart/
> 390625))

I hope that works, it looks mighty complex

>  
>  (sign has to be 0 or 1)
>  
>  Dines
>  

ok, that's fine.  sign will be 0 or 1 anyways, so that's all right
thanks a lot!!!!!!!!

~Adamman

>  -----Original Message-----
>  From: ADAMMAN106@aol.com <ADAMMAN106@aol.com>
>  To: assembly-82@lists.ticalc.org <assembly-82@lists.ticalc.org>
>  Date: 16. juli 1998 21:38
>  Subject: A82: Reeeeeeeeeeeally strange TASM problem
>  
>  
>  >
>  >for some reason, when I try to compile this macro:
>  >
>  >#DEFINE fixpt(sign,iPart,fPart) #IF sign=0
>  >#DEFCONT  \ iPart*256+(fPart/390625)
>  >#DEFCONT  \ #ELSE
>  >#DEFCONT  \ %11111111^iPart*256+(1+(fPart/390625))
>  >#DEFCONT  \ #ENDIF
>  >
>  >using this:
>  >
>  > ld hl, fixpt(0,3,99609375)
>  >
>  >it gives me these errors:
>  >
>  >first pass:
>  >fixpt.asm line 0501: Imbalanced conditional.
>  >Second pass:
>  >fixpt.asm line 0096: Unknown token: (#)
>  >fixpt.asm line 0096: Unknown token.    
>  >fixpt.asm line 0096: Label not found: (IF0)
>  >fixpt.asm line 0096: unrecognized directive.
>  >(3*256+(99609375/390625))
>  >
>  >but when I compile it with this macro:
>  >
>  >#DEFINE fixpt(sign,iPart,fPart) iPart*256+(fPart/390625)
>  >
>  >it works fine (of course it ignores the sign, but that's not the point)
>  >according to tasm.doc, this should work fine (the ^ is binary XOR)
>  >and what's with the "imbalanced conditional" error?  I've never seen it
>  before
>  >(it refers to the .end at the end of the file)
>  >Oh yeah, line 96 is the "ld hl, ..." line
>  >Someone PLEASE tell me what gives
>  >
>  >~Adamman
>  >
>  
>  _______________________________________
>  
>  Dines Justesen
>  Email: dines@post1.com or
>         c958362@student.dtu.dk
>  WWW  : http://www.gbar.dtu.dk/~c958362/
>  _______________________________________