Skip to content

Latest commit

 

History

History
118 lines (98 loc) · 7.9 KB

readme.md

File metadata and controls

118 lines (98 loc) · 7.9 KB

Asmc Macro Assembler Reference

Symbols Reference

Predefined macros

The Asmc assembler predefines certain preprocessor macros depending on the target and the chosen assembler options.

macros

The macros listed in the following table.

Macros Meaning
__ASMC__ Defined as an integer literal that represents the version of Asmc. This macro is always defined.
__ASMC64__ Defined as an integer literal that represents the version of Asmc64. This macro is defined by ASMC64.EXE.
__AVX__ Defined as 1 when the /arch:AVX, /arch:AVX2, or /arch:AVX512 options are set. Otherwise, undefined.
__AVX2__ Defined as 1 when the /arch:AVX2, or /arch:AVX512 options are set. Otherwise, undefined.
__AVX512BW__ Defined as 1 when the /arch:AVX512 option is set. Otherwise, undefined.
__AVX512CD__ Defined as 1 when the /arch:AVX512 option is set. Otherwise, undefined.
__AVX512DQ__ Defined as 1 when the /arch:AVX512 option is set. Otherwise, undefined.
__AVX512F__ Defined as 1 when the /arch:AVX512 option is set. Otherwise, undefined.
__AVX512VL__ Defined as 1 when the /arch:AVX512 option is set. Otherwise, undefined.
__COMPACT__ Defined as 1 when the /mc option is set. Otherwise, undefined.
__DEBUG__ Defined as 1 when the /Zi option is set. Otherwise, undefined.
__FLAT__ Defined as 1 when the /mf option is set. Otherwise, undefined.
__GUI__ Defined as 1 when the /gui option is set. Otherwise, undefined.
__HUGE__ Defined as 1 when the /mh option is set. Otherwise, undefined.
__JWASM__ Defined as an integer literal value 212 that represents the compatible version of JWasm. This macro is always defined.
__LARGE__ Defined as 1 when the /ml option is set. Otherwise, undefined.
_LINUX Defined as 1 when the /elf option is set and 2 when the /elf64 option is set. Otherwise, undefined.
__MEDIUM__ Defined as 1 when the /mm option is set. Otherwise, undefined.
_MSVCRT Defined as 1 when the /nolib option is set. Otherwise, undefined.
__PE__ Defined as 1 when the /pe option is set. Otherwise, undefined.
__P186__ Defined as 1 when the /1 option is set. Otherwise, undefined.
__P286__ Defined as 1 when the /2 option is set. Otherwise, undefined.
__P386__ Defined as 1 when the /3 option is set. Otherwise, undefined.
__P486__ Defined as 1 when the /4 option is set. Otherwise, undefined.
__P586__ Defined as 1 when the /5 option is set. Otherwise, undefined.
__P64__ Defined as 1 when the /10 option is set. Otherwise, undefined.
__P686__ Defined as 1 when the /6, /7, /8, or /9 option is set. Otherwise, undefined.
__P86__ Defined as 1 when the /0 option is set. Otherwise, undefined.
__SMALL__ Defined as 1 when the /ms option is set. Otherwise, undefined.
__SSE__ Defined as 1 when the /8, /9, /arch:SSE, /arch:SSE2, /arch:AVX, /arch:AVX2, or /arch:AVX512 options are set. Otherwise, undefined.
__SSE2__ Defined as 1 when the /9, /arch:SSE2, /arch:AVX, /arch:AVX2, or /arch:AVX512 options are set. Otherwise, undefined.
_STDCALL_SUPPORTED Defined as 1 when the /Gz option is set. Otherwise, undefined.
__TINY__ Defined as 1 when the /mt option is set. Otherwise, undefined.
_UNICODE Defined as 1 when the /ws option is set. Otherwise, undefined.
__UNIX__ Defined as 1 when the /elf or /elf64 options are set. Otherwise, undefined.
_WIN64 Defined as 1 when the compilation target is 64-bit. Otherwise, undefined.

Date and Time Information

@Date The compilation date of the current source file. The date is a constant length string literal of the form mm/dd/yy.
@Time The system time in 24-hour hh:mm:ss format (text macro).

Environment Information

@Cpu A bit mask specifying the processor mode (numeric equate).
@Environ(envvar) Value of environment variable envvar (macro function).
@Interface Information about the language parameters (numeric equate).
@Version Defined as an integer literal value that represents the compatible version of Masm. Currently 800 for Asmc and 1000 for Asmc64.

File Information

@FileName The base name of the main file being assembled (text macro).
@FileCur The name of the current source file (text macro).
@Line Defined as the integer line number in the current source file.
__FILE__ The name of the current source file (string macro).
__func__ The name of the current function (string macro).
__LINE__ Defined as the integer line number in the current source file.

Macro Functions

@CatStr(string1[[,string2...]]) Macro function that concatenates one or more strings. Returns a string.
@ComAlloc(class[[,vtable]]) Macro function that allocates a CLASS object. Returns a pointer to the new object.
@CStr(string|index) Macro function that creates a string in the .DATA or .CONST segment. The macro accepts C-escape characters in the string. Strings are added to a stack and reused if duplicated strings are found. The macro returns string label.
@InStr([[position]],string1,string2) Macro function that finds the first occurrence of string2 in string1, beginning at position within string1. If position does not appear, search begins at start of string1. Returns a position integer or 0 if string2 is not found.
@SizeStr(string) A macro function that returns the length of the given string. Returns an integer.
@SubStr(string,position[[,length]]) A macro function that returns a substring starting at position.

Miscellaneous

$ The current value of the location counter.
? In data declarations, a value that the assembler allocates but does not initialize.
@@: Defines a code label recognizable only between label1 and label2, where label1 is either start of code or the previous @@: label, and label2 is either end of code or the next @@: label.
@B The location of the previous @@: label.
@F The location of the next @@: label.
{evex} The Enhanced Vector Extension (EVEX) encoding prefix will be omitted by using an EVEX exclusive instruction or any of the extended SIMD registers. A preceding prefix {evex} may be used for EVEX encoding of other instructions.

Segment Information

@code The name of the code segment (text macro).
@CodeSize 0 for TINY, SMALL, COMPACT, and FLAT models, and 1 for MEDIUM, LARGE, and HUGE models (numeric equate).
@CurSeg The name of the current segment (text macro).
@data The name of the default data group. Evaluates to DGROUP for all models except FLAT. Evaluates to FLAT under the FLAT memory model (text macro).
@DataSize 0 for TINY, SMALL, MEDIUM, and FLAT models, 1 for COMPACT and LARGE models, and 2 for HUGE model (numeric equate).
@fardata The name of the segment defined by the .FARDATA directive (text macro).
@fardata? The name of the segment defined by the .FARDATA? directive (text macro).
@Model 1 for TINY model, 2 for SMALL model, 3 for COMPACT model, 4 for MEDIUM model, 5 for LARGE model, 6 for HUGE model, and 7 for FLAT model (numeric equate).
@stack DGROUP for near stacks or STACK for far stacks (text macro).
@WordSize Two for a 16-bit, four for a 32-bit, and eight for a 64-bit segment (numeric equate).

See Also

Directives Reference