• Aucun résultat trouvé

IFE StackSize StackSize=1024

DB StackSize DUP (?) ENDIF

;allocate stack

IFIDN, IFIDNI

Starts conditional assembly block; enabled if arguments are identical

MASM, Ideal

IFIDN <argumentl>,<argument2>

You usually use IFIDN inside a macro. It tests whether its two arguments are identical character strings. Either of the arguments can be macro dummy arguments that will have real arguments to the macro call that was substituted before performing the comparison. If the two strings are identical, the statements within the conditional block are assembled. The two strings are compared on a character-by-character basis; case is significant. If you want case to be ignored, use the IFIDNI directive.

Use the ENDIF directive to terminate the conditional assembly block.

ELSE, ENDIF, IF, IF1, IF2, IFB, IFDEF, IFDIF, IFDIFI, IFE, IFIDNI, IFNB, IFNDEF

RDWR MACRO BUF,RWMODE mov ax,BUF

IFIDN <RWMODE>,<READ>

call ReadIt ENDIF

IFIDN <RWMODE>,<WRITE>

call WriteIt

IFNB

Function Mode Syntax Remarks

See also Example

IFNDEF

Function Mode Syntax Remarks

ENDIF ENDM

Starts conditional assembly block, enabled if argument is nonblank

MASM, Ideal IFNB <argument>

If argument is nonblank, the statements within the condi-tional block are assembled. Use IFNB to test whether a macro was called with a real argument to replace the specified dummy argument.

You must always surround the argument to be tested with angle brackets

«

».

Use the END IF directive to terminate the conditional assembly block.

ELSE, ENDIF, IF, IF1, IF2, IFB, IFDEF, IFDIF, IFDIFI, IFE, IFIDN, IFIDNI, IFNDEF

PopRegs MACRO REG1,REG2 IFNB <REG1>

pop REGl ENDIF IFNB <REG2>

pop REG2 ENDIF ENDM

Starts conditional assembly block; enabled if symbol is not defined

MASM,Ideal IFNDEF symbol

If symbol has not yet been defined in the source file, the statements within the conditional block are assembled.

Use the ENDIF directive to terminate the conditional assembly block.

See also Example

%INCL

Function Mode Syntax Remarks

See also Example

INCLUDE

Function Mode Syntax

Remarks

ELSE, ENDIF,IF, IF1, IF2, IFB, IFDEF, IFDIF, IFDIFI, IFE, IFIDN, IFIDNI, IFNB

IFNDEF BufSize BufSize EQU 128 ENDIF

idefine buffer size if not defined

Allows listing of include files MASM,Ideal

%INCL

Use %INCL after a %NOINCL directive has turned off listing of INCLUDE files. This is the default INCLUDE file listing mode.

% NOINCL

%INCL

INCLUDE DEFS.INC icontents appear in listing

Includes source code from another file MASM,Ideal

MASMmode:

INCLUDE filename Ideal mode:

INCLUDE "filename"

filename is a source file containing assembler statements.

Turbo Assembler assembles all statements in the included file before continuing to assemble the current file.

filename uses the normal DOS file-naming conventions, where you can enter an optional drive, optional direc-tory, file name, and optional extension. If you don't provide an extension, .ASM is presumed.

If filename does not include a directory or drive name, Turbo Debugger first searches for the file in any

direc-Example

tories specified by the II command-line option and then in the current directory.

You can nest INCLUDE directives as deep as you want.

Notice that in Ideal mode, you must surround the file-name with quotes.

;MASM mode INCLUDE MYMACS.INC

;Ideal mode INCLUDE "DEFS.INC"

;include MACRO definitions

;include EQU definitions

INCLUDELIB

Function Mode Syntax

Remarks

Example

INSTR

Function Mode Syntax Remarks

Tells the linker to include a library MASM, Ideal

MASMmode:

INCLUDELIB filename Ideal mode:

INCLUDELIB II fil en ame II

filename is the name of the library that you want the linker to include at link time. If you don't supply an extension with filename, the linker assumes .LIB.

Use INCLUDELIB when you know that the source file will always need to use routines in the specified library.

That way you don't have to remember to specify the library name in the linker commands.

Notice that in Ideal mode, you must surround the file-name with quotes.

INCLUDELIB diskio ;includes DISKIO.LIB

Returns the position of one string inside another string MASM51, Ideal

