Skip to content

Latest commit

 

History

History
276 lines (231 loc) · 11.7 KB

readme.md

File metadata and controls

276 lines (231 loc) · 11.7 KB

Asmc Macro Assembler Reference

Directives Reference

Code Labels

ALIGN [[number]] Aligns the next variable or instruction on a byte that is a multiple of number.
EVEN Aligns the next variable or instruction on an even byte.
name LABEL type
name LABEL [[NEAR|FAR|PROC]] PTR [[type]]
Creates a new label by assigning the current location-counter value and the given type to name.
ORG expression Sets the location counter to expression.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Conditional Assembly

DEFINE name expression Assigns value of expression to name.
[[ELSE]IF] [...] DEFINED(name) [...] Grants assembly if name is a previously defined label, variable, or symbol.
ELSE Marks the beginning of an alternate block within a conditional block.
ELSEIF Combines ELSE and IF into one statement.
ELSEIF2 ELSEIF block evaluated on every assembly pass if OPTION:SETIF2 is TRUE.
IF expression1
if_statements
[[ELSEIF expression2
elseif_statements]]
[[ELSE
else_statements]]
ENDIF
Grants assembly of if_statements if expression1 is true (nonzero) or elseif_statements if expression1 is false (0) and expression2 is true. The following directives may be substituted for ELSEIF: ELSEIFB, ELSEIFDEF, ELSEIFDIF, ELSEIFDIFI, ELSEIFE, ELSEIFIDN, ELSEIFIDNI, ELSEIFNB, and ELSEIFNDEF. Optionally, assembles elsestatements if the previous expression is false. Note that the expressions are evaluated at assembly time.
IF2 expression IF block is evaluated on every assembly pass if OPTION:SETIF2 is TRUE.
IF[N]B textitem Grants assembly if textitem is blank.
IFDIF[[I]] textitem1, textitem2 Grants assembly if the text items are different. If I is given, the comparison is case insensitive.
IFE expression Grants assembly if expression is false (0).
IFIDN[[I]] textitem1, textitem2 Grants assembly if the text items are identical. If I is given, the comparison is case insensitive.
IF[N]DEF name Grants assembly if name is a previously defined label, variable, or symbol.
UNDEF identifier Removes (undefines) a previously defined label, variable, or symbol.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Conditional Control Flow

Conditional Error

.ERR [[message]] Generates an error.
.ERR2 [[message]] .ERR block evaluated on every assembly pass if OPTION:SETIF2 is TRUE.
.ERRB textitem [[,message]] Generates an error if textitem is blank.
.ERRDEF name [[,message]] Generates an error if name is a previously defined label, variable, or symbol.
.ERRDIF[[I]] textitem1, textitem2 [[,message]] Generates an error if the text items are different. If I is given, the comparison is case insensitive.
.ERRE expression [[, message]] Generates an error if expression is false (0).
.ERRIDN[[I]] textitem1, textitem2 [[,message]] Generates an error if the text items are identical. If I is given, the comparison is case insensitive.
.ERRNB textitem [[,message]] Generates an error if textitem is not blank.
.ERRNDEF name [[,message]] Generates an error if name has not been defined.
.ERRNZ expression [[, message]] Generates an error if expression is true (nonzero).
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Data Allocation

[[name]] type initializer [[, initializer]] ...

Allocates and optionally initializes count byte(s) of storage. Can also be used as a type specifier anywhere a type is legal.

type size
BYTE 1 unsigned
SBYTE 1 signed
WORD 2 unsigned
SWORD 2 signed
DWORD 4 unsigned
SDWORD 4 signed
FWORD 6 unsigned
QWORD 8 unsigned
SQWORD 8 signed
TBYTE 10 unsigned
OWORD 16 unsigned
XMMWORD 16 vector
YWORD 32 vector
ZWORD 64 vector
REAL2 2 float
REAL4 4 float
REAL8 8 float
REAL10 10 float
REAL16 16 float

Equates

