hello everyone
i have this macro whichs declares some texts and aligns it.
STRING MACRO args:VARARG
LOCAL name
.data
name db args,0
align 4
exitm <name>
ENDM
.data
szSomeText = STRING ("Global Text")
szSomeChrs = STRING (39h,17h,33h,24h,74h,4Fh,09h,4Ch,9Eh,88h,90h ...)
I got the following error on szSomeChrs :(
error A2070: invalid instruction operands
shouldn't it be
STRING MACRO args:VARARG
LOCAL name
.data
align 4
name db args,0
exitm <name>
ENDM
same problem :)
Do any of your hex values start with A-F? If so, make sure they start with a 0 - i.e., 0A2h, 0F0h, etc.
none of my hex values start with A-F
but i have replace "=" with "textequ" and it works now
.CODE <***
exitm <name>
ENDM
if i put .code i get an error as well -> "invalid instruction operands"
textequ does the trick :D
The .code does not fix the error - it is just needed.
You should use equ instead of textequ.
Chambao,
The .code and .data directives end the current segment and start a new one. The .code directive would be necessary if the macro were expanded in the code segment. Using the macro to define strings in the data segment provides no real benefit because it requires at least as much typing as would be necessary to define the strings by the normal method for static data. Using the macro to define strings in the code segment would allow you to define the strings in the source at the location where they will be used. See the MASM32 STRING macro (\masm32\macros\MACROS.ASM).
I am not expanding the macro in the code segment, i just want to use them in the data segment.
the only benefit that I am looking for is to be able to align the defined string, so I wont have to type "align 4" for each defined string.
that way all defined string will be just in one part of my code.
Quote from: AeroASM on June 26, 2005, 09:11:47 PM
The .code does not fix the error - it is just needed.
You should use equ instead of textequ.
equ gives me error as well --> "use of register assumed to ERROR"
textequ does the trick :o