name INSTR [start,jstringl,string2

name is assigned a value that is the position of the first instance of string2 in stringl. The first character in stringl

See also Example

IRP

Function Mode Syntax

Remarks

See also Example

IRPC

Function Mode Syntax

has a position of one. If string2 does not appear any-where within stringl, a value of 0 is returned.

CATSTR, SIZESTR, SUBSTR

COMMAPOS INSTR <aaa,bbb>,<,> iCOMMAPOS = 4

Repeats a block of statements with string substitution MASM,Ideal

IRP parameter,<argl[,arg2] ..• >

statements ENDM

The statements within the repeat block are assembled once for each argument in the list enclosed in angle brackets. The list may contain as many arguments as you want. The arguments may be any text, such as symbols, strings, numbers, and so on. Each time the block is assembled, the next argument in the list is substituted for any instance of parameter in the enclosed statements.

You must always surround the argument list with angle brackets

«

», and arguments must be separated by commas. Use the ENDM directive to end the repeat block.

You can use IRP both inside and outside of macros.

IRPC,REPT IRP reg,<ax,bx,cx,dx>

push reg ENDM

Repeats a block of statements with character substitution MASM,Ideal

IRPC parameter, string statements

ENDM

Remarks

See also Example

JUMPS

Function Mode Syntax Remarks

The statements within the repeat block are assembled once for each character in string. The string may contain as many characters as you want. Each time the block is assembled, the next character in the list is substituted for any instances of parameter in the enclosed statements.

Use the ENDM directive to end the repeat block.

You can use IRPC both inside and outside of macros.

IRP,REPT IRPC LUCKY,1379

DB LUCKY

ENDM

iallocate a lucky number

This creates 4 bytes of data containing the values 1,3, 7, and 9.

Enables stretching of conditional jumps to near or far addresses

MASM, Ideal

JUMPS

JUMPS causes Turbo Assembler to look at the destination address of a conditional jump instruction, and if it is too far away to reach with the short displacement that these instructions use, it generates a conditional jump of the opposite sense around an ordinary jump instruction to the desired target address.

For example, jne xyz becomes je @@A jmp xyz

@@a:

If the destination address is forward-referenced, you should use the NEAR or FAR operator to tell Turbo Assembler how much space to allocate for the jump instruction. If you don't do this, inefficient code may be generated.

See also Example

LABEL

Function Mode Syntax

Remarks

See also Example

This directive has the same effect as using the IJJUMPS command-line option.

NOJUMPS

JUMPS ;enable jump stretching jne SHORT @A ;can reach A

@@A:

Defines a symbol with a specified type MASM,Ideal

MASMmode:

name LABEL type Ideal mode:

LABEL name type

name is a symbol that you have not previously defined in the source file. type describes the size of the symbol and whether it refers to code or data. It can be one of the following:

• NEAR, FAR, or PROC. PROC is the same as either NEAR or FAR, depending on the memory set using the MODEL directive

• BYTE, WORD, DATAPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, or a structure name The label will only be accessible from within the current source file, unless you use the PUBLIC directive to make it accessible from other source files.

Notice that in Ideal mode, name comes after the LABEL directive.

Use LABEL to access different-sized items than those in the data structure; see the example that follows.

WORDS LABEL WORD ;access "BYTES" as WORDS BYTES DB 64 DUP (0)

mov WORDS[2],1 ;write WORD of 1

.LALL

Function Mode Syntax See also

.LFCOND

Function Mode Syntax Remarks

See also

%LINUM

Function Mode Syntax Remarks

Example

Enables listing of macro expansions MASM

.LALL

%MACS

Shows all statements in conditional blocks in the listing MASM

.LFCOND

.LFCOND enables the listing of false conditional blocks in assembly listings .. LFCOND is not affected by the IX option.

%CONDS

Sets the width of the line-number field in listing file MASM,Ideal

%LINUM size

% LlNUM allows you to set how many columns the line numbers take up in the listing file. size must be a constant. If you want to make your listing as narrow as possible, you can reduce the width of this field. Also, if your source file contains more than 9,999 lines, you can increase the width of this field so that the line numbers are not truncated.

The default width for this field is 4 columns.

%LINUM 5 iallows up to line 99999

%LIST

Shows source lines in the listing MASM,Ideal

%LIST

% LIST reverses the effect of a %NOLIST directive that caused all listing output to be suspended.

This is the default listing mode; normally, all source lines are placed in the listing output file .

. LIST, %NOLIST, .XLIST

%LIST

jmp xyz ithis line always listed

Shows source lines in the listing MASM

Defines local variables for macros and procedures MASM,Ideal

In macros:

LOCAL symbol [,symbol] .••

In procedures:

LOCAL name:type[:count] [,name:type[:count]] ••• [=symbol]

LOCAL can be used both inside macro definitions started with the MACRO directive and within proce-dures defined with PROC. It behaves slightly differently depending on where it is used.

Within a macro definition, LOCAL defines temporary symbol names that are replaced by new unique symbol names each time the macro is expanded. The unique names take the form of ??number, where number is hexadecimal and starts at 0000 and goes up to FFFF.

Within a procedure, LOCAL defines names that access stack locations as negative offsets relative to the BP register. The first local variable starts at BP (type X count). If you end the argument list with an equal sign

(=) and a symbol, that symbol will be equated to the total size of the local symbol block in bytes. You can then use this value to make room on the stack for the local variables.

Each localdefhas the following syntax:

localname:[ [distance] PTR]type[:count]

You can use this alternative syntax for each localdef:

localname[ [count] ] [:[distance] PTR]type]

localname is the name you'll use to refer to this local symbol throughout the procedure.

type is the data type of the argument and can be one of the following: WORD, DATAPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, or a structure name. If you don't specify a type, and you're using the alternative syntax, WORD size is assumed.

count specifies how many elements of the specified type to allocate on the stack.

The optional distance and PTR lets you tell Turbo Assembler to include debugging information for Turbo Debugger, which tells it this local variable is really a pointer to another data type. See the PROC directive for a discussion of how this works.

Here are some examples of valid arguments:

Documents relatifs