Reputation: 3
I'm trying to write a macro in MASM I have looked over the syntax I've looked online and I've looked in my book. I'm using the same syntax but it keeps giving me an error for either the Macro call itself or the parameter I'm trying to use. I have no clue what's wrong and I feel stupid for asking the stack overflow community but I've run out of options please help. Code below.
; Description: Bit manipulation using macros
;
; Revision date:
INCLUDE Irvine32.inc
.data
number dword 1
.code
main PROC
mReverse number; MAcro call
exit
main ENDP
mReverse MACRO number
local label , count
.data
count dword 7
.code
Wh1le&label:
cmp count, 0
jne Do1&label
jmp endWh1le&label
Do1&label:
rol &number,1
dec count
jmp Wh1le&label
endWh1le&label:
ENDM
END main
Upvotes: 0
Views: 797
Reputation: 14399
When the MASM-preprocessor reaches the line mReverse number; MAcro call
, it doesn't know the "directive" mReverse
because the macro will be defined later. Move the whole mReverse MACRO...ENDM
block to the beginning of the program.
Upvotes: 2