The invoke directive

Asmc Macro Assembler

Asmc Macro Assembler Reference

The invoke directive

In Asmc a macro is handled at the same level as a procedure. The header file may then control the expansion:

ifdef __INLINE__
	strlen	macro string
		...
		endm
else
	strlen	proto :dword
endif

This is achieved by simply excluding invoke as appose to allow invocations of macros.

	strlen( esi )

Asmc sees the combination of a procedure followed by an open bracket as invoke. Empty brackets will be given special handling if the token in front is not a macro.

plabel	proto
extern	elabel:dword
	.data
dlabel	label dword
	.code
clabel:
	call	ax
	call	eax
	call	plabel
	call	elabel
	call	dlabel
	call	clabel
	call	xlabel

	ax()
	eax()
	plabel()
	elabel()
	dlabel()
	clabel()
	xlabel()
xlabel:

This simple solution avoids breaking any existing code with a few exceptions: Masm allows brackets to access memory.

	.if edx < foo( 1 )
	; MASM: cmp edx,foo+1
	; ASMC: invoke foo, 1 : cmp edx,eax

So square brackets should be used for accessing memory and round brackets to execute. However, an error must then be issued if Asmc extensions are turned off and labels are accessed using round brackets to ensure compatibility.

The inside of brackets may be recursive used at any length including C-strings. However, the return code for a procedure is [R|E]AX so there is a limit with regards to OR/AND testing of nested functions.

	.if foo( bar( 1 ), 2 ) == TRUE

See Also

Asmc Extensions