Pragmatic directives: Difference between revisions

No edit summary
Line 31:
* <code>macro</code>: Defines a macro. Any time the macro name appears in your source document, the assembler replaces it with the definition. Any parameters supplied to the macro are also plugged in. This is useful for parameter passing which would otherwise be very tedious. Every macro must end with an <code>endm</code>.
 
=={{header|8086 Assembly}}==
These are common to most assemblers but syntax may vary. Place them in your source code file. As with code, all of these can be deactivated by commenting them out.
 
* <code>@data</code>: Marks the beginning of the data segment.
* <code>@code</code>: Marks the beginning of the code segment.
* <code>equ</code>: Equates a label to a specific numeric value. Each instance of that label in your code becomes a constant if preceded by a # and a memory address otherwise.
 
* <code>include filename</code>: Adds an additional file to your source code. The assembler treats the contents as 6502 instructions when assembling. For most assemblers the location of the <code>include</code> statement matters, since it is treated as if the contents were copy-pasted inline. UASM doesn't require quotation marks around the filename.
 
* <code>incbin filename</code>: Adds a binary file to your source code. For most assemblers the location of the <code>incbin</code> statement matters, since it is treated as if the contents were copy-pasted inline. UASM doesn't require quotation marks around the filename.
 
* <code>ifdef</code>/<code>ifndef</code>/<code>else</code>/<code>endif</code>: The assembler will skip anything inside an IFDEF block if the designated label wasn't defined. IFNDEF and ELSE are the opposite. To make an IFDEF statement true, you only need to have that label defined in your source. (The value doesn't matter as long as it appears.)
 
* <code>db</code>/<code>dw</code>/<code>byte</code>/<code>word</code>: Defines a data block. The assembler treats these values as arbitrary bytes rather than machine instructions. Used for tables of values, etc.
 
* <code>BYTE n DUP (k)</code>: Fills in the next n bytes with the value k. This is useful for creating user ram in your data segment
 
* <code>macro</code>: Defines a macro. Any time the macro name appears in your source document, the assembler replaces it with the definition. Any parameters supplied to the macro are also plugged in. This is useful for parameter passing which would otherwise be very tedious. Every macro must end with an <code>endm</code>.
 
* <code>BYTE PTR</code>/<code>WORD PTR</code>: Tells the assembler that the value after this directive is a pointer to memory rather than a constant. This is useful when using labels and the command is somewhat ambiguous about the size or data type.
 
=={{header|Ada}}==
1,489

edits