I am desperately fighting with MASM macros - may be am too stupid,but here is my question
to a God Of Macros (Bitrake,pleeese :))
here:
what I have:

W equ 0
F equ 1

ADDWF macro f,d:=1
{and here I can not write a string :((}
ENDM

I want to write this:

ADDWF 0x3F,F
ADDWF 0x23
ADDWF 0x11,W

and it should expand to this:
add ,bl

add ,bl

add bl,

I know, this is a simple task for you,but this is important for me,
so please help.
Thank you in advance.
Posted on 2001-09-16 03:42:41 by Yuk
ADDWF MACRO f,d:=<F>

IFIDN <F>,<d>
add [esi + f],bl
ELSEIFIDN <W>,<d>
add bl,[esi + f]
ELSE
.err <ERROR: Incorrect value in ADDWF.>
ENDIF
ENDM

ADDWF 03Fh,F
ADDWF 023h
ADDWF 011h,W
If you must use the C syntax for the hex, then try this:
ADDWF MACRO f,d:=<F>

LOCAL tmp

tmp CATSTR <[esi + 0>,@SubStr(f,3,2),<h]>

IFIDN <F>,<d>
add tmp,bl
ELSEIFIDN <W>,<d>
add bl,tmp
ELSE
.err <ERROR: Incorrect value in ADDWF! >
ENDIF
ENDM

ADDWF 0x3F,F
ADDWF 0x23
ADDWF 0x11,W
Please, read chapter 9 of the manual when you have time, and try to understand how these work.
Enjoy! :cool:
Posted on 2001-09-16 11:05:12 by bitRAKE
Thank you for your help, Bitrake!
It's very important for me ,and now I can build new macros of this type by analogy :)

btw, I deleted double post as you suggested.
Posted on 2001-09-16 13:52:53 by Yuk