name = expression Assigns the numeric value of expression to name. The symbol can be redefined later.
name EQU expression Assigns numeric value of expression to name. The name cannot be redefined later.
name EQU <text> Assigns specified text to name. The name can be assigned a different text later.
name TEXTEQU [[textitem]] Assigns textitem to name. The textitem can be a literal string, a constant preceded by a , or the string returned by a macro function.
xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Listing Control

.CREF Enables listing of symbols in the symbol portion of the symbol table and browser file.
.LIST Starts listing of statements. This is the default.
.LISTALL Starts listing of all statements. Equivalent to the combination of .LIST, .LISTIF, and .LISTMACROALL.
.LISTIF Starts listing of statements in false conditional blocks. Same as .LFCOND.
.LISTMACRO Starts listing of macro expansion statements that generate code or data. This is the default. Same as .XALL.
.LISTMACROALL Starts listing of all statements in macros. Same as .LALL.
.NOCREF [[name [[, name]]...]] Suppresses listing of symbols in the symbol table and browser file. If names are specified, then only the given names are suppressed. Same as .XCREF.
.NOLIST Suppresses program listing. Same as .XLIST.
.NOLISTIF Suppresses listing of conditional blocks whose condition evaluates to false (0). This is the default. Same as .SFCOND.
.NOLISTMACRO Suppresses listing of macro expansions. Same as .SALL.
.PAGE [[[[length]], width]] Sets line length and character width of the program listing. If no arguments are given, generates a page break.
.PAGE + Increments the section number and resets the page number to 1.
.SUBTITLE Defines the listing subtitle. Same as .SUBTTL.
.TFCOND Toggles listing of false conditional blocks.
.TITLE text Defines the program listing title.
xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Macros

Miscellaneous

Procedures

Processor

.186 Enables assembly of instructions for the 80186 processor; disables assembly of instructions introduced with later processors. Also enables 8087 instructions.
.286 Enables assembly of nonprivileged instructions for the 80286 processor; disables assembly of instructions introduced with later processors. Also enables 80287 instructions.
.286P Enables assembly of all instructions (including privileged) for the 80286 processor; disables assembly of instructions introduced with later processors. Also enables 80287 instructions.
.287 Enables assembly of instructions for the 80287 coprocessor; disables assembly of instructions introduced with later coprocessors.
.386 Enables assembly of nonprivileged instructions for the 80386 processor; disables assembly of instructions introduced with later processors. Also enables 80387 instructions.
.386P Enables assembly of all instructions (including privileged) for the 80386 processor; disables assembly of instructions introduced with later processors. Also enables 80387 instructions.
.387 Enables assembly of instructions for the 80387 coprocessor.
.486 Enables assembly of nonprivileged instructions for the 80486 processor.
.486P Enables assembly of all instructions (including privileged) for the 80486 processor.
.586 Enables assembly of nonprivileged instructions for the Pentium processor.
.586P Enables assembly of all instructions (including privileged) for the Pentium processor.
.686 Enables assembly of nonprivileged instructions for the Pentium Pro processor.
.686P Enables assembly of all instructions (including privileged) for the Pentium Pro processor.
.K3D Enables assembly of K3D instructions.
.MMX Enables assembly of MMX or single-instruction, multiple data (SIMD) instructions.
.XMM Enables assembly of Internet Streaming SIMD Extension instructions.
.X64 Enables assembly of nonprivileged instructions for the x86-64 processor.
.X64P Enables assembly of privileged instructions for the x86-64 processor.
.8086 Enables assembly of 8086 instructions (and the identical 8088 instructions); disables assembly of instructions introduced with later processors. Also enables 8087 instructions. This is the default mode for processors.
.8087 Enables assembly of 8087 instructions; disables assembly of instructions introduced with later coprocessors. This is the default mode for coprocessors.
.NO87 Disallows assembly of all floating-point instructions.

Repeat Blocks

Scope

Segment

Simplified Segment

String

Structure and Record

See Also

Symbols Reference