Copyright: Turbo Assembler Help
Citation: Copyright 1993 Borland International.


Startup

Welcome to Turbo Assembler's Help. Use the Tab key to move the selection bar to any of the highlighted items. You can also use the cursor to move from item to item, and then press Enter to select it. Press Home to go to the first item on the screen; End to go to the last. While in the Help system, press F1 to bring up the Help index. Press Alt-F1 to bring up previous Help screens.

You can also use the mouse to click on any of these items or you can use the Help menu.


Command Line

Command line options:

/a	Alphabetical segment ordering

/b	Has no effect.

/c	Cross-reference in listing file.

/d	Defines a symbol.

/e	Generates floating-pointer emulator instructions.

/h,/?	Displays a help screen.

/i	Sets an Include file path.

/j	Defines an assembler startup directive.

/kh	Maximum number of symbols allowed

/ks	Maximum size of Turbo Assembler's string space.

/l	Generates a listing file.

/la	Shows high-level interface code in listing file.

/m#	Allow # multiple passes to resolve forward references

/ml	Treats all symbol as case sensitive.

/mu	Converts symbols to uppercase

/mx	Makes public and external symbols(globals) case-sensitive.

/mv#	Set maximum valid length for symbols

/n	Suppresses symbol table in listing file.

/o	Output TLINK-compatible objects with overlay support enabled.

/oi	Output IBM-linker compatible objects IBM's linear-executable linker.

/op	Output Pharlap compatible objects

/os	Output TLINK-compatible objects without overlays.

/p	Checks for impure protected mode code.

/q	Removes all records from the .OBJ that are not neccessary for linking.

/r	Generates real floating point instructions

/s	Sequential segment ordering. (default)

/t	Suppresses messages on successful assembly.

/v	Compatibility option.

/w	Generation of warning messages

/x	Includes false conditionals in listing.

x/z	Displays source lines along with error messages.

/zd	Enables line number information in .OBJ

/zi	Enables debug information in object file.

Configuration file


Configuration File

Turbo Assembler also lets you put your most frequently used options into a configuration file in the current directory. It will look for a file called TASM.CFG in your current directory. If it is found, it is treated as an indirect file and processed before anything else on the comamnd line.


/a

Specifies alphabetical segment-ordering.

See Also

/s which returns to the default sequential segment-ordering.


/b

Has no effect on the assembly. Provided for compatibility.


/c

Enable cross-reference in listing file.

Turbo Assembler adds the cross-reference information to the symbol table at the end of the listing file. This means that, in order to see the cross-reference information, you must either explicitly specify a listing file on the command line or use the /l option to enable the listing file.


/d

This option defines a symbol for your source file, exactly as if it were defined on the first line of your file with the = directive. You can use this option as many times as you want on the command line.

You can only define a symbol as being equal to another symbol or a constant value. You can't use an expression with operators to the right of the equal sign (=). For example, /dX=9 and /dX=Y are allowed, but /dX=Y-4 is not allowed.

Example

        TASM /dMAX=10 /dMIN=2 TEST1

This command line defines two symbols, MAX and MIN, that other statements in the source file TEST1.ASM can refer to.


/e

Generates floating-point emulator instructions.

Use this option if your program contains a floating-point emulation library that mimics the functions of the 80x87 numeric coprocessor.

Normally, you would only use this option if your assembler module is part of a program written in a high-level language that uses a floating-point emulation library. (Turbo C, Turbo Pascal, Turbo Basic, and Turbo Prolog all support floating-point emulation.) You can't just link an assembler program with the emulation library, since the library expects to have been initialized by the compiler's startup code.

See Also

Can't emulate 8087 instruction error


/h

Displays a help screen that describes the command-line syntax.


/i

The /i option lets you tell Turbo Assembler where to look for files that are included in your source file by using the INCLUDE directive. You can place more than one /i option on the command line (the number is only limited by RAM).


/j

/jdirective

The /j option lets you specify a directive that will be assembled before the first line of the source file. directive can be any Turbo Assembler directive that does not take any arguments, such as .286, IDEAL, %MACS, NOJUMPS, and so on. See Chapter 3 in the Reference Guide for a complete description of all Turbo Assembler directives.

You can put more than one /j option on the command line; they are processed from left to right across the command line.


/kh

/kh nsymbols

The /kh option sets the maximum number of symbols that your program can contain. If you don't use this option, your program can only have a maximum of 8,192 symbols; using this option increases the number of symbols to nsymbols, up to a maximum of 32,768.

Use this option if you get the Out of hash space message when assembling your program.


/ks

/kskbytes

Usually the string size is determined automatically and does not need to be adjusted. However, if you have a source file that results in an Out of string space message, you might want to increase the string space size by using this option. Try starting with a value of 100, and increase it until your program assembles without error. The maximum allowable value for kbytes is 255.


/l

The /l option indicates that you want a listing file, even if you did not explicitly specify it on the command line. The listing file will have the same name as the source file, with an extension of .LST.


/la

The /la option tells Turbo Assembler to show all generated code in the listing file, including the code that gets generated as a result of the high-level language interface MODEL directive.


/m

/m[npasses]

Normally, Turbo Assembler functions as a single-pass assembler. The /m option allows you to specify the maximum number of passes that the assembler should make during the assembly process. TASM automatically decides whether it can perform less than the number of passes specified. If you don't specify npasses, a default of five is used.

Some modules contain constructions that assemble properly only when two passes are done. If multiple passes are not enabled, such a module will produce at least one "Pass-dependent construction encountered" warning. If the /m option is enabled, Turbo Assembler will assemble this module correctly but will not optimize the code by removing NOPs, no matter how many passes are allowed. The warning "Module is pass dependent--compatibility pass was done" is displayed if this occurs.

Example

      TASM /M2 TEST1

This tells Turbo Assembler to use up to two passes when assembling TEST1.


/ml

The /ml option tells Turbo Assembler to treat all symbol names as case-sensitive. Normally, uppercase and lowercase letters are considered equivalent so that the names ABCxyz, abcxyz, and ABCXYZ would all refer to the same symbol. If you specify the /ml option, these three symbols will be treated as distinct. Even when you specify /ml, you can still enter any assembler keyword in uppercase or lowercase. Keywords are the symbols built into the assembler that have special meanings, such as instruction mnemonics, directives, and operators.


/mu

The /mu option tells Turbo Assembler to ignore the case of all symbols. By default, Turbo Assembler specifies that any lowercase letters in symbols will be converted to uppercase unless you change it by using the /ml directive.


/mx

The /mx option tells Turbo Assembler to treat only external and public symbols as case-sensitive. All other symbols used (within the source file) are treated as uppercase.

You should use this directive when you call routines in other modules that were compiled or assembled so that case-sensitivity is preserved; for example, modules compiled by Turbo C.


/mv

The /mv# option sets the maximum length of symbols that TASM will distinguish between. For example, if you set /mv3, TASM will see ABCC and ABCD as the same symbol, but not AB.


/n

The /n option indicates that you don't want the usual symbol table at the end of the listing file. Normally, a complete symbol table listing appears at the end of the file, showing all symbols, their types, and their values.

You must specify a listing file, either explicitly on the command line or by using the /l option; otherwise, /n has no effect.


/o

Output TLINK compatible object files with overlay support enabled.

See Also

/oi

/op

/os


/oi

Output IBM-linker compatible objects IBM's linear-executable linker.

See Also

/o

/op

/os


/op

Output Pharlap-linker compatible object files.

See Also

/o

/oi

/os


/os

Output TLINK compatible object files without overlay support.

See Also

/o

/oi

/op


/p

The /p option specifies that you want to be warned about any instructions that generate "impure" code in protected mode. Instructions that move data into memory by using a CS: override in protected mode are considered impure because they might not work correctly unless you take special measures.

You only need to use this option if you are writing a program that runs on the 80286 or 80386 in protected mode.


/q

The /q option removes the copyright and file dependency records from the resulting .OBJ files, making it smaller. Don't use this option if you are using MAKE or a similar program that relies on the dependency records.


/r

The /r option tells Turbo Assembler to generate real floating-point instructions (instead of generating emulated floating-point instructions). Use this option if your program is going to run on machines equipped with an 80x87 numeric coprocessor.

The /e option reverses the effect of this option in generating emulated floating-point instructions.


/s

The /s option tells Turbo Assembler to place segments in the object file in the order in which they were encountered in the source file. By default, Turbo Assembler uses segment-ordering, unless you change it by placing an /a option in the configuration file.


/t

The /t option stops any display by Turbo Assembler unless warning or error messages result from the assembly.

You can use this option when you are assembling many modules, and you only want warning or error messages to be displayed onscreen.


/v

The /v option is included for compatibility. It performs no action and has no effect on the assembly.


/w

/w-[warnclass]

/w+[warnclass]

The /w option controls which warning messages are emitted by Turbo Assembler.

If you specify /w by itself, "mild" warnings are enabled. Mild warnings merely indicate that you can improve some aspect of your code's efficiency.

If you specify /w- without warnclass, all warnings are disabled. If you follow /w- with warnclass, only that warning is disabled. Each warning message has a three-letter identifier:

ALN_Segment alignment ASS_Assuming segment is 16-bit BRK_Brackets needed ICG_Inefficient code generation LCO_Location counter overflow OPI_Open IF conditional OPP_Open procedure OPS_Open segment OVF_Arithmetic overflow PDC_Pass-dependent construction PQK_Assuming constant for [const] warning PRO Write-to memory in protected mode needs CS override

RES_Reserved word warning TPI_Turbo Pascal illegal warning UNI Data written to uninitialized segment

If you specify /w+ without warnclass, all warnings are enabled. If you specify /w+ with warnclass from the preceding list, only that warning will be enabled.

By default, Turbo Assembler first starts assembling your file with all warnings enabled except the inefficient code-generation (ICG) and the write-to-memory in protected mode (PRO) warnings.

You can use the WARN and NOWARN directives within your source file to control whether a particular warning is allowed for a certain range of source lines. See Chapter 3 in the Reference Guide for more information on these directives.

Example

      TASM /w TEST1

The following statement in TEST1.ASM issues a warning message that would not have appeared without the /w option:

   mov bx,ABC ;inefficient code generation warning

   ABC = 1

With the command line

   TASM /w-OVF TEST2

no warnings are generated if TEST2.ASM contains

   dw  1000h * 20h


/x

If a conditional IF, IFNDEF, IFDEF, and so forth evaluates to False, the /x option causes the statements inside the conditional block to appear in the listing file. This option also causes the conditional directives themselves to be listed; normally they are not.

You must specify a listing file on the command line or via the /l option, otherwise /x has no effect.


/z

The /z option tells Turbo Assembler to display the corresponding line from the source file when an error message is generated. The line that caused the error is displayed before the error message. With this option disabled, Turbo Assembler just displays a message that describes the error.


/zd

The /zd option causes Turbo Assembler to place line-number information in the object file. This lets Borland's stand-alone debugger, Turbo Debugger, display the current location in your source code, but does not put the information in the object file that would allow the debugger to access your data items.

If you run out of memory when trying to debug your program under Turbo Debugger, you can use /zd for some modules and /zi for others.


/zi

The /zi option tells Turbo Assembler to output complete debugging information to the object file. This includes line-number records to synchronize source code display and data type information to allow you to examine and modify your program's data.

The /zi option lets you use all the features of Turbo Debugger to step through your program and examine or change your data items. You can use /zi on all your program's modules, or just on those you're interested in debugging. Since the /zi switch adds information to the object and executable programs, you might not want to use it on all your modules if you run out of memory when running a program under Turbo Debugger.


Argument Needs Type Override

The expression needs to have a specific size or type supplied, since its size can't be determined from the context. For example,

   mov  [bx],1

You can usually correct this error by using the PTR operator to set the size of the operand:

   mov  WORD PTR[bx],1

See Also

TASM Errors and Warnings


Argument to Operation or Instruction Has Illegal Size

An operation was attempted on something that could not support the required operation. For example,

   Q LABEL QWORD

   QNOT = not Q           ;can't negate a qword


Arithmetic overflow

A loss of arithmetic precision occurred somewhere in the expression. For example,

   X = 20000h * 20000h    ;overflows 32 bits

All calculations are performed using 32-bit arithmetic.


ASSUME Must be Segment Register

You have used something other than a segment register in an ASSUME statement. For example,

   ASSUME ax:CODE

You can only use segment registers with the ASSUME directive.


Assuming Segment is 32 Bit

You have started a segment using the SEGMENT directive after having enabled 80386 instructions, but you have not specified whether this is a 16- or 32-bit segment with either the USE16 or USE32 keyword.

In this case, Turbo Assembler presumes that you want a 32-bit segment. Since that type of code segment won't execute properly under DOS (without you taking special measures to ensure that the 80386 processor is executing instructions in a 32-bit segment), the warning is issued as USE32.

You can remove this warning by explicitly specifying USE16 as an argument to the SEGMENT directive.


Bad Keyword in SEGMENT Statement

One of the align/combine/use arguments to the SEGMENT directive is invalid. For example,

   DATA SEGMENT PAFA PUBLIC   ;PAFA should be PARA


Can't Add Relative Quantities

You have specified an expression that attempts to add together two addresses, which is a meaningless operation. For example,

   ABC   DB  ?

   DEF = ABC + ABC ;error, can't add two relatives

You can subtract two relative addresses, or you can add a constant to a relative address, as in:

   XYZ    DB  5 DUP (0)

   XYZEND EQU $

   XYZLEN = SYZEND - XYZ       ;perfectly legal

   XYZ2 = XYZ + 2              ;legal also


Can't Address with Currently ASSUMEd Segment Registers

An expression contains a reference to a variable for which you have not specified the segment register needed to reach it. For example,

   DSEG SEGMENT

      ASSUME ds:DSEG

      mov  si,MPTR  ;no segment register

                    ;to reach XSEG

   DSEG ENDS

   XSEG SEGMENT

   MPTR DW   ?

   XSEG ENDS


Can't Convert to Pointer

Part of the expression could not be converted to a memory pointer, for example, by using the PTR operator,

   mov cl,[BYTE PTR al] ;can't make AL into pointer


Can't Emulate 8087 Instruction

The Turbo Assembler is set to generate emulated floating-point instructions, either via the /E command-line option or by using the EMUL directive, but the current instruction can't be emulated. For example,

   EMUL

   FNSAVE [WPTR]        ;can't emulate this

The following instructions are not supported by floating-point emulators: FNSAVE, FNSTCW, FNSTENV, and FNSTSW.


Can't Make Variable Public

The variable is already declared in such a way that it can't be made public. For example,

   EXTRN  ABC:NEAR

   PUBLIC ABC      ;error, already EXTRN


Can't Override ES Segment

The current statement specifies an override that can't be used with that instruction. For example,

   stos  DS:BYTE PTR[di]

Here, the STOS instruction can only use the ES register to access the destination address.


Can't Subtract Dissimilar Relative Quantities

An expression subtracts two addresses that can't be subtracted from each other, such as when they are each in a different segment:

   SEG1 SEGMENT

   A:

   SEG1 ENDS

   SEG2 SEGMENT

   B:

      mov  ax,B-A ;illegal, A and B in different

                  ;   segments

   SEG2 ENDS


Can't Use Macro Name in Expression

A macro name was encountered as part of an expression. For example,

   MyMac    MACRO

            ENDM

   mov ax,MyMac     ;wrong!


Cant Use this Outside Macro
Can't Use this Outside Macro

You have used a directive outside a macro definition that can only be used inside a macro definition. This includes directives like ENDM and EXITM. For example,

   DATA SEGMENT

        ENDM             ;error, not inside macro


Code or Data Emission to Undeclared Segment

A statement that generated code or data is outside of any segment declared with the SEGMENT directive. For example,

   ;First line of file

      inc  bx          ;error, no segment

      END

You can only emit code or data from within a segment.


Constant Assumed to Mean Immediate Constant
Constant Assumed to Mean Immmediate Constant

This warning appears if you use an expression such as [0], which under MASM is interpreted as simply 0. For example,

   mov  ax[0]   ;means mov ax,0 NOT mov ax,DS:[0]


Constant Too Large

You have entered a constant value that is properly formatted, but is too large. For example, you can only use numbers larger than 0ffffh when you have enabled 80386 instructions with the .386 or .386P directive.


CS Not Correctly Assumed

A near CALL or JMP instruction can't have as its target an address in a different segment. For example,

   SEG1  SEGMENT

   LAB1  LABEL NEAR

   SEG1  ENDS

   SEG2  SEGMENT

      jmp LAB1        ;error, wrong segment

   SEG2  ENDS

This error only occurs in MASM mode. Ideal mode correctly handles this situation.


CS Override in Protected Mode

The current instruction requires a CS override, and you are assembling instructions for the 286 or 386 in protected mode (P286P or P386P directives). For example,

       P286P

       .CODE

   CVAL DW   ?

       mov  CVAL,1      ;generates CS override

The /P command-line option enables this warning. When running in protected mode, instructions with CS overrides won't work without you taking special measures.


CS Unreachable from Current Segment

When defining a code label using colon (:), LABEL or PROC, the CS register is not

assumed to either the current code segment or to a group that contains the current code segment. For example,

   PROG1    SEGMENT

      ASSUME cs:PROG2

   START:                ;error, bad CS assume

This error only occurs in MASM mode. Ideal mode correctly handles this situation.


Declaration Needs Name

You have used a directive that needs a symbol name, but none has been supplied. For example,

   PROC      ;error, PROC needs a name

      ret

   ENDP

You must always supply a name as part of a SEGMENT, PROC, or STRUC declaration. In MASM mode, the name precedes the directive; in Ideal mode, the name comes after the directive.


Directive Ignored in Turbo Pascal Model

You have tried to use one of the directives that can't be used when writing an assembler module to interface with Turbo Pascal. Read about the .MODEL directive that specifies Turbo Pascal in

Chapter 3 of this reference guide manual. Refer to Chapter 8 of the User's Guide for information about interfacing to Turbo Pascal.


Directive Not Allowed Inside Structure Definition

You have used a directive inside a STRUC definition block that can't be used there. For example,

   X STRUC

   MEM1 DB  ?

      ORG $+4  ;error, can't use ORG inside STRUC

   MEM2 DW  ?

   ENDS

Also, when declaring nested structures, you cannot give a name to any that are nested. For example,

   FOO STRUC

      FOO2 STRUC        ;can't name inside

      ENDS

   ENDS

If you want to use a named structure inside another structure, you must first define the structure and then use that structure name inside the second structure.


Duplicate Dummy Argument: _
Duplicate Dummy Argument: __

A macro defined with the MACRO directive has more than one dummy parameter with the same name. For example,

XYZ  MACRO A,A  ;error, duplicate dummy name      DB A

     ENDM

Each dummy parameter in a macro definition must have a different name.


ELSE or ENDIF without IF

An ELSE or ENDIF directive has no matching IF directive to start a conditional assembly

block. For example,

   BUF  DB 10 DUP (?)

       ENDIF            ;error, no matching IFxxx


Expecting Offset Quantity

An expression expected an operand that referred to an offset within a segment, but did not encounter the right sort of operand. For example,

   CODE SEGMENT

      mov  ax,LOW CODE

   CODE ENDS


Expecting Pointer Type
Expecting Offset or Pointer Quantity

An expression expected an operand that referred to an offset within a specific segment, but did not encounter the right sort of operand. For example,

   CODE SEGMENT

      mov  ax,SEG CODE ;error, code is a segment not

                       ; a location within a segment

   CODE ENDS


Expecting Pointer Type

The current instruction expected an operand that referenced memory. For example,

   les di,4        ;no good, 4 is a constant


Expecting Scalar Type

An instruction operand or operator expects a constant value. For example,

   BB   DB   4

        rol  ax,BB        ;ROL needs constant


Expecting Segment or Group Quantity

A statement required a segment or group name, but did not find one. For example,

   DATA SEGMENT

      ASSUME  ds:FOO ;error, FOO is not

                     ;  group or segment name

   FOO  DW  0

   DATA ENDS


Extra Characters on Line

A valid expression was encountered, but there are still characters left on the line. For example,

   ABC = 4 shl 3 3   ;missing operator between

                     ; 3 and 3

This error often happens in conjunction with another error that caused the expression parser to lose track of what you intended to do.


Forward Reference Needs Override

An expression containing a forward-referenced variable resulted in more code being required than Turbo Assembler anticipated. This can happen either when the variable is unexpectedly a far address for a JMP or CALL or when the variable requires a segment override in order to access it. For example,

     ASSUME cs:DATA

     call A            ;presume near call

   A PROC FAR          ;oops, it's far

     mov ax,MEMVAR     ;doesn't know it needs

                       ; override

   DATA   SEGMENT

   MEMVAR DW  ?        ;oops, needs override

Correct this by explicitly supplying the segment override or FAR override.


Global Type Doesn't Match Symbol Type

This warning is given when a symbol is declared using the GLOBAL statement and is also defined in the same module, but the type specified in the GLOBAL and the actual type of the symbol don't agree.


ID Not Member of Structure

In Ideal mode, you have specified a symbol that is not a structure member name after the period (.) structure member operator. For example,

      IDEAL

   STRUC DEMO

      DB  ?

   ENDS

   COUNT     DW 0

      mov ax,[(DEMO bx).COUNT] ;COUNT not part of

                               ;  structure

You must follow the period with the name of a member that belongs to the structure name that precedes the period.

This error often happens in conjunction with another error that caused the expression parser to lose track of what you intended to do.


Illegal Forward Reference

A symbol has been referred to that has not yet been defined, and a directive or operator requires that its argument not be forward-referenced. For example,

   IF MYSYM       ;error, MYSYM not defined yet

_      ;    ENDIF

   MYSYM EQU 1

Forward references may not be used in the argument to any of the IFxxx directives, nor as the count in a DUP expression.


Illegal Immediate

An instruction has an immediate (constant) operand where one is not allowed. For example,

   mov  4,al


Illegal Indexing Mode

An instruction has an operand that specifies an illegal combination of registers. For example,

   mov  al,[si+ax]

On all processors except the 80386, the only valid combinations of index registers are: BX, BP, SI, DI, BX+SI, BX+DI, BP+SI, BP+DI.


Illegal instruction

A source line starts with a symbol that is neither one of the known directives nor a valid instruction mnemonic.

   move ax,4        ;should be "MOV"


Illegal Instruction for Currently Selected Processor(s)

A source line specifies an instruction that can't be assembled for the current processor. For example,

   .8086

   push  1234h      ;no immediate push on 8086

When Turbo Assembler first starts assembling a source file, it generates instructions for the 8086 processor, unless told to do otherwise.

If you wish to use the extended instruction mnemonics available on the 186/286/386 processors, you must use one of the directives that enables those instructions (P186, P286, P386).


Illegal Local Argument

The LOCAL directive inside a macro definition has an argument that is not a valid symbol name. For example,

_X    MACRO _     LOCAL 123      ;not a symbol _     ENDM


Illegal Local Symbol Prefix

The argument to the LOCALS directive specifies an invalid start for local symbols. For example,

   LOCALS  XYZ         ;error, not 2 characters

The local symbol prefix must be exactly two characters that themselves are a valid symbol name, such as __, @@@@, and so on (the default is @@@@).


Illegal Macro Argument

A macro defined with the MACRO directive has a dummy argument that is not a valid symbol name. For example,

   X    MACRO 123      ;invalid dummy argument

        ENDM


Illegal Memory Reference

An instruction has an operand that refers to a memory location, but a memory location is not allowed for that operand. For example,

   mov  [bx],BYTE PTR A    ;error, can't move

                           ;from MEM to MEM

Here, both operands refer to a memory location, which is not a legal form of the MOV instruction. On the 80x86 family of processors, only one of the operands to an instruction can refer to a memory location.


Illegal Number

A number contains one or more characters that are not valid for that type of number. For example,

_Z = 0ABCGh

Here, G is not a valid letter in a hexadecimal number.


Illegal Origin Address

You have entered an invalid address to set the current segment location ($). You can enter either a constant or an expression using the location counter ($), or a symbol in the current segment.


Illegal Override in Structure

You have attempted to initialize a structure member that was defined using the DUP operator. You can only initialize structure members that were declared without DUP.


Illegal Override Register

A register other than a segment register (CS, DS, ES, SS, and on the 80386, FS and GS) was used as a segment override, preceding the colon (:) operator. For example,

   mov dx:XYZ,1   ;DX not a segment register


Illegal Radix

The number supplied to the .RADIX directive that sets the default number radix is invalid. For example,

   .RADIX  7              ;no good

The radix can only be set to one of 2, 8, 10, or 16. The number is interpreted as decimal no matter what the current default radix is.


Illegal Register Multiplier

You have attempted to multiply a register by a value, which is not a legal operation; for example,

   mov ax*3,1

The only context where you can multiply a register by a constant expression is when specifying a scaled index operand on the 80386 processor.


Illegal Segment Address

This error appears if an address greater than 65,535 is specified as a constant segment address; for example,

   FOO SEGMENT AT 12345h


Illegal Use of Constant

A constant appears as part of an expression where constants can't be used. For example,

   mov bx+4,5


Illegal Use of Register

A register name appeared in an expression where it can't be used. For example,

   X = 4 shl ax  ;can't use register with SHL

                 ;  operator


Illegal Use of Segment Register

A segment register name appears as part of an instruction or expression where segment registers cannot be used. For example,

   add  SS,4   ;ADD can't use segment regs


Illegal USES Register

You have entered an invalid register to push and pop as part of entering and leaving a procedure. The valid registers follow:

_AX _BX _CX _DI _DS _DX _ES _SI

If you have enable the 80386 processor with the .386 or .386P directive, you can use the 32-bit equivalents for these registers.


Illegal Warning ID

You have entered an invalid three-character warning identifier. See the options discussed in Chapter 3 of the User's Guide for a complete list of the allowed warning identifiers.


Instruction can be Compacted with Override

The code generated contains NOP padding, due to some forward-referenced symbol. You can either remove the forward reference or explicitly provide the type information as part of the expression. For example,

_    jmp X         ;warning here _    jmp SHORT X   ;no warning _X:


Invalid Model Type

The model directive has an invalid memory model keyword. For example,

   .MODEL GIGANTIC

Valid memory models are tiny, small, compact, medium, large, and huge.


Invalid Operand(s) to Instruction

The instruction has a combination of operands that are not permitted. For example,

   fadd  ST(2),ST(3)

Here, FADD can only refer to one stack register by name; the other must be the stack top.


Labels Can't Start with Numeric Characters

You have entered a symbol that is neither a valid number nor a valid symbol name, such as 123XYZ.


Line Too Long--Truncating

The current line in the source file is longer than 255 characters. The excess characters will be ignored.


Location Counter Overflow

The current segment has filled up, and subsequent code or data will overwrite the beginning of the segment. For example,

   ORG 0FFF0h

   ARRAY  DW 20 DUP (0)    ;overflow


Missing Argument List

An IRP or IRPC repeat block directive does not have an argument to substitute for the dummy parameter. For example,

   IRP X           ;no argument list

      DB X

   ENDM

IRP and IRPC must always have both a dummy parameter and an argument list.


Missing Argument or <

You forgot the angle brackets or the entire expression in an expression that requires them. For example,

   ifb    ;needs an argument in <>s


Missing Argument Size Variable

An ARG or LOCAL directive does not have a symbol name following the optional = at the end of the statement. For example,

   ARG   A:WORD,B:DWORD=   ;error, no name after =

   LOCAL X:TBYTE=          ;same error here

ARG and LOCAL must always have a symbol name if you have used the optional equal sign (=) to indicate that you want to define a size variable.


Missing COMM ID

A COMM directive does not have a symbol name before the type specifier. For example,

   COMM NEAR  ;error, no symbol name before "NEAR"

COMM must always have a symbol name before the type specifier, followed by a colon (:) and then the type specifier.


Missing Dummy Argument

An IRP or IRPC repeat block directive does not have a dummy parameter. For example,

   IRP              ;no dummy parameter

      DB X

   ENDM

IRP and IRPC must always have both a dummy parameter and an argument list.


Missing End Quote

A string or character constant did not end with a quote character. For example,

   DB   "abc       ;missing " at end of ABC

   mov  al,'X      ;missing ' after X

You should always end a character or string constant with a quote character matching the one that started it.


Missing Macro ID

A macro defined with the MACRO directive has not been given a name. For example,

   MACRO               ;error, no name

         DB A

         ENDM

Macros must always be given a name when they are defined.


Missing Module Name

You have used the NAME directive but you haven't supplied a module name after the directive. Remember that the NAME directive only has an effect in Ideal mode.


Missing or Illegal Language ID

You have entered something other than one of the allowed language identifiers after the .MODEL directive.


Missing or Illegal Type Specifier

A statement that needed a type specifier (like BYTE, WORD, and so on) did not find one where expected. For example,

   RED  LABEL XXX      ;error, "XXX" is not a type

                       ;   specifier


Missing Term in List

In Ideal mode, a directive that can accept multiple arguments (EXTRN, PUBLIC, and so on) separated by commas does not have an argument after one of the commas in the list. For example,

   EXTRN XXX:BYTE,,YYY:WORD

In Ideal mode, all argument lists must have their elements separated by precisely one comma, with no comma at the end of the list.


Missing Text Macro

You have not supplied a text macro argument to a directive that requires one. For example,

   NEWSTR  SUBSTR  ;ERROR - SUBSTR NEEDS ARGUMENTS


Model must be Specified First

You used one of the simplified segmentation directives without first specifying a memory model. For example,

   .CODE        ;error, no .MODEL first

You must always specify a memory model using the .MODEL directive before using any of the other

simplified segmentation directives.


Module is Pass Dependent--Compatibility Pass was Done
Module is Pass-Dependent--Compatibility Pass was Done

This warning occurs if a pass-dependent construction was encountered and the /m command-line switch was specified. A MASM-compatible pass was done.


Name Must Come First

You put a symbol name after a directive, and the symbol name should come first. For example,

   STRUC ABC    ;error, ABC must come before STRUC

Since Ideal mode expects the name to come after the directive, you will encounter this error if you try to assemble Ideal mode programs in MASM mode.


Near Jump or Call to Different CS

This error occurs if the user attempts to perform a NEAR CALL or JMP to a symbol that's defined in an area where CS is assumed to a different segment.


Need Address or Register

An instruction does not have a second operand supplied, even though there is a comma present to separate two operands; for example,

   mov ax,             ;no second operand


Need Angle Brackets for Structure Fill

A statement that allocates storage for a structure does not specify an initializer list. For example,

   STR1 STRUC

   M1   DW   ?

   M2   DD   ?

        ENDS

        STR1         ;no initializer list


Need Colon

An EXTRN, GLOBAL, ARG, or LOCAL statement is missing the colon after the type specifier (BYTE, WORD, and so on). For example,

   EXTRN X BYTE,Y:WORD      ;X has no colon


Need Expression

An expression has an operator that is missing an operand. For example,

   X = 4 + * 6


Need File Name After INCLUDE

An INCLUDE directive did not have a file name after it. For example,

   INCLUDE      ;include what?

In Ideal mode, the file name must be enclosed in quotes.


Need Left Parenthesis

A left parenthesis was omitted that is required in the expression syntax. For example,

   DB 4 DUP 7

You must always enclose the expression after the DUP operator in parentheses.


Need Pointer Expression

This error only occurs in Ideal mode and indicates that the expression between brackets, [_], does not evaluate to a memory pointer. For example,

_mov ax,[WORD PTR]

In Ideal mode, you must always supply a memory-referencing expression between the brackets.


Need Quoted String

You have entered something other than a string of characters between quotes where it is required. In Ideal mode, several directives require their argument to be a quoted string. For example,

   IDEAL

   DISPLAY "ALL DONE"


Need Register in Expression

You have entered an expression that does not contain a register name where one is required.


Need Right Angle Bracket

An expression that initializes a structure, union, or record does not end with a > to match the < that started the initializer list. For example,

   MYSTRUC STRUCNAME <1,2,3


Need Right Parenthesis

An expression contains a left parenthesis, but no matching right parenthesis. For example,

   X = 5 * (4 + 3

You must always use left and right parentheses in matching pairs.


Need Right Square Bracket

An expression that references a memory location does not end with a ] to match the [ that started the expression. For example,

   mov  ax,[si      ;error, no closing ] after SI

You must always use square brackets in matching pairs.


Need Stack Argument

A floating-point instruction does not have a second operand supplied, even though there is a comma present to separate two operands. For example,

   fadd ST,


Need Structure Member Name

In Ideal mode, the period (.) structure member operator was followed by something that was not a structure member name. For example,

_      IDEAL _STRUC DEMO _      DB   ? _ENDS _COUNT      DW 0 _      mov  ax,[(DEMO bx).]

You must always follow the period operator with the name of a member in the structure to its left.


Not Expecting Group or Segment Quantity

You have used a group or segment name where it can't be used. For example,

   CODE SEGMENT

        rol  ax,CODE  ;error, can't use segment

                      ;  name here


One Non-Null Field Allowed Per Union Expansion

When initializing a union defined with the UNION directive, more than one value was supplied. For example,

   U     UNION

      DW   ?

      DD   ?

   ENDS

   UINST U <1,2>  ;error, should be <?,2> or <1,?>

A union can only be initialized to one value.


Only One Startup Sequence Allowed

This error appears if you have more than one .STARTUP or STARTUPCODE statement in a module.


Open Conditional

The end of the source file has been reached as defined with the END directive, but a conditional assembly block started with one of the IFxxx directives has not been ended with the

ENDIF directive. For example,

   IF BIGBUF

   END            ;no ENDIF before END

This usually happens when you type END instead of ENDIF to end a conditional block.


Open Procedure

The end of the source file has been reached as defined with the END directive, but a procedure block started with the PROC directive has not been ended with the ENDP directive. For example,

   MYFUNC PROC

      END           ;no ENDIF before ENDP

This usually happens when you type END instead of ENDP to end a procedure block.


Open Segment

The end of the source file has been reached as defined with the END directive, but a segment started with the SEGMENT directive has not been ended with the ENDS directive. For example,

   DATA SEGMENT

      END          ;no ENDS before END

This usually happens when you type END instead of ENDS to end a segment.


Open Structure Definition

The end of the source file has been reached as defined with the END directive, but a structure started with the STRUC directive has not been ended with the ENDS directive. For example,

   X    STRUC

   VAL1 DW   ?

        END        ;no ENDS before it

This usually happens when you type END instead of ENDS to end a structure definition.


Operand Types Do Not Match

The size of an instruction operand does not match either the other operand or one valid for the instruction; for example,

   ABC  DB   5

        mov  ax,ABC


Pass-Dependent Construction Encountered

The statement may not behave as you expect, due to the one-pass nature of Turbo Assembler. For example,

   IF1

            ;Happens on assembly pass

   ENDIF

   IF2

            ;Happens on listing pass

   ENDIF

Most constructs that generate this error can be re-coded to avoid it, often by removing forward references.

Also, use of /m multipass switch can enable TASM to resolve these kinds of constructs.


Pointer Expression Needs Brackets

In Ideal mode, the operand contained a memory-referencing symbol that was not surrounded by brackets to indicate that it references a memory location. For example,

   B  DB   0

      mov  al,B   ;warning, Ideal mode needs [B]

Since MASM mode does not require the brackets, this is only a warning.


Positive Count Expected

A DUP expression has a repeat count less than zero. For example,

   BUF  -1 DUP (?)      ;error, count < 0

The count preceding a DUP must always be 1 or greater.


Record Field Too Large

When you defined a record, the sum total of all the field widths exceeded 32 bits. For example,

   AREC RECORD   RANGE:12,TOP:12,BOTTOM:12


Recursive Definition Not Allowed for EQU

An EQU definition contained the same name that you are defining within the definition itself. For example,

   ABC EQU TWOTIMES ABC


Register must be AL or AX

An instruction which requires one operand to be the AL or AX register has been given an invalid operand. For example,

   IN  CL,dx  ;error, "IN" must be to AL or AX


Register must be DX

An instruction which requires one operand to be the DX register has been given an invalid operand. For example,

   IN  AL,cx    ;error, must be DX register

                ;  instead of CX


Relative Jump Out of Range by _ Bytes
Relative Jump Out of Range by __ Bytes

A conditional jump tried to reference an address that was greater than 128 bytes before or 127 bytes after the current location. If this is in a USE32 segment, the conditional jump can reference between 32,768 bytes before and 32,767 bytes after the current location.


Relative Quantity Illegal

An instruction or directive has an operand that refers to a memory address in a way that can't be known at assembly time, and this is not allowed. For example,

   DATA SEGMENT PUBLIC

   X DB 0

     IF OFFSET X GT 127 ;not known at assemble time


Reserved Word Used as Symbol

You have created a symbol name in your program that Turbo Assembler reserves for its own use. Your program will assemble properly, but it is good practice not to use reserved words for your own symbol names.


Rotate Count must be Constant or CL

A shift or rotate instruction has been given an operand that is neither a constant nor the CL register. For example,

   rol  ax,DL      ;error, can't use DL as count

You can only use a constant value or the CL register as the second operand to a rotate or shift instruction.


Rotate Count Out of Range

A shift or rotate instruction has been given a second operand that is too large. For example,

   .8086

   shl   DL,3   ;error, 8086 can only shift by 1

   .286

   ror   ax,40  ;error, max shift is 31

The 8086 processor only allows a shift count of 1, but the other processors allow a shift count up to 31.


Segment Alignment Not Strict Enough

The align boundary value supplied is invalid. Either it is not a power of 2, or it specifies an alignment stricter than that of the align type in the SEGMENT directive. For example,

   DATA SEGMENT PARA

        ALIGN 32         ;error, PARA is only 16

        ALIGN 3          ;error, not power of 2


Segment Attributes Illegally Redefined

A SEGMENT directive re-opens a segment that has been previously defined, and tries to give it different attributes. For example,

   DATA SEGMENT BYTE PUBLIC

   DATA ENDS

   DATA SEGMENT PARA ;error, previously had byte

                     ;  alignment

   DATA ENDS

If you re-open a segment, the attributes you supply must either match exactly or be omitted entirely. If you don't supply any attributes when re-opening a segment, the old attributes will be used.


Segment Name is Superfluous

This warning appears with a .CODE xxx statement, where the model specified doesn't allow more than code segment.


Smart Code Generation Must be Enabled

Certain special features of code generation require SMART code generation to be enabled. These include PUSH of a pointer, POP of a pointer, and PUSH of a constant (8086 only).


String Too Long

You have built a quoted string that is longer than the maximum allowed length of 255.


Symbol Already Defined: _
Symbol Already Defined: __

The indicated symbol has previously been declared with the same type. For example,

   BB  DB  1,2,3

   BB  DB  ?          ;error, BB already defined


Symbol Already Different Kind

The indicated symbol has already been declared before with a different type. For example,

   BB  DB  1,2,3

   BB  DW  ?          ;error, BB already a byte


Symbol Has No Width Or Mask

The operand of a WIDTH or MASK operator is not the name of a record or record field. For example,

   B  DB  0

      mov ax,MASK B      ;B is not a record field


Symbol is not a Segment or Already Part of a Group

The symbol has either already been placed in a group or it is not a segment name. For example,

   DATA    SEGMENT

   DATA    ENDS

   DGROUP    GROUP DATA

   DGROUP2   GROUP DATA  ;error, DATA already

                         ;   belongs to DGROUP


Text Macro Expansion Exceeds Maximum Line Length

This error occurs when expansion of a text macro causes the maximum allowable line length to be exceeded.


Too Few Operands to Instruction

The instruction statement requires more operands than were supplied. For example,

   add  ax      ;missing second arg


Too Many Errors or Warnings

No more error messages will be displayed. The maximum number of errors that will be displayed is 100; this number has been exceeded. Turbo Assembler continues to assemble and prints warnings rather than error messages.


Too Many Initial Values

You have supplied too many values in a structure or union initialization. For example,

   XYZ   STRUC

   A1 DB ?

   A2 DD ?

   XYZ   ENDS

   ANXYZ XYZ   <1,2,3> ;error, only 2 members

                       ; in XYZ

You can supply fewer initializers than there are members in a structure or union, but never more.


Too Many Register Multipliers in Expression

An 80386 scaled index operand had a scale factor on more than one register. For example,

   mov EAX,[2*EBX+4*EDX]      ;too many scales


Too Many Registers in Expression

The expression has more than one index and one base register. For example,

   mov ax,[BP+SI+DI]      ;can't have SI and DI


Too Many USES Registers

You specified more than 8 USES registers for the current procedure.


Trailing Null Value Assumed

A data statement like DB, DW, and so on, ends with a comma. TASM treats this as a null value. For example,

   db 'hello',13,10   ;same as ...,13,10?


Undefined Symbol

The statement contains a symbol that wasn't defined anywhere in the source file.


Unexpected End of File (No END Directive)

The source file does not have an END directive as its last statement.

All source files must have an END statement.


Unknown Character

The current source line contains a character that is not part of the set of characters that make up Turbo Assembler symbol names or expressions. For example,

   add  ax,!1  ;error, exclamation is

               ;  illegal character


Unmatched ENDP: _
Unmatched ENDP: __

The ENDP directive has a name that does not match the PROC directive that opened the procedure block. For example,

   ABC PROC

   XYZ ENDP      ;error, XYZ should be ABC


Unmatched ENDS: _
Unmatched ENDS: __

The ENDS directive has a name that does not match either the SEGMENT directive that opened a segment or the STRUC or UNION directive that started a structure or union definition. For example,

   ABC STRUC

   XYZ ENDS      ;error, XYZ should be ABC

   DATA SEGMENT

   CODE ENDS     ;error, code should be DATA


USE32 Not Allowed Without .386

You have attempted to define a 32-bit segment, but you have not specified the 80386 processor first. You can only define 32-bit segments after you have used the .386 or .386P directives to set the processor to be 80386.


User Generated Error
User-Generated Error

An error has been forced by one of the directives, which then forces an error. For example,

   .ERR      ;shouldn't get here


USES has no Effect without Language

This warning appears if you specify a USES statement when no language is in effect.


Value Out Of Range

The constant is a valid number, but it is too large to be used where it appears. For example,

   DB 400


Illegal Version ID

Occurs when an illegal version ID was selected in the VERSION statement or /U switch.


Need Right Curly Bracket

Occurs during a named structure, table, or record fill when a '}' is expected but not found.


Need Method Name

The CALL..METHOD statement requires a method name after the METHOD keyword.


Expecting METHOD Keyword

The extended structure statement for defining objects expects the keyword METHOD after the parent object.


Expecting Register ID

The USES part of the CALL..METHOD expects register name(s).


Expecting Record Field Name

You used a SETFIELD or GETFIELD instruction without a field name following it.


32-Bit Segments Not Allowed Without .386

Has been extended to work with the new ability to specify USE32 in the .MODEL statement and the LARGESTACK command. Formerly was "USE32 not allowed without .386."


Record Member Not Found

A record member was specified in a named record fill that was not part of the specified record.


Missing Table Member ID

A CALL..METHOD statement was missing the method name after the METHOD keyword.


Method CALL Requires Object Name

The CALL..METHOD statement cannot obtain the object type from this instance pointer. You must specify the object name.


Operation Illegal with Static Table Member

A '.' operator was used to obtain the address of a static tablemember. This is illegal.


Illegal Register for Instruction

An illegal register was used as the source of a SETFIELD instruction or the destination of a GETFIELD instruction.


Sample Errors

Here is a list of errors and warnings produced by Turbo Assembler:

Fatal error messages

32-bit segments not allowed without .386

Argument needs type override

Argument to operation or instruction has illegal size

Arithmetic overflow

ASSUME must be segment register

Assuming segment is 32 bit

Bad keyword in SEGMENT statement

Can't add relative quantities

Can't address with currently ASSUMEd segment registers

Can't convert to pointer

Can't emulate 8087 instruction

Can't make variable public

Can't override ES segment

Can't subtract dissimilar relative quantities

Can't use macro name in expression

Can't use this outside macro

Code or data emission to undeclared segment

Constant assumed to mean immmediate constant

Constant too large

CS not correctly assumed

CS override in protected mode

CS unreachable from current segment

Declaration needs name

Directive ignored in Turbo Pascal model

Directive not allowed inside structure definition

Duplicate dummy argument: __

ELSE or ENDIF without IF

Expecting METHOD keyword

Expecting offset quantity

Expecting offset or pointer quantity

Expecting pointer type

Expecting record field name

Expecting register ID

Expecting scalar type

Expecting segment or group quantity

Extra characters on line

Forward reference needs override

Global type doesn't match symbol type

ID not member of structure

Illegal forward reference

Illegal immediate

Illegal indexing mode

Illegal instruction

Illegal instruction for currently selected processor(s)

Illegal local argument

Illegal local symbol prefix

Illegal macro argument

Illegal memory reference

Illegal number

Illegal origin address

Illegal override in structure

Illegal override register

Illegal radix

Illegal register for instruction

Illegal register multiplier

Illegal segment address

Illegal use of constant

Illegal use of register

Illegal use of segment register

Illegal USES register

Illegal version ID

Illegal warning ID

Instruction can be compacted with override

Invalid model type

Invalid operand(s) to instruction

Labels can't start with numeric characters

Line too long--truncating

Location counter overflow

Method CALL requires object name

Missing argument list

Missing argument or <

Missing argument size variable

Missing COMM ID

Missing dummy argument

Missing end quote

Missing macro ID

Missing module name

Missing or illegal language ID

Missing or illegal type specifier

Missing table member ID

Missing term in list

Missing text macro

Model must be specified first

Module is pass-dependent--compatibility pass was done

name must come first

Near jump or call to different CS

Need address or register

Need angle brackets for structure fill

Need colon

Need expression

Need file name after INCLUDE

Need left parenthesis

Need method name

Need pointer expression

Need quoted string

Need register in expression

Need right angle bracket

Need right curly bracket

Need right parenthesis

Need right square bracket

Need stack argument

Need structure member name

Not expecting group or segment quantity

One non-null field allowed per union expansion

Only one startup sequence allowed

Open conditional

Open procedure

Open segment

Open structure definition

Operand types do not match

Operation illegal with static table member

Pass-dependent construction encountered

Pointer expression needs brackets

Positive count expected

Record field too large

Record member not found

Recursive definition not allowed for EQU

Register must be AL or AX

Register must be DX

Relative jump out of range by __ bytes

Relative quantity illegal

Reserved word used as symbol

Rotate count must be constant or CL

Rotate count out of range

Segment alignment not strict enough

Segment attributes illegally redefined

Segment name is superfluous

Smart code generation must be enabled

String too long

Symbol already defined: __

Symbol already different kind

Symbol has no width or mask

Symbol is not a segment or already part of a group

Text macro expansion exceeds maximum line length

Too few operands to instruction

Too many errors or warnings

Too many initial values

Too many register multipliers in expression

Too many registers in expression

Too many USES registers

Trailing null value assumed

Undefined symbol

Unexpected end of file (no END directive)

Unknown character

Unmatched ENDP: __

Unmatched ENDS: __

USE32 not allowed without .386

User-generated error

USES has no effect without language

Value out of range


Fatal Error Messages

Fatal error messages cause Turbo Assembler to immediately stop assembling your file. Whatever caused the error prohibited the assembler from being able to continue. Here's a list of possible fatal error messages.

Bad switch __

Can't find @@file __

Can't locate file ___

Error writing to listing file

Error writing to object file

File not found

File was changed or deleted while assembly in progress

Insufficient memory to process command line

Internal error

Invalid command line

Invalid number after __

Maximum macro expansion size exceeded

Out of hash space

Out of memory

Out of string space

Too many errors found

Unexpected end of file (no END directive)


Bad Switch _
Bad switch __

You have used an invalid command-line option. See Chapter 3 of the User's Guide for a description of the command-line options.

See Also

Command line options.


Can't Find @File _
Can't Find @file __

You have specified an indirect command file name that does not exist. Make sure that you supply the complete file name. Turbo Assembler does not presume any default extension for the file name. You've probably run out of space on the disk where you asked the cross-reference file to be written.


Can't Locate File _
Can't Locate File ___

You have specified a file name with the INCLUDE directive that can't be found. Read about the INCLUDE directive in the reference guide to learn where Turbo Assembler searches for included files.

An INCLUDE file could not be located. Make sure that the name contains any necessary disk letter or directory path.


Error Writing to Listing File

You've probably run out of space on the disk where you asked the listing file to be written.


Error Writing to Object File

You've probably run out of space on the disk where you asked the object file to be written.


File Not Found

The source file name you specified on the command line does not exist. Make sure you typed the name correctly, and that you included any necessary drive or path information if the file is not in the current directory.


File Was Changed or Deleted While Assembly in Progress

Another program, such as a pop-up utility, has changed or deleted the file after Turbo Assembler opened it. Turbo Assembler can't re-open a file that was previously opened successfully.


Insufficient Memory to Process Command Line

You have specified a command line that is either longer than 64K or can't be expanded in the available memory. Either simplify the com_mand line or run Turbo Assembler with more memory free.


Internal Error

This message should never happen during normal operation of Turbo Assembler. Save the file(s) that caused the error and report it to Borland's Technical Support department.


Invalid Command Line

The command line that you used to start Turbo Assembler is badly formed. For example,

   TASM ,MYFILE

does not specify a source file to assemble. See Chapter 3 of the User's Guide for a complete description of the Turbo Assembler command line.


Invalid Number After _
Invalid Number After __

You have specified a valid command-line switch (option), but have not supplied a valid numeric argument following the switch. See Chapter 3 of the User's Guide for a discussion of the command-line options.


Maximum Macro Expansion Size Exceeded

A macro expanded into more text than would fit in the macro expansion area. Since this area is up to 64 Kb long, you will usually only see this message if you have a macro with a bug in it, causing it to expand indefinitely.


Out of Hash Space

The hash space has one entry for each symbol you define in your program. It starts out allowing 16,384 symbols to be defined, as long as Turbo Assembler is running with enough free memory. If your program has more than this many symbols, use the /KH command-line option to set the number of symbol entries you need in the hash table.


Out of Memory

You don't have enough free memory for Turbo Assembler to assemble your file.

If you have any TSR (RAM-resident) programs installed, you can try removing them from memory and try assembling your file again. You may have to reboot your system in order for memory to be properly freed.

Another solution is to split the source file into two or more source files, or rewrite portions of it so that it requires less memory to assemble. You can also use shorter symbol names, reduce the number of comments in macros, and reduce the number of forward references in your program.


Out of String Space

You don't have enough free memory for symbol names, file names, forward-reference tracking information, and macro text. You can use the /KS command-line option to allocate more memory to the string space. Normally, half of the free memory is assigned for use as string space.


Too Many Errors Found

Turbo Assembler has stopped assembling your file because it contained so many errors. You may have made a few errors that have snowballed. For example, failing to define a symbol that you use on many lines is really a single error (failing to define the symbol), but you will get an error message for each line that referred to the symbol.

Turbo Assembler will stop assembling your file if it encounters a total of 100 errors or warnings.


Unexpected End of File (No END Directive)

Your source file ended without a line containing the END directive. All source files must end with an END directive.


Predefined

All the predefined symbols can be used in both MASM and Ideal mode

$	Current location counter within the current segment

@code	Alias equate for .CODE segment name

@CodeSize	Numeric equate that indicates code memory model. (0=near, 1=far)

@Cpu	Numeric equate that returns information about current processor directive

@curseg	Alias equate for current segment

@data	Alias equate for near data group name

@DataSize	Numeric equate that indicates the data memory model (0=near, 1=far,2=huge)

??date	String equate for today's date

@fardata	Alias equate for initialized far data segment name

@fardata?	Alias equate for uninitialized far data segment name

@FileName	Alias equate for current assembly filename

??filename	String equate for current assembly filename

@Model	Numeric equate representing the model currently in effect.

@Startup	Label that marks the beginning of startup code.

??time	String equate for the current time

??version	Numeric equate for current Turbo Assembler version number

@WordSize	Numeric equate that indicates 16- or 32-bit segments (2=16-bit,4=32-bit)

@@Object	Text macro containing the name of the current object.

@@Table_<objectname>	Data type containing the object's method table.

@@TableAddr_<objectname>	Label describing the address of the instance of the object's virtual method table.

@@32Bit	Numeric equate indicating whether segments in the current model are declared as 16 bit or 32 bit.

@@Interface	Numeric equate indicating the language and operating system selected by MODEL.


Precedence

This screen covers the operators Turbo Assembler provides and their precedences.

Ideal Mode Operator Precedence The following table lists the operators in order of priority (highest is first, lowest is last).

1.	(), [], LENGTH, MASK, OFFSET, SEG, SIZE, WIDTH

2.	HIGH, LOW

3.	+, - (unary)

4.	*, /, MOD, SHL, SHR

5.	+, - (binary)

6.	EQ, GE, GT, LE, LT, NE

7.	NOT

8.	AND

9.	OR, XOR

10.	: (segment override)

11.	. (structure member selector)

12.	HIGH (before pointer), LARGE, LOW (before pointer), PTR, SHORT, SMALL, SYMTYPE

MASM Mode Operator Precedence

1.	<>, (), [], LENGTH, MASK, SIZE, WIDTH . (structure member selector)

2.	HIGH, LOW

3.	+, - (unary)

4.	: (segment override)

5.	OFFSET, PTR, SEG, THIS, TYPE

6.	*, /, MOD, SHL, SHR

7.	+, - (binary)

8.	EQ, GE, GT, LE, LT, NE

9.	NOT

10.	AND

11.	OR, XOR

12.	LARGE, SHORT, SMALL, .TYPE


TASM expressions:


(expression)
(expression)                       Ideal, MASM

Marks expression for priority evaluation.


expression1 * expression2
expression1 * expression2          Ideal, MASM

Multiplies two integer expressions. Also used with 80386 addressing modes where one expression is a register.


+ (binary)
+ (binary)                         Ideal, MASM

expression1 + expression2

Adds two integer expressions.

See Also

+ (unary)


+ (unary)
+ (unary)                          Ideal, MASM

+ expression

Indicates that expression is positive.

See Also

+ (binary)


- (binary)
- (binary)                         Ideal, MASM

expression1  -  expression2

Subtracts two expressions.


- (unary)
- (unary)                          Ideal, MASM

- expression

Changes the sign of expression.

See Also

- (binary)


.
.                                  Ideal, MASM

memptr.fieldname

Selects a structure member.


/
/                                  Ideal, MASM

expression1 / expression2

Divides two integer expressions.


:
:                                  Ideal, MASM

segorgroup : expression

Generates segment or group override.


?
?                                  Ideal, MASM

Dx  ?

Initializes with indeterminate data (where Dx is DB, DD, DF, DP, DQ, DT, or DW).


[ ]
[ ]                                Ideal, MASM

expression1[expression2]

[expression1][expression2]

MASM mode:The [] operator can be used to specify addition or register indirect memory operands.

Ideal mode:The [] operator specifies a memory reference.


AND
AND                                Ideal, MASM

expression1 AND expression2

Performs a bit-by-bit logical AND of two expressions.


BYTE
BYTE                               Ideal

BYTE expression

Forces address expression to be byte size.


BYTE PTR
BYTE PTR                           Ideal, MASM

BYTE PTR expression

Forces address expression to be byte size.


CODEPTR
CODEPTR                            Ideal, MASM

CODEPTR expression

Returns the default procedure address size depending on the current model (WORD for models with NEAR code, DWORD for models with FAR code). CODEPTR can be used wherever DATAPTR is used.

See Also

DATAPTR

RETCODE


DATAPTR
DATAPTR                            Ideal

DATAPTR expression

Forces address expression to model-dependent size.

See Also

CODEPTR

RETCODE


RETCODE
RETCODE                            Ideal, MASM

It is the equivalent of RETN for models with NEAR code and RETF for models with FAR code.

See Also

CODEPTR.


DUP
DUP                                Ideal, MASM

count DUP (expression [,expression]...)

Repeats a data allocation operation count times.

See Also

Illegal forward reference error


DWORD
DWORD                              Ideal

DWORD expression

Forces address expression to be doubleword size.


DWORD PTR
DWORD PTR                          Ideal, MASM

DWORD PTR expression

Forces address expression to be doubleword size.


FAR
FAR                                Ideal

FAR expression

Forces an address expression to be a far code pointer.

FAR PTR                            Ideal, MASM FAR PTR expression

Forces an address expression to be a far code pointer.


FWORD
FWORD                              Ideal

FWORD expression

Forces address expression to be 32-bit far pointer size.

FWORD PTR                          Ideal, MASM FWORD PTR expression

Forces address expression to be 32-bit far pointer size.


EQ
EQ                                 Ideal, MASM

expression1 EQ expression2

Returns true if expressions are equal.

GE                                 Ideal, MASM expression1 GE expression2

Returns true if first expression is greater than or equal to the second expression.

GT                                 Ideal, MASM expression1 GT expression2

Returns true if first expression is greater than the second expression.

LE                                 Ideal, MASM expression1 LE expression2

Returns true if first expression is less than or equal to the second expression.

LT                                 Ideal, MASM expression1 LT expression2

Returns true if one expression is less than the other.

NE                                 Ideal, MASM expression1 NE expression2

Returns true if expressions are not equal.


HIGH
HIGH                               Ideal, MASM

HIGH expression

Returns the high part (8 bits or type size) of expression.

HIGH                               Ideal type HIGH expression

Returns the high part (8 bits or type size) of expression.


LARGE
LARGE                              Ideal, MASM

LARGE expression

Sets expression's offset size to 32 bits. In Ideal mode, this operation is legal only if 80386 code generation is enabled.


LENGTH
LENGTH                             Ideal, MASM

LENGTH name

Returns number of data elements allocated as part of name.


LOW
LOW                                Ideal, MASM

LOW expression

Returns the low part (8 bits or type size) of expression.

LOW                                Ideal type LOW expression

Returns the low part (8 bits or type size) of expression.


MASK
MASK                               Ideal, MASM

MASK recordfieldname MASK record

Returns a bit mask for a record field or an entire record.


MOD
MOD                                Ideal, MASM

expression1 MOD expression2

Returns remainder (modulus) from dividing two expressions.


NEAR
NEAR                               Ideal

NEAR expression

Forces an address expression to be a near code pointer.

NEAR PTR                           Ideal, MASM NEAR PTR expression

Forces an address expression to be a near code pointer.


NOT
NOT                                Ideal, MASM

NOT expression

Performs a bit-by-bit complement (invert) of expression.


OFFSET
OFFSET                             Ideal, MASM

OFFSET expression

Returns the offset of expression within the current segment (or the group that the segment belongs to, if using simplified segmentation directives or Ideal mode).


OR
OR                                 Ideal, MASM

 expression1 OR expression2

Performs a bit-by-bit logical OR of two expressions.


PROC
PROC                               Ideal

PROC expression

Forces an address expression to be a near or far code pointer.

PROC PTR                           Ideal, MASM PROC PTR expression

Forces an address expression to be a near or far code pointer.


PTR
PTR                                Ideal, MASM

type PTR expression

Forces address expression to have type size.

See Also

Argument needs type override error

Can't convert to pointer error.


PWORD
PWORD                              Ideal

PWORD expression

Forces address expression to be 32-bit far pointer size.

PWORD PTR                          Ideal, MASM PWORD PTR expression

Forces address expression to be 32-bit far pointer size.


QWORD
QWORD                              Ideal

QWORD expression

Forces address expression to be quadword size.

QWORD PTR                          Ideal, MASM QWORD PTR expression

Forces address expression to be quadword size.


SEG
SEG                                Ideal, MASM

SEG expression

Returns the segment address of an expression that references memory.


SHL
SHL                                Ideal, MASM

expression SHL count

Shifts the value of expression to the left count bits. A negative count causes the data to be shifted the opposite way.


SHORT
SHORT                              Ideal, MASM

SHORT expression

Forces expression to be a short code pointer (within -128 to +127 bytes of the current code location).


SHR
SHR                                Ideal, MASM

expression SHR count

Shifts the value of expression to the right count bits. A negative count causes the data to be shifted the opposite way.


SIZE
SIZE                               Ideal, MASM

SIZE name

Returns size of data item allocated with name.

In MASM mode, SIZE returns the value of LENGTH name multiplied by TYPE name.

In Ideal mode, SIZE returns the byte count within name's DUP.


SMALL
SMALL                              Ideal, MASM

SMALL expression

Sets expression's offset size to 16 bits. In Ideal mode, this operation is legal only if 80386 code generation is enabled.


TBYTE
TBYTE                              Ideal

TBYTE expression

Forces address expression to be 10-byte size.

TBYTE PTR                          Ideal, MASM TBYTE PTR expression

Forces address expression to be 10-byte size.


THIS
THIS                               Ideal, MASM

THIS type

Creates an operand whose address is the current segment and location counter. type describes the size of the operand and whether it refers to code or data.


TYPE
.TYPE                              MASM

.TYPE expression

Returns a byte describing the mode and scope of expression.

TYPE                               Ideal, MASM TYPE  expression

Returns a number indicating the size or type of expression.

SYMTYPE                            Ideal SYMTYPE <expression>

Returns a byte describing expression.


UNKNOWN
UNKNOWN                            Ideal

UNKNOWN expression

Removes type information from address expression.


WIDTH
WIDTH                              Ideal, MASM

WIDTH recordfieldname

WIDTH record

Returns the width in bits of a field in a record, or of an entire record.


WORD
WORD                               Ideal

WORD expression

Forces address expression to be word size.

WORD PTR                           Ideal, MASM WORD PTR expression

Forces address expression to be word size.


XOR
XOR                                Ideal, MASM

expression1 XOR expression2

Performs bit-by-bit logical exclusive OR of two expressions.


The Special Macro Operators

&   Ideal, MASM &name

Substitutes actual value of macro parameter name.

< >   Ideal, MASM <text>

Treats text literally, regardless of any special characters it might contain.

!   Ideal, MASM !character

Treats character literally, regardless of any special meaning it might otherwise have.

%   Ideal, MASM %text

Treats text as an expression, computes its value and replaces text with the result. text may be either a numeric expression or a text equate.

 ;;   Ideal, MASM

Suppresses storage of a comment in a macro definition.


Processor Selection

P8086	Ideal, MASM

.8086	MASM

Enables assembly of 8086 processor instructions only. This is the default processor instruction mode used by Turbo Assembler.

P8087	Ideal, MASM

.8087	MASM

Enables assembly of 8087 numeric coprocessor instructions only. This is the default coprocessor instruction mode used by Turbo Assembler.

PNO87	Ideal, MASM

Prevents the assembling of numeric coprocessor instructions (real or emulated).

P186	Ideal, MASM

.186	MASM

Enables assembly of 80186 processor instructions.

P286	Ideal, MASM

.286	MASM

Enables assembly of non-privileged (real mode) 80286 processor instructions and 80287 numeric coprocessor instructions.

P286N	Ideal, MASM

.286C	MASM

Enables assembly of non-privileged (real mode) 80286 processor instructions and 80287 numeric coprocessor instructions.

P286P	Ideal, MASM

.286P	MASM

Enables assembly of all 80286 (including privileged mode) processor instructions and 80287 numeric coprocessor instructions.

P287	Ideal, MASM

.287	MASM

Enables assembly of 80287 numeric coprocessor instructions.

P386	Ideal, MASM

.386	MASM

Enables assembly of non-privileged (real mode) 80386 processor instructions and 80387 numeric coprocessor instructions.

P386N	Ideal, MASM

.386C	MASM

Enables assembly of non-privileged (real mode) 80386 processor instructions and 80387 numeric coprocessor instructions.

P386P	Ideal, MASM

.386P	MASM

Enables assembly of all 80386 (including privileged mode) processor instructions and 80387 numeric coprocessor instructions.

P387	Ideal, MASM

.387	MASM

Enables assembly of 80387 numeric coprocessor instructions.

P486N	Ideal, MASM

.486	MASM

.486c	MASM

Enables assembly of non-protected instructions for the 486 processor.

P486	Ideal, MASM

.486P	MASM

Enables assembly of protected instructions for the 486 processor.

Example:

   .186

   push 1    ;valid instruction on 186

P487	Ideal, MASM

.487	MASM

Selects the processing of coprocessor instructions on the 486SX.

See Also

Constant too large error

CS override in protected mode error.


Misc

:	Ideal, MASM

Name

Defines a near code label called name.

=     Ideal, MASM

name = expression

Defines or redefines a numeric equate.

You can redefine a symbol that was defined using the = directive, allowing you to use the symbols as counters. (See the example that follows.)

You can't use = to assign strings or to redefine keywords or instruction mnemonics; you must use EQU to do these things.

The = directive has far more predictable behavior than the EQU directive in MASM mode, so you should use = instead of EQU wherever you can.

Example

  BitMask = 1    ;initialize bit

  mask

  BittBl  LABEL BYTE

    REPT 8

    DB   BitMask

  BitMask = BitMask * 2   ;shift the bit to left

    ENDM


ALIGN
ALIGN                              Ideal, MASM

ALIGN boundary

Rounds up the location counter to a power-of-two address boundary (2, 4, 8, ...).

You can't reliably align to a boundary that is more strict than the segment alignment in which the ALIGN directive appears.

Example

  ALIGN  4    ;align to DWORD boundary for 386

  BigNum  DD  12345678

See Also

EVEN

EVENDATA


.ALPHA
.ALPHA                             MASM

Set alphanumeric segment-ordering. The /a command-line option perform the same function.

Example

   .ALPHA

  XYZ  SEGMENT

  XYZ  ENDS

  ABC  SEGMENT    ;this segment will be first

  ABC  ENDS

See Also

command line option /a


ARG
ARG                                Ideal, MASM

ARG argument [,argument] ... [=symbol]    [RETURNS argument [,argument]]

Sets up arguments on the stack for procedures. Each argument is assigned a positive offset from the BP register, presuming that both the return address of the procedure call and the caller's BP have been pushed onto the stack already. Each argument has the following syntax (uppercase items are literal):

argname[[count1]] [:[distance] PTR] type] [:count2]

argname is the name you'll use to refer to this argument throughout the procedure. distance is optional and can be either NEAR or FAR to indicate that the argument is a pointer of the indicated size. type is the data type of the argument and can be BYTE, WORD, DATAPTR, CODEPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, or a structure name. count1 and count2 are the number of elements of the specified type. The total count is calculated as count1 * count2.

If you don't specify type, WORD is assumed.

The argument name variables remain defined within the procedure as BP-relative memory operands. For example,

Func1 PROC NEAR       ARG A:WORD,B:DWORD:4,C:BYTE = D

defines A as [BP+4], B as [BP+6], C as [BP+14], and D as 20.

Argument names that begin with the local symbol prefix when local symbols are enabled are limited in scope to the current procedure.

If you end the argument list with an equal sign (=) and a symbol, that symbol will be equated to the total size of the argument block in bytes. You can then use this value at the end of the procedure as an argument to the RET instruction, which effects a stack cleanup of any pushed arguments before returning (this is the Pascal calling convention).

Note that byte sized arguments are considered to take 2 bytes of stack space, unless an explicit count field is specified.

The optional RETURNS keyword introduces one or more arguments that won't be popped from the stack when the procedure returns to its caller. Normally, if you specify the language as PASCAL or TPASCAL when using the .MODEL directive, all arguments are popped when the procedure returns.

A sample Pascal procedure:

fp  PROC FAR     ARG  SRC:WORD,DEST:WORD = ARGLEN

    push bp

    mov  bp,sp

    mov  di,DEST

    mov  si,SRC

    ;<Procedure body>

    pop  bp

    ret  ARGLEN

fp  ENDP

See Also

LOCAL

PROC

USES


ASSUME
ASSUME                             Ideal, MASM

ASSUME segmentreg:name [,segmentreg:name]... ASSUME segmentreg:NOTHING ASSUME NOTHING

Specifies the segment register (segmentreg) that will be used to calculate the effective addresses for all labels and variables defined under a given segment or group name (name). The NOTHING keyword cancels the association between the designated segment register and segment or group name. The ASSUME NOTHING statement removes all associations between segment registers and segment or group names.

Example

  DATA   SEGMENT

  mov  ax,DATA

  mov  ds,ax

  ASSUME ds:DATA

See Also

ASSUME must be segment register error

GROUP

SEGMENT


%BIN
%BIN                               Ideal, MASM

%BIN size

Sets the width of the object code field in the listing file to size columns.


CATSTR
CATSTR                             Ideal, MASM51

name CATSTR string [,string]...

Concatenates several strings to form a single string name.

Each string can be one of the following:

A string argument enclosed in angle brackets, like <abc>.

A previously defined text macro.

A numeric string substitution starting with percent (%).

Example

   LETTERS CATSTR <abc>,<def>  ;LETTERS = "abcdef"

See Also

INSTR

SIZESTR

SUBSTR


CODESEG
CODESEG                            Ideal, MASM

.CODE                              MASM

.CODE [name] CODESEG [name]

Defines the start of a code segment when used with the .MODEL directive. If you have specified the medium or large memory model, you can follow the .CODE (or CODESEG) directive with an optional name that indicates the name of the segment.

Example

   CODESEG     ;here comes the code

  mov al,[X]

  DATASEG     ;switch to data segment

  X DB ?

See Also

DATASEG

FARDATA

FARDATA?

MODEL

STACK


COMM
COMM                               Ideal, MASM

COMM definition [,definition]...

Defines a communal variable. Each definition describes a symbol and has the following format:

[distance] symbolname:type [:count]

distance can be either NEAR or FAR and defaults to the size of the default data memory model if not specified. symbolname is the symbol that is to be communal. If distance is FAR, symbolname may also specify an array element size multiplier to be included in the total space computation (name[multiplier]). type is one of: BYTE, WORD, DATAPTR, CODEPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, or a structure name.

count specifies how many items this communal symbol defines (default is 1).

Communal variables are allocated by the linker.

In MASM mode, communal symbols declared outside of any segment are presumed to be reachable via the DS register, which may not always be a valid assumption. Make sure that you either place the correct segment value in DS or use an explicit segment override when referring to these variables. In Ideal mode, Turbo Assembler correctly checks for whether the communal variable is addressable, using any of the current segment registers as described with the ASSUME directive.

Communal variables can't be initialized. Use the GLOBAL directive if you wish to initialize data items that are to be shared between modules. The linker also doesn't guarantee the allocation of communal variables in any particular order, so you can't make assumptions about data items allocated by COMM directives on sequential source lines.

Example

  COMM buffer:BYTE:512   ; 512 bytes allocated at

                         ;  link time

  COMM FAR abc[41]:BYTE:10 ;410 bytes (10 elements

                           ; of 41 bytes) allocated

                           ; at link time

See Also

EXTRN

GLOBAL

PUBLIC

PUBLICDLL

Missing COMM ID error


comment
COMMENT                            MASM

COMMENT delimiter [text] [text] delimiter [text]

Starts a multiline comment. delimiter is the first non-blank character following COMMENT.


%conds
%CONDS                             Ideal, MASM

Shows all statements in conditional blocks in the listing. This is the default mode for Turbo Assembler.

See Also

.LFCOND

%NOCONDS

.SFCOND

.TFCOND


CONST
CONST                              Ideal, MASM

.CONST                             MASM

Defines the start of the constant data segment.


%CREF
%CREF                              Ideal, MASM

.CREF	MASM

Allows cross-reference information to be accumulated for all symbols encountered from this point forward in the source file. .CREF reverses the effect of any %XCREF or .XCREF directives that inhibited the information collection.

%CREFALL	Ideal, MASM

Causes all subsequent symbols in the source file to appear in the cross-reference listing. This is the default mode for Turbo Assembler. %CREFALL reverses the effect of any previous %CREFREF or %CREFUREF directives that disabled the listing of unreferenced or referenced symbols.

%CREFREF	Ideal, MASM

Disables listing of unreferenced symbols in cross-reference.

%CREFUREF	Ideal, MASM

Lists only the unreferenced symbols in cross-reference.


%CTLS
%CTLS                              Ideal, MASM

Causes listing control directives (such as %LIST, %INCL, and so on) to be placed in the listing file.

See Also

%NOCTLS


DATASEG
DATASEG                            Ideal

.DATA                              MASM

Defines the start of the initialized data segment in your module. You must first have used the .MODEL directive to specify a memory model. The data segment is put in a group called DGROUP, which also contains the segments defined with the .STACK, .CONST, and .DATA? directives.

See Also

CODESEG

CONST

.DATA?

DATASEG

.FARDATA

.FARDATA?

.MODEL

.STACK


.Data?

UDATA                              Ideal, MASM

.DATA?                             MASM

Defines the start of the uninitialized data segment in your module. You must first have used the .MODEL directive to specify a memory model. The data segment is put in a group called DGROUP, which also contains the segments defined with the .STACK, .CONST, and .DATA directives.


DB
DB                                 Ideal, MASM

[ name ] DB  expression  [, expression ]...

Allocates and initializes a byte of storage. name is the symbol you'll subsequently use to refer to the data. expression can be a constant expression, a question mark, a character string, or a Duplicated expression.


DD
DD                                 Ideal, MASM

[ name ] DD [ type  PTR]  expression  [, expression ]...

Allocates and initializes 4 bytes (a doubleword) of storage. name is the symbol you'll subsequently use to refer to the data. type followed by PTR adds debug information to the symbol being defined, so that Turbo Debugger can display its contents properly. type is one of the following: BYTE, WORD, DATAPTR, CODEPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, SHORT, NEAR, FAR or a structure name.

expression can be a constant expression, a 32-bit floating-point number, a question mark, an address expression, or a DUPlicated expression.


%DEPTH
%DEPTH                             Ideal, MASM

%DEPTH  width

Sets size of depth field in listing file to width columns. The default is 1 column.


DF
DF                                 Ideal, MASM

[ name ] DF [ type  PTR]  expression  [, expression ]

Allocates and initializes 6 bytes (a far 48-bit pointer) of storage. name is the symbol you'll subsequently use to refer to the data. type followed by PTR adds debug information to the symbol being defined, so that Turbo Debugger can display its contents properly. type is one of the following: BYTE, WORD, DATAPTR, CODEPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, SHORT, NEAR, FAR or a structure name.

expression can be a constant expression, a question mark, an address expression or a duplicated (DUP) expression.


DISPLAY
DISPLAY                            Ideal, MASM

DISPLAY " text "

Outputs a quoted string ( text ) to the screen.


DOSSEG
DOSSEG                             Ideal, MASM

Enables DOS segment-ordering at link time.


DP
DP                                 Ideal, MASM

[ name ]  DP  [ type  PTR]  expression  [, expression ]...

Allocates and initializes 6 bytes (a far 48-bit pointer) of storage. name is the symbol you'll subsequently use to refer to the data. type followed by PTR adds debug information to the symbol being defined, so that Turbo Debugger can display its contents properly. type is one of the following: BYTE, WORD, DATAPTR, CODEPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, SHORT, NEAR, FAR or a structure name.

expression can be a constant expression, a question mark, an address expression, or a DUPlicated expression.


DQ
DQ                                 Ideal, MASM

[ name ] DQ  expression  [, expression ]...

Allocates and initializes 8 bytes (a quadword) of storage. name is the symbol you'll subsequently use to refer to the data. expression can be a constant expression, a 64-bit floating-point number, a question mark, or a duplicated expression.


dt
DT                                Ideal, MASM

[ name ] DT  expression  [, expression ]...

Allocates and initializes 10 bytes of storage. name is the symbol you'll subsequently use to refer to the data. expression can be a constant expression, a 64-bit floating-point number, a question mark, or a duplicated expression.


DW
DW                                Ideal, MASM

[ name ] DW [ type  PTR]  expression  [, expression ]...

Allocates and initializes 2 bytes (a word) of storage. name is the symbol you'll subsequently use to refer to the data. type followed by PTR adds debug information to the symbol being defined, so that Turbo Debugger can display its contents properly. type is one of the following: BYTE, WORD, DATAPTR, CODEPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, SHORT, NEAR, FAR or a structure name.

expression can be a constant expression, a question mark, an address expression, or a DUPlicated expression.


ELSE
ELSE                               Ideal, MASM

ELSE

IF  condition    statements1

[ELSE    statements2 ]

ENDIF

Starts alternative conditional assembly block. The statements introduced by ELSE (statements2) are assembled if condition evaluates to false.


ELSEIF
ELSEIF                             Ideal, MASM

ELSEIF

IF  condition1    statements1

[ELSEIF  condition2    statements2 ]

ENDIF

Starts nested conditional assembly block if condition2 is true. Several other forms of ELSEIF are supported: ELSEIF1, ELSEIF2, ELSEIFB, ELSEIFDEF, ELSEIFDIF, ELSEIFDIFI, ELSEIFE, ELSEIFIDN, ELSEIFIDNI, ELSEIFNB, and ELSEIFNDEF.


EMUL
EMUL                               Ideal, MASM

Causes all subsequent numeric coprocessor instructions to be generated as emulated instructions, instead of real instructions. When your program is executed, you must have a software floating-point emulation package installed or these instructions will not work properly.

See Also

Can't emulate 8087 instruction error.


END
END                                Ideal, MASM

END [ startaddress ]

Marks the end of a source file. startaddress is a symbol or expression that specifies the address in your program where you want execution to begin. Turbo Assembler ignores any text that appears after the END directive.

See Also

Open conditional error

Open procedure error

Open segment error

Open structure definition error


ENDIF
ENDIF                              Ideal, MASM

ENDIF

IF  condition    statements

ENDIF

Marks the end of a conditional assembly block started with one if the IFxxx directives.

See Also

Open conditional error.


ENDM
ENDM                               Ideal, MASM

Marks the end of a repeat block or a macro definition.

See Also

Can't use this outside macro error.


ENDP
ENDP                               Ideal, MASM

ENDP [ procname ] [ procname ] ENDP

Marks the end of a procedure. If procname is supplied, it must match the procedure name specified with the PROC directive that started the procedure definition.

See Also

Open procedure error.


ENDS

ENDS [ segmentname  |  strucname ]   Ideal, MASM [ segmentname  |  strucname ]ENDS    MASM

Marks end of current segment, structure or union. If you supply the optional name, it must match the name specified with the corresponding SEGMENT, STRUC, or UNION directive.

See Also

Open segment error.


EQU
EQU                                Ideal, MASM

name  EQU  expression

Defines name to be a string, alias, or numeric equate containing the result of evaluating expression.

See Also

= for numeric equates.


ERR <string>
ERR <string>                       Ideal, MASM

.ERR <string>	MASM

Forces an error to occur at the line that this directive is encountered on in the source file. The optional string will display as part of the error message.

ERRIF1 <string>	Ideal, MASM

.ERR1 <string>	MASM

Forces an error to occur on pass 1 of assembly. The optional string will display as part of the error message.

ERRIF2 <string>	Ideal, MASM

.ERR2 <string>	MASM

Forces an error to occur on pass 2 of assembly if multiple-pass mode (controlled by  /m command-line option) is enabled. The optional string will display as part of the error message.

ERRIFB  <string>	Ideal, MASM

ERRIFB < argument > <string> .ERRB <string>	MASM

.ERRB < argument > <string>

Forces an error to occur if argument is blank (empty). The optional string will display as part of the error message.

ERRIFDEF <string>	Ideal, MASM

ERRIFDEF  symbol <string> .ERRDEF <string>	MASM

.ERRDEF  symbol <string>

Forces an error to occur if symbol is defined. The optional string will display as part of the error message.

ERRIFDIF <string>	Ideal, MASM

ERRIFDIF < argument1 >,< argument2 > <string> .ERRDIF <string>	MASM

.ERRDIF < argument1 >,< argument2 > <string>

Forces an error to occur if arguments are different. The comparison is case-sensitive. The optional string will display as part of the error message.

ERRIFDIFI <string>	Ideal, MASM

ERRIFDIFI < argument1 >,< argument2 > <string> .ERRDIFI <string>	MASM

.ERRDIFI < argument1 >,< argument2 > <string>

Forces an error to occur if arguments are different. The comparison is not case-sensitive. The optional string will display as part of the error message.

ERRIFE <string>	Ideal, MASM

ERRIFE  expression <string> .ERRE <string>	MASM

.ERRE  expression <string>

Forces an error to occur if expression is false (0). The optional string will display as part of the error message.

ERRIFIDN <string>	Ideal, MASM

ERRIFIDN < argument1 >,< argument2 > <string> .ERRIDN <string>	MASM

.ERRIDN < argument1 >,< argument2 > <string>

Forces an error to occur if arguments are identical. The comparison is case-sensitive. The optional string will display as part of the error message.

ERRIFIDNI <string>	Ideal, MASM

ERRIFIDNI < argument1 >,< argument2 > <string> .ERRIDNI  <string>	MASM

.ERRIDNI < argument1 >,< argument2 > <string>

Forces an error to occur if arguments are identical. The comparison is not case-sensitive. The optional string will display as part of the error message.

ERRIF <string>	Ideal, MASM

ERRIF  expression <string> .ERRNZ <string>	MASM

.ERRNZ  expression <string>

Forces an error to occur if expression is true (nonzero). The optional string will display as part of the error message.

ERRIFNB <string>	Ideal, MASM

ERRIFNB < argument > <string> .ERRNB <string>	MASM

.ERRNB < argument > <string>

Forces an error to occur if argument is not blank. The optional string will display as part of the error message.

ERRIFNDEF <string>	Ideal, MASM

ERRIFNDEF  symbol <string> .ERRNDEF <string>	MASM

.ERRNDEF  symbol <string>

Forces an error to occur if symbol is not defined. The optional string will display as part of the error message.


EVEN
EVEN                               Ideal, MASM

Rounds up the location counter to the next even address.


EVENDATA
EVENDATA                           Ideal, MASM

Rounds up the location counter to the next even address in a data segment.


EXITM
EXITM                              Ideal, MASM

Terminates macro- or block-repeat expansion and returns control to the next statement following the macro or repeat-block call.

See Also

Can't use this outside macro error


EXTRN
EXTRN                              Ideal, MASM

EXTRN  definition  [, definition ]...

Indicates that a symbol is defined in another module. definition describes a symbol and has the following format:

[ language ]  name : type  [: count ]

language specifies that the naming conventions of C, PASCAL, BASIC, FORTRAN, ASSEMBLER, or PROLOG are to be applied to symbol name. name is the symbol that is defined in another module. type must match the type of the symbol where it s defined and must be one of the following: NEAR, FAR, PROC, BYTE, WORD, DWORD, DATAPTR, CODEPTR, FWORD, PWORD, QWORD, TBYTE, ABS, or a structure name. count specifies how many items this external symbol defines and defaults to one if not specified.

See Also

Can't make variable public error


FARDATA
FARDATA                            Ideal, MASM

FARDATA [ segmentname ] .FARDATA                           MASM .FARDATA [ segmentname ]

Defines the start of a far initialized data segment. segmentname, if present, overrides the default segment name.


FARDATA
UFARDATA                           Ideal, MASM

UFARDATA [ segmentname ] .FARDATA?                          MASM .FARDATA? [ segmentname ]

Defines the start of a far uninitialized data segment. segmentname, if present, overrides the default segment name.


GLOBAL
GLOBAL                             Ideal, MASM

GLOBAL  definition  [, definition ]...

Acts as a combination of the EXTRN and PUBLIC directives to define a global symbol. definition describes the symbol and has the following format:

[ language ]  name : type  [: count ]

language specifies that the naming conventions of C, PASCAL, BASIC, FORTRAN, ASSEMBLER, or PROLOG are to be applied to symbol name. If name is defined in the current source file, it is made public exactly as if used in a PUBLIC dire tive. If not, it is declared as an external symbol of type type, as if the EXTRN directive had been used. type must match the type of the symbol in the module where it is defined, and must be one of the following: NEAR, FAR, PROC, BYTE, WORD, DATAPTR, CODEPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, ABS, or a structure name. count specifies how many items this symbol defines (one is the default).

See Also

Global type doesn't match symbol type error.


GROUP
GROUP                              Ideal, MASM

GROUP  groupname   segmentname  [, segmentname ]... groupname  GROUP  segmentname  [, segmentname ]...

Associates groupname with one or more segments, so that all labels and variables defined in those segments have their offsets computed relative to the beginning of group groupname . segmentname can be either a segment name defined previously with SEGMENT or an expression starting with SEG . In MASM mode, you must use a group override whenever you access a symbol in a segment that is part of a group. In Ideal mode, Turbo Assembler automatically generates group overrides for such symbols.


IDEAL
IDEAL                              Ideal, MASM

Enters Ideal assembly mode. Ideal mode will stay in effect until it is overridden by a MASM or QUIRKS directive.


IF
IF                                 Ideal, MASM

IF

IF  expression    true  statements

[ELSE    falsestatements ]

ENDIF

Initiates a conditional block, causing the assembly of true statements up to the optional ELSE directive, provided that expression is true (nonzero).

Other ways to open a conditional block are:

IF1	Ideal, MASM

Initiates a conditional block, provided that the current assembly pass is pass one.

IF2	Ideal, MASM

Initiates a conditional block, provided that multiple-pass mode (controlled by the  /m command-line option) is enabled and the current assembly pass is pass two.

IFB	Ideal, MASM

IFB < argument >

Initiates a conditional block, causing the assembly of  true  statements  up to the optional  ELSE  directive, provided that argument  is blank (empty).

IFDEF	Ideal, MASM

Initiates a conditional block, provided that symbol is defined.

IFDIF	Ideal, MASM

Initiates a conditional block, provided that the arguments are different. The comparison is case- sensitive.

IFDIFI	Ideal, MASM

IFDIFI < argument1 >,< argument2 >

Initiates a conditional block, provided that the arguments are different. The comparison is not case-sensitive.

IFE	Ideal, MASM

Initiates a conditional block, provided that expression  is false.

IFIDN	Ideal, MASM

IFIDN < argument1 >,< argument2 >

Initiates a conditional block, provided that the arguments are identical. The comparison is case- sensitive.

IFIDNI	Ideal, MASM

IFIDNI < argument1 >,< argument2 >

Initiates a conditional block, provided that the arguments are identical. The comparison is not case-sensitive.

IFNB	Ideal, MASM

IFNB < argument >

Initiates a conditional block, provided that argument  is nonblank.

IFNDEF	Ideal, MASM

Initiates a conditional block, provided that symbol is not defined.

See Also

ELSE or ENDIF without IF error

Illegal forward reference error

Open conditional error


incl
"%INCL"                            Ideal, MASM

Enables listing of include files. This is the default INCLUDE file listing mode.


INCLUDE

INCLUDE " filename "               Ideal, MASM INCLUDE  filename                  MASM

Includes source code from file filename at the current position in the module being assembled. If no extension is specified, .ASM is assumed.


INCLUDELIB
INCLUDELIB                         Ideal, MASM

INCLUDELIB " filename "            Ideal, MASM INCLUDELIB  filename               MASM

Causes the linker to include library filename at link time. If no extension is specified, .LIB is assumed.


INSTR
INSTR                              Ideal, MASM51

name  INSTR [ start, ] string1, string2

name is assigned the position of the first instance of string2 in string1. Searching begins at position start (position one if start not specified). If string2 does not appear anywhere within string1, name is set to zero.


IRP
IRP                                Ideal, MASM

IRP  parameter,< arg1 [, arg2 ]...>  statements

ENDM

Repeats a block of statements with string substitution. statements are assembled once for each argument present. The arguments may be any text, such as symbols, strings, numbers, and so on. Each time the block is assembled, the next argument in he list is substituted for any instance of parameter in the statements.


IRPC
IRPC                               Ideal, MASM

IRPC  parameter, string  statements

ENDM

Repeats a block of statements with character substitution. statements are assembled once for each character in string. Each time the block is assembled, the next character in the string is substituted for any instances of parameter in statements.


JUMPS
JUMPS                              Ideal, MASM

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. This directive has the same effect as using the /JJUMPS command-line option.

JUMPS directive has been extended to allow it to expand LOOP and JCXZ instructions. The code generated for an extended LOOP or JCXZ looks like this:

LOOP TARGET becomes:      LOOP @@1

     JMP  @@2

@@1: JMP  TARGET @@2:


LABEL
LABEL                              Ideal

LABEL  name   type

LABEL                              MASM  name  LABEL  type

Defines a symbol name to be of type type . name must not have been defined previously in the source file. type must be one of the following: NEAR, FAR, PROC, BYTE, WORD, DATAPTR, CODEPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, or a tructure name.


.LALL
.LALL                              MASM

Enables listing of macro expansions.


.LFCOND
.LFCOND                            MASM

Shows all statements in conditional blocks in the listing.


%LINUM
%LINUM                             Ideal, MASM

%LINUM  size

Sets the width of the line-number field in listing file to size columns. The default is four columns.


%LIST
%LIST                              Ideal, MASM

.LIST                              MASM

Shows source lines in the listing. This is the default listing mode.


LOCAL
LOCAL                              Ideal, MASM

In macros:

  LOCAL  symbol  [, symbol ]...

 In procedures:

  LOCAL  localdef  [, localdef ]... [= symbol ]

Defines local variables for macros and procedures. Within a macro definition, LOCAL defines temporary symbol names that are replaced by new unique symbol names each time the macro is expanded. LOCAL must appear before any other statements in the macro definition. Within a procedure, LOCAL defines names that access stack locations as negative offsets relative to the BP register. 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. Each localdef has the following syntax:

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

or

 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, CODEPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, or a structure name. If type is not specified using the alternative syntax, WORD size is assumed. count specifies how many elements of the specified type to allocate on the stack. Using distance and PTR includes debugging information for Turbo Debugger, telling it that this local variable is really a pointer to another data type.

See Also

Illegal local argument error

Illegal local symbol prefix error


LOCALS
LOCALS                             Ideal, MASM

LOCALS [ prefix ]

Enables local symbols, whose names will begin with two at-signs (@@@@) or the two-character prefix if it is specified. Local symbols are automatically enabled in Ideal mode.

See Also

Illegal local symbol prefix error


MACRO
MACRO                              Ideal, MASM

MACRO name  [ parameter  [, parameter ]...] name  MACRO [ parameter  [, parameter ]...]

Defines a macro to be expanded later when name is encountered. parameter is a placeholder that you use in the the body of the macro definition wherever you want to substitute one of the actual arguments the macro is called with.

See Also

Can't use macro name in expression error

Duplicate dummy argument error

Illegal macro argument error


%MACS
%MACS                             Ideal, MASM

Enables listing of macro expansions.


MASM
MASM                               Ideal, MASM

Enters MASM assembly mode. This is the default assembly mode for Turbo Assembler.


NOWARN
NOWARN                             Ideal, MASM

NOWARN [ warnclass ]

Disables warning messages with warning identifier warnclass, or all warning messages if warnclass is not specified.

WARN                               Ideal, MASM WARN [ warnclass ]

Enables the type of warning message specified with warnclass, or all warnings if warnclass is not specified.

warnclass may be one of:

ALN	Segment alignment

ASS	Assumes segment is 32-bit

BRK	Brackets needed

GTP	Type declared on global does not match type when variable is defined.

ICG	Inefficient code generation

LCO	Location counter overflow

MCP	Masm compatibility pass detection.

OPI	Open if conditional

OPP	Open procedure

OPS	Open segment

OVF	Arithmetic overflow

PDC	Pass-dependent construction

PRO	Write-to-memory in protected mode needs CS override

PQK	Assuming constant for [const] warning

RES	Reserved word warning

TPI	Turbo Pascal illegal warning


%OUT
%OUT                               MASM

%OUT  text

Displays text on screen.


MASM51
MASM51                             Ideal, MASM

Enables assembly of some MASM 5.1 enhancements.


Model Modifier

Model modifiers:

NEARSTACK implies that the stack is part of DGROUP and SS is set to DGROUP.

FARSTACK implies that the stack is not part of DGROUP.


MODEL
MODEL                              Ideal, MASM

Ideal and MASM mode: MODEL [ model modifier ]  memorymodel  [ modulename ]       [,[ language modifier ]  language ]

MODEL TPASCAL

MASM mode: .MODEL .MODEL [ model modifier ]  memorymodel  [ modulename ]      [,[ language modifier ]  language ]

.MODEL TPASCAL

Sets the memory model for simplified segmentation directives. model modifier is NEARSTACK or FARSTACK if present. memorymodel is TINY, SMALL,

MEDIUM, COMPACT, LARGE, or HUGE . modulename is used in the large models to declare the name of the code segment. language modifier is either WINDOWS or NOWINDOWS, to specify generation of MSWindows procedure entry/exit code. language specifies which language you will be calling from to access the procedures in this module: C, PASCAL, BASIC, FORTRAN, ASSEMBLER, or PROLOG. Turbo Assembler automatically generates the appropriate procedure entry and exit code when you use the PROC/ENDP directives. language also tells Turbo Assembler which naming conventions to use for public and external symbols, and in what order procedure arguments were pushed onto the stack by the calling module. Also, the appropriate form of the RET instruction is generated to remove the arguments from the stack before returning if required. The TPASCAL form is used when writing an assembler module that interfaces with Turbo Pascal.

See Also

Directive ignored in Turbo Pascal model error


MULTERRS
MULTERRS                           Ideal, MASM

Allows multiple errors to be reported on a single source line.


NAME
NAME                               Ideal, MASM

NAME  modulename

Sets the object file's module name. This directive has no effect in MASM mode; it only works in Ideal mode.

See Also

Missing module name error


%NEWPAGE
%NEWPAGE                           Ideal, MASM

Starts a new page in the listing file.


%NOCONDS
%NOCONDS                           Ideal, MASM

Disables the placement of statements in conditional blocks in the listing file.


%NOCREF
%NOCREF                            Ideal, MASM

%NOCREF [ symbol, ... ]

Disables cross-reference listing (CREF) information accumulation. If you supply one or more symbol names, cross-referencing is disabled only for those symbols.


%NOCTLS
%NOCTLS                            Ideal, MASM

Disables placement of listing-control directives in the listing file. This is the default listing-control mode for Turbo Assembler.


NOEMUL
NOEMUL                             Ideal, MASM

Causes all subsequent numeric coprocessor instructions to be generated as real instructions, instead of emulated instructions. When your program is executed, you must have an 80x87 coprocessor installed or these instructions will not work properly This is the default floating-point assembly mode for Turbo Assembler.


%NOINCL
%NOINCL                            Ideal, MASM

Disables listing of source lines from INCLUDE files.


NOJUMPS
NOJUMPS                            Ideal, MASM

Disables stretching of conditional jumps enabled with JUMPS. This is the default mode for Turbo Assembler.


%NOLIST
%NOLIST                            Ideal, MASM

Disables output to the listing file.


NOLOCALS
NOLOCALS                           Ideal, MASM

Disables local symbols enabled with LOCALS . This is the default for Turbo Assembler's MASM mode.


%NOMACS
%NOMACS                            Ideal, MASM

Lists only macro expansions that generate code. This is the default macro listing mode for Turbo Assembler.


NOMASM51
NOMASM51                           Ideal, MASM

Disables assembly of certain MASM 5.1 enhancements enabled with MASM51 . This is the default mode for Turbo Assembler.


NOMULTERRS
NOMULTERRS                         Ideal, MASM

Allows only a single error to be reported on a source line. This is the default error-reporting mode for Turbo Assembler.


NOSMART
NOSMART                            Ideal, MASM

Disables code optimizations that generate different code than MASM.

SMART                              Ideal, MASM

Enables all code optimizations.

The default condition is having SMART enabled. When NOSMART is selected, the following code generation changes occur:

AND, OR, XOR of an immediate word value are no longer done using the 'signed-extended immediate byte' version of these instructions where possible, but rather the longer 'immediate word' version that Masm uses.

PUSH of a constant value on the 8086 processor    using the special 10-byte code sequence which preserves all registers and flags is not allowed.

PUSH and POP of a DWORD memory variable (or    PWORD variable on a 386) are not allowed.

Far JMPs and CALLs within the same segment are    no longer optimized by replacing the FAR JMP or CALL with the NEAR version.

Note: When SMART is enabled, a qualifying FAR jump will be replaced by a NEAR or a SHORT jump.  This optimization formerly took place only when QUIRKS mode was enabled.  Also, when SMART is enabled, a qualifying FAR call will be replaced by a PUSH CS instruction and a NEAR call.  This optimization is new under Tasm 2.0.  For maximum Masm compatibility, you must select NOSMART and QUIRKS.


%NOSYMS
%NOSYMS                            Ideal, MASM

Disables placement of the symbol table in the listing file.


%NOTRUNC
%NOTRUNC                           Ideal, MASM

Prevents truncation of fields whose contents are longer than the corresponding field widths in the listing file.


ORG
ORG                                Ideal, MASM

ORG  expression

Sets the location counter in the current segment to the address specified by expression.

See the macro MakePascalString in MMACROS.MAC for an example that uses ORG.


Page

%PAGESIZE                          Ideal, MASM

%PAGESIZE [ rows ] [, cols ]

PAGE                               MASM PAGE [ rows ] [, cols ]

Sets the listing page height and width, starts new pages. rows specifies the number of lines that will appear on each listing page (10..255). cols specifies the number of columns wide the page will be (59..255). Omitting rows or cols leave the current setting unchanged. If you follow PAGE with a plus sign ( + ), a new page starts, the section number is incremented, and the page number restarts at 1. PAGE with no arguments forces the listing to resume on a new page, with no change in section number.


%PCNT
%PCNT                              Ideal, MASM

%PCNT  width

Sets segment:offset field width in listing file to width columns. The default is 4 for 16-bit segments and 8 for 32-bit segments.


%POPLCTL
%POPLCTL                           Ideal, MASM

Resets the listing controls to the way they were when the last %PUSHLCTL directive was issued.


PROC
PROC                               Ideal, MASM

Ideal and MASM mode: PROC [language modifier][language] name [distance]    [USES  items,] [argument [,argument]...]

   [RETURNS argument [,argument]...]

MASM mode: name PROC [language modifier] [language] [distance]    [USES  items,] [argument [,argument]...]

   [RETURNS argument [,argument]...]

Defines the start of procedure name. language modifier is either WINDOWS or NOWINDOWS, to specify generation of MSWindows entry/exit code. language specifies which language you will be calling from to access this procedure: C, PASCAL, BASIC, FORTRAN, ASSEMBLER, or PROLOG. This determines symbol naming conventions, the order of any arguments on the stack, and whether the arguments will be left on the stack when the procedure returns. distance is NEAR or FAR and determines the type of RET instruction that will be assembled at the end of the procedure. items is a list of registers and/or single-token data items to be pushed on entry and popped on exit from the procedure. argument describes an argument the procedure is called with. Each argument has the following syntax:

 argname [[count1]][[:distance][PTR]type][:count2]

argname is the name you'll use to refer to this argument throughout the procedure. distance is NEAR or FAR to indicate that the argument is a pointer of the indicated size. type is the data type of the argument and can be BYTE, WORD, DWORD, FWORD, PWORD, QWORD, TBYTE, or a structure name. WORD is assumed if none is specified. count1 and count2 are the number of elements of type. PTR tells Turbo Assembler to emit debug information to let Turbo Debugger know that the argument is a pointer to a data item. Using PTR without distance causes the pointer size to be based on the current memory model and segment address size. RETURNS introduces one or more arguments that won't be popped from the stack when the procedure returns.

See Also

Declaration needs name error

Open procedure error


PUBLIC
PUBLIC                             Ideal, MASM

PUBLIC [language] symbol [,[language]symbol]...

Declares symbol to be accessible from other modules. If language is specified (C, PASCAL, BASIC, FORTRAN, ASSEMBLER, or PROLOG), symbol is made public after having the naming conventions of the specified language applied to it.

See Also

Can't make variable public error


PUBLICDLL
PUBLICDLL                          Ideal, MASM

PUBLICDLL [language]symbol[,[language]symbol]...

Declares symbol to be accessible from other modules as a dynamic link entry point. Symbol is published in the object file as a dynamic link entry point so that it can be accessed by other programs under OS/2. If language is specified (C, PASCAL, BASIC, FORTRAN, ASSEMBLER, or PROLOG), symbol is made public after having the naming conventions of the specified language applied to it. This statement is only used to help build an OS/2 dynamic link library using Tasm.


PURGE
PURGE                              Ideal, MASM

PURGE  macroname [,macroname]...

Removes macro definition macroname.


%PUSHLCTL
%PUSHLCTL                          Ideal, MASM

Saves current listing controls on a 16-level stack.


RADIX
RADIX                              Ideal, MASM

RADIX  radix .RADIX                             MASM .RADIX  radix

Sets the default radix for integer constants in expressions to 2, 8, 10, or 16.

See Also

Illegal radix error


RECORD
RECORD                             Ideal, MASM

Ideal and MASM mode: RECORD  name  field  [, field ]...

MASM mode: name RECORD  field  [, field ]...

Defines record name that contains bit fields. Each field describes a group of bits in the record and has the following format:

fieldname : width [ =  expression ]

fieldname is the name of a field in the record. width (1..16) specifies the number of bits in the field. If the total number of bits in all fields is 8 or less, the record will occupy 1 byte; 9..16 bits will occupy 2 bytes; otherwise, it will ccupy 4 bytes. expression provides a default value for the field.


REPT
REPT                               Ideal, MASM

REPT expression    statements

ENDM

Repeats a block of statements expression times.


QUIRKS
QUIRKS                             Ideal, MASM

Allows you to assemble a source file that makes use of one of the true MASM bugs.


.SALL
.SALL                              MASM

Suppresses the listing of all statements in macro expansions.


SEGMENT
SEGMENT                            Ideal, MASM

Ideal and MASM mode: SEGMENT  name  [align] [combine] [use] ['class']

MASM mode:  name  SEGMENT [align] [combine] [use] ['class']

Defines segment name with full attribute control. If you have already defined a segment with the same name, this segment is treated as a continuation of the previous one.

align specifies the type of memory boundary where the segment must start BYTE, WORD, DWORD, PARA (default), or PAGE.

align may also include UNINIT which will cause TASM to warn if any data is written to the segment.

combine specifies how segments from different modules but with the same name will be combined at link time:

AT expression (locates segment at absolute paragraph address expression)

COMMON (locates this segment and all other segments with the same name at the same address)

MEMORY (concatenates all segments with the same name to form a single contiguous segment)

PRIVATE (does not combine this segment with any other segments; this is the default used if none specified)

PUBLIC (same as MEMORY above)

STACK (concatenates all segments with the same name to form a single contiguous segment, then initializes SS to the beginning of the segment and SP to the length of the segment.

use specifies the default word size for the segment if 80386 code generation is enabled, and can be either USE16 or USE32.

class controls the ordering of segments at link time: segments with the same class name are loaded into memory together, regardless of the order in which they appear in the source file.

See Also

Assuming segment is 32 bit error

Bad keyword in SEGMENT statement error

Declaration needs name error


.SEQ
.SEQ                               MASM

Sets sequential segment-ordering. This is the default ordering mode for Turbo Assembler. .SEQ has the same function as the /s command-line option.


.SFCOND
.SFCOND                            MASM

Prevents statements in false conditional blocks from appearing in the listing file.


SIZESTR
SIZESTR                            Ideal, MASM51

name SIZESTR  string

Assigns the number of characters in string to name. A null string has a length of zero.


.STACK
STACK                              Ideal, MASM

STACK [ size ] .STACK                             MASM .STACK [ size ]

Defines the start of the stack segment, allocating size bytes. 1024 bytes are allocated if size is not specified.


STRUC

STRUC  name                        Ideal, MASM STRUC [ name ] <modifiers><parent_name>METHOD<method_list>   <structure_data>

ENDS [ name ]

                                   MASM

[ name ] STRUC <modifiers><parent_name>METHOD<method_list>   <structure_data>

[ name ] ENDS

Defines a structure called name containing fields. Turbo Assembler 3.1 objects are also defined as structures having the extra optional items on the struc line.

<parent_name>	is the name of the parent object's data structure.

<method_list>	is like that of TABLE.

<structure_data>	are any (additional) data present in an instance of the object.

<modifiers>	can be GLOBAL,NEAR, or FAR.

Each field uses the normal data allocation directives (DB, DW, and so on) to define its size. fields may be named or remain nameless. Field names must be unique when using MASM mode but don't need to be when using Ideal mode. Fields should specify either an indeterminate default value, ?, or a specific default value of the proper type.

Allocating A Structure Here is a sample Ideal mode structure definition:

STRUC A   A1  DB  1   ; This field defaults to 1

  A2  DW  2   ; This field defaults to 2

  A3  DW  ?   ; Indeterminate default

ENDS

The values given in the structure definition are default values for the structure.

When allocating an instance of a structure, use brackets, <>, to give that instance the default values.

IA1  A  <>      ; Gives values 1,2,?                 ; to each field.

If you do not want to supply the default values, use the ? indeterminate initialization symbol.

IA2  A  ?       ; Gives values ?,?,?                 ; to each field.

If you want to supply your own initialization values for each field, give them within brackets, <>.

IA3  A  <5,6,7> ; Gives values 5,6,7                 ; to each field.

Be careful when you supply string values to initialize fields; the string will be truncated if it is too long to fit in the field. The length of a string field is defined by the length of the default string for that field in the structure. If the given string is shorter than the field length, extra characters will be padded with spaces.

See Also

Directive not allowed inside structure definition error.


SUBSTR
SUBSTR                             Ideal, MASM51

name  SUBSTR  string, position [, size ]

Defines a new string name consisting of characters from string starting at position, with a length of size. All the remaining characters in string, starting from position, are assigned to name if size is not specified.


%SUBTTL
%SUBTTL                            Ideal, MASM

%SUBTTL "text" SUBTTL                             MASM SUBTTL  text

Sets subtitle in listing file to text.


%SYMS
%SYMS                              Ideal, MASM

Enables symbol table placement in listing file. This is the default symbol listing mode for Turbo Assembler.


%TABSIZE
%TABSIZE                           Ideal, MASM

%TABSIZE  width

Sets the number of columns between tabs in the listing file to width . The default is 8 columns.


%TEXT
%TEXT                              Ideal, MASM

%TEXT  width

Sets width of source field in listing file to width columns.


.TFCOND
.TFCOND                            MASM

Toggles conditional block-listing mode.


%TITLE
%TITLE                             Ideal, MASM

%TITLE " text " TITLE   MASM TITLE  text

Sets title in listing file to text.


%TRUNC
%TRUNC                             Ideal, MASM

Truncates listing fields that are too long.


UDATASEG
UDATASEG                           Ideal, MASM

Defines the start of an uninitialized data segment.


UNION
UNION          Ideal, MASM (disabled by QUIRKS)

UNION  name    fields

ENDS [ name ]

name  UNION    fields

[ name ] ENDS

Defines a union called name. A union is just like a STRUC except that all its members have an offset of zero from the start of the union. This results in a set of fields that are overlayed, allowing you to refer to the memory area defined by the union with different names and different data sizes. The length of a union is the length of its largest member, not the sum of the lengths of its members as in a STRUC. fields define the fields that comprise the union. Each field uses the normal data allocation directives (DB, DW, etc.) to define its size.


USES
USES                               Ideal, MASM

USES  item  [, item ]...

Indicates which registers or single-token data items you want to have pushed at the beginning of the enclosing procedure and which ones you want popped just before the procedure returns. You must use this directive before the first instruction tha actually generates code in your procedure.


.XALL
.XALL                              MASM

Causes only macro expansions that generate code or data to be listed.


.XCREF
.XCREF                             MASM

Disables cross-reference listing (CREF) information accumulation.


.XLIST
.XLIST                             MASM

Disables subsequent output to listing file.


SETFIELD
SETFIELD                           Ideal, MASM

SETFIELD <field_name><destination_r/m>,<source_reg>

Generates code that sets a value in a record field. Sets the field in the destination register or memory address with the contents of a source register.


GETFIELD
GETFIELD                             Ideal, MASM

GETFIELD <field_name><destination_reg>,<source_r/m>

Generates code that retrieves the value of a field found in the same source register or memory address, and sets the destination to that value.


FASTIMUL
FASTIMUL                             Ideal, MASM

FASTIMUL <dest_reg>,<source_r/m>,<value>

Generates code that multiplies source register or memory address by value, and puts it into destination register.


SETFLAG
SETFLAG                              Ideal, MASM

See the syntax for the OR processor instruction. Optimized form of OR that sets bits with shortest possible instruction. Use only if the resulting contents of the flags register is unimportant.


MASKFLAG
MASKFLAG                             Ideal, MASM

See the syntax for the AND processor instruction. Optimized form of AND that clears bits with the shortest possible instruction. Use only if the resulting contents of the flags registers are unimportant.


TESTFLAG
TESTFLAG                             Ideal, MASM

See the syntax for the TEST processor instruction. Optimized form of TEST that tests bits with the shortest possible instruction.


FLIPFLAG
FLIPFLAG                             Ideal, MASM

See the syntax for the XOR processor instruction Optimized form of XOR that complements bits with shortest possible instruction. Use only if the resulting contents of the flags registers are unimportant.


TABLE
TABLE                                Ideal, MASM

TABLE name [table_member [,table_member...]]

Constructs a table structure used to contain method pointers for objects.


TBLPTR
TBLPTR                               Ideal, MASM

TBLPTR

Places a virtual table pointer within the object data. Defines a structure member of the name @Mptr_<object>. This can only be used inside an object definition.


TBLINST
TBLINST                              Ideal, MASM

TBLINST

Creates an instance of the virtual table for the current object and defines @TableAddr_<object>. Must be used after every object definition that includes virtual methods, so that the virtual table is allocated. You should use this directive in only one module of your program.


CALL
CALL                                 Ideal, MASM

CALL<instance_ptr>METHODobject_name>: <method_name>USESsegreg:offsreg <extended_call_parameters>

Calls a method procedure.


JMP
JMP                                   Ideal, MASM

JMP<instance_ptr>METHOD<object_name>: <method_name>USESsegreg:offsreg

Functions exactly like CALL..METHOD except that it generates a JMP instead of a CALL and it cleans up the stack if there are LOCAL or USES variables on the stack. Use primarily for tail recursion.


LARGESTACK
LARGESTACK                          Ideal, MASM

Indicates that the stack is 32 bit.


SMALLSTACK
SMALLSTACK                           Ideal, MASM

Indicates that the stack is 16 bit.


TBLINIT
TBLINIT                              Ideal, MASM

Initializes pointer in an object to the virtual method table.


ENUM
ENUM                                 Ideal, MASM

ENUM name [enum_var [,enum_var...]] name ENUM [enum_var [,enum_var...]]

Declares an enumerated data type.


VERSION
VERSION                              MASM, Ideal

VERSION <version_ID>

Places Turbo Assembler in the equivalent operating mode for the specified version.


WHILE
WHILE                                Ideal, MASM

WHILE while_expression    macro body

   ENDM

Repeats a macro body until while_expression evaluates to 0 (false).


GOTO
GOTO                                 Ideal, MASM

GOTO tag_symbol

Tells Turbo Assembler to resume execution at the specified macro tag (tag_symbol). GOTO terminates any conditional block that it is found in.


EXITCODE
EXITCODE                              Ideal, MASM

EXITCODE [return_value_expr]

Produces termination code. You can use it for each desired exit point. return_value_expr is a number to be returned to the operating system. If you don't specify return_value_expr, the value in AX is returned.


.EXIT
.EXIT                                     MASM

.EXIT [return_value_expr]

Produces termination code. MASM mode only. Equivalent to EXITCODE.


.STARTUP
STARTUP

STARTUPCODE              Ideal, MASM

.STARTUP                 MASM

Provides initialization code and marks the beginning of the program.


PUSHSTATE

Tasm has become a complex product with many operating states. It is often desirable inside of a macro to have code which is 'independent' of the current operating state but which does not affect the current operating mode. This can be acheived through the use of the new PUSHSTATE and POPSTATE directives.

PUSHSTATE saves the current Tasm state on an internal stack 16 levels deep. The actual state saved includes the following:

. Current emulation version, i.e. T301 etc. . Mode selection, i.e., IDEAL, MASM, QUIRKS, MASM51. . EMUL/NOEMUL switch. . Current processor/coprocessor selection. . MULTERRS/NOMULTERRS switch. . SMART/NOSMART switch. . Current radix. . JUMPS/NOJUMPS switch. . LOCALS/NOLOCALS switch, and . Current local symbol prefix.

POPSTATE restores the last-saved Tasm state from the stack.


TYPEDEF
TYPEDEF                              Ideal, MASM

TYPEDEF type_name complex_type type_name TYPEDEF complex_type

Defines named types.


Macro Equates

Files within MMACROS.ZIP:

BIOS.INC contains symbolic equates representing the BIOS function calls and their associated services.

DOS.INC contains symbolic equates representing the DOS function calls and their associated services.

KBD.INC is comprised of equates representing all the non-alpha numeric scan codes returned by the IBM-PC keyboard.


Macro MBIOS

MBIOS.MAC -  Ideal mode BIOS macros

MBIOS.MAC -  Masm mode BIOS macros

These include files contain various macros that may be used to communicate with the IBM-PC's BIOS. The various macros are listed below. Also see BIOSMAC.DOC for documentation.

CallBIOS	LoadBH	SetVideoMode

SetCursorShape	GotoXY	WhereXY

GetCursorShape	GetLigtPenPos	SetDisplayPage

ScrollUp	ScrollDown	GetCharAttr

PutCharAttr	PutChar	SetColorPalette

PutPixel	GetPixel	PutTTY

GetVideoMode	SetPaletteRegs	ScreenRows

PutString	GetChar	GetKbdStatus

GetKbdFlags

Note:	In order to use this macro file you must also include the files MMACROS.MAC and BIOS.INC in your module.


CallBIOS

Syntax

CallBIOS    Interrupt, Service

Function

Calls the specified BIOS interrupt/service.

Input

Interrupt	Interrupt number

Service	Service number

Output

none

Registers Modified

ah, flags

Found in MBIOS.MAC and IBIOS.MAC


LoadBH

Syntax

LoadeBH  Value

Function

Loads BH with the value. Presumably the video page. If no value is provided BH is initialized to 0.

Input

Value	value to put in BH

Output

none

Registers Modified

bh

Found in MBIOS.MAC and IBIOS.MAC


SetVideoMode

Syntax

SetVideoMode  Mode

Function

Sets the current video mode.

BIOS Interrupt

10h

Service

00h Input

Mode

new video mode as defined below

0h	40x25 Black and White

1h	40X25 Color

2h	80x25 Black and White

3h	80x25 Color

4h	320x200 4-Color graphics

5h	320x200 4-Color graphics(color burst off)

6h	640x200 2-Color graphics

7h	Monochrome adapter Text display

8h	160x200 16-Color graphics(PCjr)

9h	320x200 16-Color graphics(PCjr)

0Ah	640x200 4-Color graphics(PCjr)

0Dh	320x200 16-Color graphics(EGA)

0Eh	640x200 16-Color graphics(EGA)

0Fh	640x350 Monochrome graphics(EGA)

10h	640x350 4-Color or 16-Color graphics(EGA)(depends on available RAM)

11h	640x480 2-Color graphics(VGA)

12h	640x480 16-Color graphics(VGA)

13h	320x200 256-Color graphics(VGA)

Output

none

Registers Modified

ah, Flags

Found in MBIOS.MAC and IBIOS.MAC


SetCursorShape

Syntax

SetCursorShape  Starting, Ending

Function

Sets the cursors shape. The parameters passed to it indicate the starting and ending scan lines to use when displaying the cursor. On a monochrome system the default setting is lines 6-7. Setting the scan lines to 0-7 would result in a block cursor. On a color system the default setting is 14-15. Setting the starting scan line to 15 and the ending scan line to 0 would result in a cursor with a line on the top and bottom.

BIOS Interrupt

10h

Service

01h

Input

Starting	starting scan line

Ending	ending scan line

Output

none

Registers Modified

ah, cx, Flags

Found in MBIOS.MAC and IBIOS.MAC


GotoXY

Syntax

GotoXY  Row, Column, Page

Function

Positions the cursor. The new cursor position is provided in the parameters Row and Column. The caller can optionally provide the video page to use. If Page isn't defined, page 0 is assumed.

BIOS Interrupt

10h

Service

02h

Input

Row (y coordinate)

Column (x coordinate)

Page	Display page to check

Output

none

Register modified

ax, bh, dx, Flags

Found in MBIOS.MAC and IBIOS.MAC


WhereXY

Syntax

WhereXY Page

Function

Determines the current cursor position and the cursors shape. The Page parameter indicates the video page to check and is optional. If the Page parameter is not specified, page 0 is assumed.

BIOS Interrupt

10h

Service

03h

Input

Page	Display page to check

Output

ch	Starting line for cursor

cl	Ending line for cursor

dh	row (y coordinate)

dl	column (x coordinate)

Register modified

ax, cx, dx, Flags

Found in MBIOS.MAC and IBIOS.MAC


GetCursorShape

Syntax

GetCursorShape

Function

Returns the shape of the cursor. Note that because the BIOS call to get the cursors position returns this information we simply call the WhereXY macro.

BIOS Interrupt

10h

Service

03h

Input

none

Output

ch	starting scan line of cursor

cl	ending scan line of cursor

Registers Modified

ax, cx, dx, Flags

Found in MBIOS.MAC and IBIOS.MAC


GetLightPenPos

Syntax

GetLightPenPos

Function

Returns the position of the light pen.

BIOS Interrupt

10h

Service

04h

Input

none

Output

ah =	0	light pen not down/not triggered

1	light pen down/triggered

ch	pixel vertical coordinate

bx	pixel horizontal coordinate

dh	character vertical coordinate

dl	character horizontal coordinate

Registers Modified

ah, bx, ch, dx, Flags

Found in MBIOS.MAC and IBIOS.MAC


SetDisplayPage

Syntax

SetDisplayPage  Page

Function

Sets the current display page. Note that the Page parameter is optional. If it is not provided video page 0 is used.

BIOS Interrupt

10h

Service

05h

Input

Page	Desired display  page as defined below

PAGE	MODE	HARDWARE

0-7	00h and 01h	CGA

0-3	02h and 03h	CGA

0-7	02h and 03h	EGA

0-7	0Dh	EGA

0-3	0Eh	EGA

0-1	0Fh	EGA

0-1	10h	EGA

Output

none

Registers Modified

ah, Flags

Found in MBIOS.MAC and IBIOS.MAC


ScrollUp

Syntax

ScrollUp LineCount, Attrib, x1, y1, x2, y2

Function

Scrolls the indicated part of the screen up LineCount times. Any blank lines created are initialized to the color indicated in the Attrib parameter. The coordinate parameters are optional. If they are not provided the routine scrolls the entire screen. The routine assumes there are 80 columns on the screen. However, it checks how many lines are currently available(25/43/50) if the coordinate parameters aren't provided.

BIOS Interrupt

10h

Service

06h

Input

LineCount	# of lines to scroll

Attrib	Attribute to use for new lines

x1	Upper left column

y1	Upper row

x2	Lower right column

y2	Bottom row

Output

none

Registers Modified

ax, bh, cx, dx, Flags

Found in MBIOS.MAC and IBIOS.MAC


ScrollDown

Syntax

ScrollDown LineCount, Attrib, x1, y1, x2, y2

Function

Scrolls the indicated part of the screen down LineCount times. Any blank lines created are initialized to the color indicated in the Attrib parameter. The coordinate parameters are optional. If they are not provided the routine scrolls the entire screen. The routine assumes there are 80 columns on the screen. However, it checks how many lines are currently available(25/43/50) if the coordinate parameters aren't provided.

BIOS Interrupt

10h

Service

07h

Input

LineCount	# of lines to scroll

Attrib	Attribute to use for new lines

x1	Upper left column

y1	Upper row

x2	Lower right column

y2	Bottom row

Output

none

Registers Modified

ax, bh, cx, dx, Flags

Found in MBIOS.MAC and IBIOS.MAC


GetCharAttr

Syntax

GetCharAttr Page

Function

Reads the character and attribute at the current cursor position of the indicated video page. See SetDisplayPage for a definition of the different video pages available. Note that the Page parameter is optional. If it is not provided video page 0 is used.

BIOS Interrupt

10h

Service

08h

Input

Page	the video page to check

Output

ah	attribute

al	character

Registers Modified

ax

Found in MBIOS.MAC and IBIOS.MAC


PutCharAttr

Syntax

PutCharAttr Character, Attribute, Count, Page

Function

Displays a character and attribute 'Count' times starting at the current cursor position of the indicated page. Note that the Page parameter is optional. If it is not provided video page 0 is used.

BIOS Interrupt

10h

Service

09h

Input

Character	character to display

Attribute	attribute to display the character(s) in

Count	number of times to display the character

Page 	Video page to display the characters on

Output

none

Registers Modified

ax, bx, cx, Flags

Found in MBIOS.MAC and IBIOS.MAC


PutChar

Syntax

PutChar Character, Count, Page, Color

Function

Displays a character Count times beginning at the current cursor position on the indicated display page. Note that the Page and Color parameters are optional. If you provide the Color parameter you must also provide the Page parameter. If the Page parameter is not provided video page 0 is used. If the Color is not provided, the character attribute of the current cursor location of the indicate video page is used.

BIOS Interrupt

10h

Service

0Ah

Input

Character	character to display

Count	number of times to display the character

Page 	video page to display character(s) on

Output

none

Registers Modified

ax, bx, cx, Flags

Found in MBIOS.MAC and IBIOS.MAC


SetColorPalette

Syntax

SetColorPalette Entry, Color

Function

Sets the CGA color palette that is used while displaying graphics in 320x200 graphics mode(4 & 5). For more information on video modes see SetVideoMode above.

BIOS Interrupt

10h

Service

0Bh

Input

Entry	Color palette id being set

Color	New color for palette entry

Output

none

Registers Modified

ah, bx, Flags

Found in MBIOS.MAC and IBIOS.MAC


PutPixel

Syntax

PutPixel    X, Y, Color

Function

Displays a pixel on the screen. Note that the macro may only be called while in graphics mode.

BIOS Interrupt

10h

Service

0Ch

Input

X	horizontal position

Y	vertical position

Color	color/display method for pixel

Output

none

Registers Modified

ax, cx, dx, Flags

Found in MBIOS.MAC and IBIOS.MAC


GetPixel

Syntax

GetPixel    X, Y

Function

Reads information about the indicated pixel.

BIOS Interrupt

10h

Service

0Dh

Input

X	horizontal position

Y	vertical position

Output

al	pixel information

Registers Modified

ax, cx, dx, Flags

Found in MBIOS.MAC and IBIOS.MAC


PutTTY

Syntax

PutTTY  Character, Page, Color

Function

Displays text to the console using teletype mode. Note that the Color parameter is optional. If the Color parameter isn't provided the character will be displayed using the attribute of the current cursor position.

BIOS Interrupt

10h

Service

0Eh

Input

Character	character to display

Color	color to display text in.

Page	video page to display character(s) on

Output

none

Registers Modified

ax, bx, Flags

Found in MBIOS.MAC and IBIOS.MAC


GetVideoMode

Syntax

GetVideoMode

Function

Determines the current video mode and display page.

BIOS Interrupt

10h

Service

0Fh

Input

None

Output

ah	Number of columns on screen

al	display mode as defined below

0h	40x25 Black and White

1h	40X25 Color

2h	80x25 Black and White

3h	80x25 Color

4h	320x200 4-Color graphics

5h	320x200 4-Color graphics(color burst off)

6h	640x200 2-Color graphics

7h	Monochrome adapter Text display

8h	160x200 16-Color graphics(PCjr)

9h	320x200 16-Color graphics(PCjr)

0Ah	640x200 4-Color graphics(PCjr)

0Dh	320x200 16-Color graphics(EGA)

0Eh	640x200 16-Color graphics(EGA)

0Fh	640x350 Monochrome graphics(EGA)

10h	640x350 4-Color or 16-Color graphics(EGA)(depends on available RAM)

11h	640x480 2-Color graphics(VGA)

12h	640x480 16-Color graphics(VGA)

13h	320x200 256-Color graphics(VGA)

bh	Active display page

Register modified

ax, bx, Flags

Found in MBIOS.MAC and IBIOS.MAC


SetPaletteRegs

Syntax

SetPaletteRegs    SubService, IndexIntensity, Color, ListSeg, ListOfs

Function

Sets the EGA palette colors. Note that the macro may only be called when running on an EGA.

BIOS Interrupt

10h

Service

10h

Input

SubService	Select service as defigned below

SERVICE	FUNCTION

0	If setting palette register

1	If setting border color register

2	If setting all palette registers and border register

3	If toggling blink/intensity bit (EGA only)

IndexIntensity	palette register or blink/intensity bit as defined below.

SERVICE	FUNCTION

SubService = 0	Palette register to set

SubService = 3

IndexIntensity = 0	Enable intensity

IndexIntensity = 1	Enable blinking

Color	color to store in register

ListSeg:ListOfs	address of new palette list

Output

none

Registers Modified

ax, bx, dx, es, Flags Found in MBIOS.MAC and IBIOS.MAC


ScreenRows

Syntax

ScreenRows

Function

Returns the number of rows available on the screen.

BIOS Interrupt

10h

Service

11h

Input

none

Output

dl	# of rows on the screen(25/43/50)

Registers Modified

ax, dl, Flags

Found in MBIOS.MAC and IBIOS.MAC


PutString

Syntax

PutString   Mode, X, Y, StringSeg, StringOfs, Length, Page, Attribute

Function

Displays a string to the indicated video page at the indicated position. Note that the Page and Attribute parameters are optional. If Page is not supplied, the macro will use page 0 by default. If Mode = 0 or 1 Attribute must be supplied. If Mode = 2 or 3 Attribute should not be supplied. Note that if you provide the Attribute parameter you must provide the Page parameter also. This macro may only be used on IBM-AT, PS/2 and compatible machines.

BIOS Interrupt

10h

Service

13h

Input

Mode	mode to write string in as defined below

MODE	FUNCTION

0	Attribute in bl, string contains character codes only, cursor position isn't updated after write.

1	Attribute in bl, string contains character codes only, cursor position is updated after write.

2	String contains alternating character codes and attribute bytes, cursor position isn't updated after write.

3	String contains alternating character codes and attribute bytes, cursor position is updated after write.

X	Vertical position to begin display of the string

Y	Horizontal position to begin display of the string.

StringSeg	Segment address of the string

StringOfs	Offset address of string in StringSeg

Length	Length of the string to be displayed

Page	Video page to display string to

Attribute	Optional parameter that indicates the attribute to display the string in. This parameter should only be provided if Mode = 0 or 1.

Output

none

Registers Modified

ax, bx, cx, dx, bp, es, Flags

Found in MBIOS.MAC and IBIOS.MAC


GetChar

Syntax

GetChar

Function

Returns the next character in the BIOS keyboard buffer.

BIOS Interrupt

16h

Service

00h

Input

none

Output

ah	keyboard scan code

al	ASCII character

Registers Modified

ax, Flags

Found in MBIOS.MAC and IBIOS.MAC


GetKbdStatus

Syntax

GetKbdStatus

Function

Returns the BIOS keyboard status.

BIOS Interrupt

16h

Service

01h

Input

none

Output

If key wating to be input:

Zero flag	clear

ah	keyboard scan code

al	ASCII character

If no key waiting to be input:

Zero flag	set

Registers Modified

ax, Flags

Found in MBIOS.MAC and IBIOS.MAC


GetKbdFlags

Syntax

GetKbdFlags

Function

Returns the BIOS keyboard flags.

BIOS Interrupt

16h

Service

02h

Input

none

Output

al	BIOS keyboard flags byte:

BIT	FUNCTION

7	Insert ON

6	Caps Lock ON

5	Num Lock ON

4	Scroll Lock ON

3	Alt key DOWN

2	Ctrl key DOWN

1	Left-Shift key DOWN

0	Right-Shift key DOWN

Registers Modified

al, Flags

Found in MBIOS.MAC and IBIOS.MAC


MMacros

IMACROS.MAC   Various useful macros in Ideal mode.

MMACROS.MAC   Various useful macros in MASM mode.

The macros implemented in these files are:

Name	Function

FarPtrAddress	Calculate the absolute address of a 32-bit pointer

CompareFarPointers	Compare two 32-bit pointers

MakePascalString	Allocate a string using Turbo Pascal format

InitStack	Initialize the stack registers for parameter access

RestoreStack	Restore the stack registers

GetVideoAddress	Determine the segment address of video ram

DosCall	Performs the DOS int 21h call

LoadSegment	Loads a segment register with a value

Beep	Sounds the speaker

Note:	In order to use either of these macro files you must also include either the macro file IBIOS.MAC (for Ideal mode), or MBIOS.MAC (for MASM mode) in your module.


FarPtrAddress
FarPtrAddress Segment, Ofs

This macro calculates the absolute address of the far pointer passed to it.

 Input

     Segment:Ofs - Far pointer

 Output

     dx:ax - Absolute address of pointer(20 bits)

 Calling convention

     NA

 Registers modified

     ax, bx, cx, dx, Flags

Found in IMACROS.MAC and MMACROS.MAC


CompareFarPointers
CompareFarPointers    Seg1, Ofs1, Seg2, Ofs2

The following macros compares two far pointers to determine their relative absolute addresses.

Input

Seg1:Ofs1	Far pointer

Seg2:Ofs2	Far pointer

Output

The Flags register is set by the CMP instruction.

Calling convention

NA

Registers modified

ax, bx, cx, dx, Flags

Found in IMACROS.MAC and MMACROS.MAC


MakePascalString
MakePascalString    Id, Msg

The following macro builds strings using Turbo Pascal conventions. That is, the string is stored with a preceding 'length byte' This macro is an excellent example of the clever things that can be done using the ORG directive.

Input

Id	Label to associate with the string

Msg	Contents of the string

Output

none

Calling convention

NA

Registers modified

none

Found in IMACROS.MAC and MMACROS.MAC


Initstack
InitStack   LocalVars

The following macro initializes bp and sp in preparation for access of parameters passed to a routine on the stack. The parameter LocalVars is optional and if provided indicates the amount of space that should be reserved for local variables. LocalVars must be an even value.

Input

LocalVars	# of bytes to reserve for local variables

Output

none

Calling convention

NA

Registers modified

bp, sp

Found in IMACROS.MAC and MMACROS.MAC


RestoreStack
RestoreStack    LocalVars

The following macro restores bp and sp after a routine is finished accessing parameters passed to a routine on the stack. The parameter LocalVars is optional and if provided indicates the amount of space that was reserved for local variables. LocalVars must be an even value.

Input

LocalVars	# of bytes that were reserved for local variables

Output

none

Calling convention

NA

Registers modified

bp, sp

Found in IMACROS.MAC and MMACROS.MAC


GetVideoAddress

The following macro returns the current segment address of video ram.

Input

none

Output

ax

Calling convention

NA

Registers modified

ax, bx, Flags

Found in IMACROS.MAC and MMACROS.MAC


DosCall Macro
DosCall Macro   Service

The following macro performs the Int 21h call to execute DOS's services.

Input

Service	Service # to execute

Output

None

Calling convention

NA

Registers modified

NA

Found in IMACROS.MAC and MMACROS.MAC


LoadSegment Macro
LoadSegment Macro   Segm, Value

The following macro loads a segment register with a value. The macro attempts to do all possible checks to determine the type of the value being moved into the segment register. Based on this information it generates the correct code.

Input

Segm	Segment register to load value into

Value	Value to put on the stack

Output

none

Calling convention

NA

Registers modified

ax

Found in IMACROS.MAC and MMACROS.MAC


Beep Macro

The following macro generates a beep by displaying the ASCII Bell character.

Input

none

Output

none

Calling convention

NA

Registers modified

ax, dl

Found in IMACROS.MAC and MMACROS.MAC


MDOS

MDOS.MAC	Ideal mode DOS interface macros.

MDOS.MAC	MASM mode DOS interface macros.

These include files contain various macros that may be used to communicate with DOS. For documentation on each of the macros in this file also see the file DOSMAC.DOC.

Terminate10Program	ReadKBDEcho

CharacterOutput	AuxiliaryInput

AuxiliaryOutput	PrinterOutput

ConsoleIO	UnfilteredCharInput

CharInputNoEcho	WriteString

BufferedInput	GetInputStatus

ResetInputBuffer	ResetDisk

ChangeDrive	GetDrive

GetDTA	SetDTA

DefaultDiskAllocation	DiskAllocation

RandomFCBRead	RandomFCBWrite

SetVector	CreatePSP

GetDate	SetDate

GetTime	SetTime

SetVerifyFlag	GetDOSVersion

TSR	GetSetBREAK

GetVector	GetDiskSpace

GetSetCountryInfo	CreateDir

RemoveDir	ChangeDirectory

CreateFile	OpenFile

CloseFile	ReadFile

WriteFile	DeleteFile

MoveFilePtr	GetSetAttributes

IOCTL	DuplicateHandle

ForceDupHandle	GetCurrentDir

AllocateMemory	FreeMemory

ModifyMemory	Exec

TerminateProgram	GetReturnCode

FindFirst	FindNext

GetVerifyFlag	RenameFile

GetSetFileDateTime	GetSetAllocationStrategy

GetExtendedErrors	CreateTemporaryFile

CreateNewFile	ControlFileAccess

GetMachineName	SetupPrinter

GetListEntry	GetPSPAddress

LeadByteTable

In early versions of DOS, File Control Blocks, (FCBs), were used to access files. The following macro calls use FCBs:

OpenFCBFile	CloseFCBFile

FindFirstFCB	FindNextFCB

DeleteFCBFile	SequentialFCBRead

SequentialFCBWrite	CreateFCBFile

RenameFCBFile	GetFCBFileSize

SetFCBFileRecord	RandomFCBBlockRead

RandomFCBBlockWrite	ParseFCBFilename

Note:	To use either of these files, you must also include KBD.INC, DOS.INC, and either IMACROS.INC (for Ideal mode), or MMACROS.MAC (for MASM mode).


Terminate10Program

Syntax

Terminate10Program

Function

Terminate a program without returning an errorlevel to DOS.

DOS Function

00h

DOS Versions

1, 2, 3

Input

cs	segment address of Program Segment Prefix(PSP)

Output

none

Registers Modified

ah, flags

Found in IDOS.MAC and MDOS.MAC


ReadKBDEcho

Syntax

ReadKBDEcho

Function

Reads a character from the keyboard or standard input device and echoes it to the display. If a character isn't immediately available the DOS function waits for one.

DOS Function

01h

DOS Versions

1, 2, 3

Input

none

Output

al	character

Registers Modified

al, flags

Found in IDOS.MAC and MDOS.MAC


CharacterOutput

Syntax

CharacterOutput Character

Function

Outputs a character to the standard output device or to the active video display.

DOS Function

02h

DOS Versions

1, 2, 3

Input

Character	byte value representing character to display

Output

none

Registers Modified

ah, dl, flags

Found in IDOS.MAC and MDOS.MAC


AuxiliaryInput

Syntax

AuxiliaryInput

Function

Reads the next character from the auxiliary input device.

DOS Function

03h

DOS Versions

1, 2, 3

Input

none

Output

al	byte value representing the character received

Registers Modified

ax, flags

Found in IDOS.MAC and MDOS.MAC


AuxiliaryOutput

Syntax

AuxiliaryOutput

Function

Displays a character to the auxiliary output device.

DOS Function

04h

DOS Versions

1, 2, 3

Input

Character	byte value representing character to display

Output

none

Registers Modified

ax, dl, flags

Found in IDOS.MAC and MDOS.MAC


PrinterOutput

Syntax

PrinterOutput   Character

Function

Sends a character to the printer device.

DOS Function

05h

DOS Versions

1, 2, 3

Input

Character	value to send to the printer.

Output

none

Registers Modified

ah, dl, flags

Found in IDOS.MAC and MDOS.MAC


ConsoleIO

Syntax

ConsoleIO   Value

Function

Performs input/output from/to the console device.

DOS Function

06h

DOS Versions

1, 2, 3

Input

Function	Desired operation as defined below

Value	Behavior

0-0FEh	Display the character represented by Value

FFh	Read a character

Output

Value = FF

A character is available

zero flag = clear

al	character

A character is not available

zero flag set

Registers Modified

ax, dl, flags

Found in IDOS.MAC and MDOS.MAC


UnfilteredCharInput

Syntax

UnfilteredCharInput

Function

Performs character input without checking for CTRL_BREAK. The character input is not written to the display device.

DOS Function

07h

DOS Versions

1, 2, 3

Input

none

Output

al	The character read.

Registers Modified

ax, flags

Found in IDOS.MAC and MDOS.MAC


CharInputNoEcho

Syntax

CharInputNoEcho

Function

Reads a character without echoing it to the screen.

DOS Function

08h

DOS Versions

1, 2, 3

Input

none

Output

al	character read

Registers Modified

ax, flags

Found in IDOS.MAC and MDOS.MAC


WriteString

Syntax

WriteString StringSeg, StringOfs

Function

Displays a $ terminated string to the string using.

DOS Function

09h

DOS Versions

1, 2, 3

Input

StringSeg	segment address of the string

StringOfs	offset address of string in StringSeg

Output

none

Registers Modified

ax, dx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


BufferedInput

Syntax

BufferedInput   StringSeg, StringOfs

Function

Reads a line from the standard input device and stores it in the indicated buffer.

DOS Function

0Ah

DOS Versions

1, 2, 3

Input

StringSeg	segment address of the buffer

StringOfs	offset of the storage buffer

Output

none

Registers Modified

ah, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


GetInputStatus

Syntax

GetInputStatus

Function

Determines if a character is ready to be input.

DOS Function

0Bh

DOS Versions

1, 2, 3

Input

none

Output

al	0 = no character available,

FFh = character available

Registers Modified

ax, flags

Found in IDOS.MAC and MDOS.MAC


ResetInputBuffer
ResetInputBuffer **

Syntax

ResetInputBuffer Function, StringSeg, StringOfs

Function

Resets the input buffer(i.e. clears its contents) and then waits for a character. Note that if Function <> 0Ah you do not need to provide the StringSeg:StringOfs parameters.

DOS Function

0Ch

DOS Versions

1, 2, 3

Input

Function	number of the input function to invoke.

StringSeg	If Function = 0Ah, segment address of the buffer

StringOfs	offset of storage buffer

Output

Function = 0Ah

none

al	character read

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


ResetDisk

Syntax

ResetDisk

Function

Resets a disk. All buffers are flushed to the disk.

DOS Function

0Dh

DOS Versions

1, 2, 3

Input

none

Output

none

Registers Modified

ah, flags

Found in IDOS.MAC and MDOS.MAC


ChangeDrive

Syntax

ChangeDrive Drive

Function

Changes the default disk drive.

DOS Function

0Eh

DOS Versions

1, 2, 3

Input

Drive	Drive to change to

Output

al	number of logical drives in system

Registers Modified

al, dl, Flags

Found in IDOS.MAC and MDOS.MAC


OpenFCBFile

Syntax

OpenFCBFile FCBSeg, FCBOfs

Function

Opens a file using an FCB and prepares it for I/O.

DOS Function

0Fh

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = operation successful,

FFh = operation failed

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


CloseFCBFile

Syntax

CloseFCBFile    FCBSeg, FCBOfs

Function

Closes a file using an FCB.

DOS Function

10h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = operation successful,

FFh = operation failed

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


FindFirstFCB

Syntax

FindFirstFCB    FCBSeg, FCBOfs

Function

Finds the first file in a directory that matches a given file specification. File operations are performed using FCB's.

DOS Function

11h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = operation successful,

FFh = operation failed

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


FindNextFCB

Syntax

FindNextFCB    FCBSeg, FCBOfs

Function

Finds the next entry in a directory matching the last file specification given to FindFirstFCB.

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = operation successful,

FFh = operation failed

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


DeleteFCBFile

Syntax

DeleteFCBFile    FCBSeg, FCBOfs

Function

Deletes a file defined in an FCB.

DOS Function

13h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = operation successful,

FFh = operation failed

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


SequentialFCBRead

Syntax

SequentialFCBRead   FCBSeg, FCBOfs

Function

Performs a sequential read from a file opened using an FCB.

DOS Function

14h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = read successful

1 = end of file

2 = segment wrap

3 = partial record read at eof

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


SequentialFCBWrite

Syntax

SequentialFCBWrite  FCBSeg, FCBOfs

Function

Performs a sequential write to a file opened using an FCB.

DOS Function

15h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = write successful

1 = disk full

2 = segment wrap

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


CreateFCBFile

Syntax

CreateFCBFile   FCBSeg, FCBOfs

Function

Creates a new file or truncates an existing file using an FCB.

DOS Function

16h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = operation successful,

FFh = operation failed

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


RenameFCBFile

Syntax

RenameFCBFile   FCBSeg, FCBOfs

Function

Renames a file(s) defined in an FCB.

DOS Function

17h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = operation successful,

FFh = operation failed

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


GetDrive

Syntax

GetDrive

Function

Returns the default disk drive.

DOS Function

19h

DOS Versions

1, 2, 3

Input

none

Output

al	drive code(0 = A, 1 = B, etc.)

Registers Modified

al, Flags

Found in IDOS.MAC and MDOS.MAC


SetDTA

Syntax

SetDTA  DTASeg, DTAOfs

Function

Sets the current DTA address.

DOS Function

1Ah

DOS Versions

1, 2, 3

Input

StringSeg	egment address of new DTA

DTAOfs	ffset in StringSeg of new DTA

Output

none

Registers Modified

ax, dx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


DefaultDiskAllocation

Syntax

DefaultDiskAllocation

Function

Gets the allocation information for the default disk drive.

DOS Function

1Bh

DOS Versions

1, 2, 3

Input

none

Output

al	sectors per cluster

ds:bx	address of the FAT id byte

cx	# of bytes per physical sector

dx	number of clusters on default drive

Registers Modified

ax, bx, cx, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


DiskAllocation

Syntax

DiskAllocation

Drive Function

Gets the allocation information for a specific disk drive.

DOS Function

1Ch

DOS Versions

2, 3

Input

dl	drive id(0 = default, 1 = A, etc.)

Output

al	sectors per cluster

ds:bx	address of the FAT id byte

cx	# of bytes per physical sector

dx	number of clusters on default drive

Registers Modified

ax, bx, cx, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


RandomFCBRead

Syntax

RandomFCBRead   FCBSeg, FCBOfs

Function

Reads the indicated record from a file opened using an FCB.

DOS Function

21h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = read successful

1 = end of file

2 = segment wrap

3 = partial record read at eof

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


RandomFCBWrite

Syntax

RandomFCBWrite  FCBSeg, FCBOfs

Function

Writes a record to the indicated position in a file opened using an FCB.

DOS Function

22h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = write successful

1 = disk full

2 = segment wrap

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


GetFCBFileSize

Syntax

GetFCBFileSize  FCBSeg, FCBOfs

Function

Gets the number of records in a file opened using an FCB.

DOS Function

23h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

al	0 = operation successful,

FFh = operation failed

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


SetFCBFileRecord

Syntax

SetFCBFileRecord    FCBSeg, FCBOfs

Function

Updates the record pointer field in the FCB to the current file pointer position.

DOS Function

24h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Output

Registers Modified

ah, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


SetVector

Syntax

SetVector   Vector, VectorSeg, VectorOfs

Function

Changes the indicated interrupt vector to the new vector defined in VectorSeg:VectorOfs.

DOS Function

25h

DOS Versions

1, 2, 3

Input

Vector	Interrupt vector to modify

VectorSeg	Segment address of new interrupt handler

VectorOfs	Offset from VectorSeg of new handler

Output

none

Registers Modified

ax, dx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


CreatePSP

Syntax

CreatePSP   PSPSeg

Function

Creates a new Program Segment Prefix(PSP)

DOS Function

26h

DOS Versions

1, 2, 3

Input

PSPSeg	Segment address of new PSP

Output

none

Registers Modified

ah, dx, flags

Found in IDOS.MAC and MDOS.MAC


RandomFCBBlockRead

Syntax

RandomFCBBlockRead  FCBSeg, FCBOfs Count

Function

Does a random read of one or more records from a file opened using an FCB.

DOS Function

27h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Count 	Number of records to read

Output

al	0 = read successful

1 = end of file

2 = segment wrap

3 = partial record read at eof

cx	actual # of records read from the file

Registers Modified

ax, cx, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


RandomFCBBlockWrite

Syntax

RandomFCBBlockWrite FCBSeg, FCBOfs Count

Function

Performs a random write of the specified number of records to a file opened using an FCB.

DOS Function

28h

DOS Versions

1, 2, 3

Input

FCBSeg	segment address of the File Control Block(FCB)

FCBOfs	offset of FCB

Count 	Number of records to read

Output

al	0 = write successful

1 = disk full

2 = segment wrap

cx	actual # of records written to the file

Registers Modified

ax, cx, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


ParseFCBFilename

Syntax

ParseFCBFilename    Flags, FilenameSeg,                             FilenameOfs, FCBSeg,

                            FCBOfs

Function

Parses a string representing a filename and fills in the appropriate fields of an FCB.

DOS Function

29h

DOS Versions

1, 2, 3

Input

Flags	Flags that control parsing as defined below

FLAGS	OPERATION

Bit 3	= 1	Only if an extension is given in the indicated file spec. will the extension in the FCB will be modified.

= 0	Replace the FCB's current extension with the one in the file spec. or initialize the FCB to blanks.

Bit 2	= 1	Only if a filename is given in the indicated file spec. will the filename in the FCB will be modified.

= 0	Replace the FCB's current filename with the one in the file spec. or initialize the FCB to blanks.

Bit 1	= 1	Only if a drive is given in the indicated file spec. will the drive in the FCB will be modified.

= 0	Replace the FCB's current drive with the one in the file spec. or initialize the FCB to blanks.

Bit 0	= 1	Leading seperators will be ignored.

= 0	Leading seperators will not be ignored.

FilenameSeg	Segment address of the string containing the filename

FilenameOfs	Offset of filename string

FCBSeg	Segment address of FCB

FCBOfs	Offset of FCB

Output

al	0 = No wildcard characters

1 = Wildcard characters exist in the filename

FFh = Specified drive doesn't exist

ds:si	pointer to first byte position after the filename string

es:di	pointer to FCB

Registers Modified

ax, di, si, ds, es, flags

Found in IDOS.MAC and MDOS.MAC


GetDate

Syntax

GetDate

Function

Gets the system date.

DOS Function

2Ah

DOS Versions

1, 2, 3

Input

none

Output

cx	year(1980 - 2099)

dh	month(1 - 12)

dl	day(1 - 31)

al	day of week(0 = Sunday, 1 = Monday, etc.)

Only on DOS 1.1 or later

Registers Modified

ax, cx, dx, flags

Found in IDOS.MAC and MDOS.MAC


SetDate

Syntax

SetDate Year, Month, Day

Function

Sets the system date.

DOS Function

2Bh

DOS Versions

1, 2, 3

Input

Year	year(1980 - 2099)

Month	month(1 - 12)

Day	day(1 - 31)

Output

al	0 = success

0FFh = invalid date

Registers Modified

ax, cx, dx, flags

Found in IDOS.MAC and MDOS.MAC


GetTime

Syntax

GetTime

Function

Gets the system time.

DOS Function

2Ch

DOS Versions

1, 2, 3

Input

none

Output

ch	hour(0 - 23)

cl	minutes(0 - 59)

dh	seconds(0 - 59)

dl	hundredths of a second(0 - 99)

Registers Modified

ah, cx, dx, flags

Found in IDOS.MAC and MDOS.MAC


SetTime

Syntax

SetTime Hour, Minute, Second, Hundredth

Function

Sets the system time.

DOS Function

2Dh

DOS Versions

1, 2, 3

Input

Hour	hour(0 - 23)

Minute	minutes(0 - 59)

Second	seconds(0 - 59)

Hundredth	hundredths of a second(0 - 99)

Output

al	0 = success

0FFh - invalid time

Registers Modified

ah, cx, dx, flags

Found in IDOS.MAC and MDOS.MAC


SetVerifyFlag

Syntax

SetVerifyFlag Flag

Function

Sets the system verify flag to on or off.

DOS Function

2Eh

DOS Versions

1, 2, 3

Input

Flag	0 = Turn off verify flag

1 = Turn the verify flag on

Output

none

Registers Modified

ax, dl, flags

Found in IDOS.MAC and MDOS.MAC


GetDTA

Syntax

GetDTA

Function

Returns the address of the current DTA.

DOS Function

2Fh

DOS Versions

2, 3

Input

none

Output

es:bx	Far pointer to DTA

Registers Modified

ah, bx, es, Flags

Found in IDOS.MAC and MDOS.MAC


GetDOSVersion

Syntax

GetDOSVersion

Function

Returns the DOS version.

DOS Function

30h

DOS Services

2, 3

Input

none

Output

ax	DOS version

Registers Modified

ax, Flags

Found in IDOS.MAC and MDOS.MAC


TSR

Syntax

TSR Result Paragraphs

Function

Terminates a program but leaves it resident in memory.

DOS Function

31h

DOS Versions

2, 3

Input

Result	return code

Paragraphs	# of paragraphs to reserve for the program

Output

none

Registers Modified

ax, dx, flags

Found in IDOS.MAC and MDOS.MAC


GetSetBREAK

Syntax

GetSetBREAK Mode Value

Function

Sets the CTR_BREAK checking flag. Note that if Mode = 0 you do not need to provide the Value parameter.

DOS Function

33h

DOS Versions

2, 3

Input

Mode	0 = Getting status of the flag

1 = Setting the status of the flag

Value	0 = Turn CTRL-BREAK checking off

1 = Turn CTRL-BREAK checking on

Output

dl	0 = if CTRL-BREAK checking off

1 = if CTRL-BREAK checking on

Registers Modified

ax, dl, flags

Found in IDOS.MAC and MDOS.MAC


GetVector

Syntax

GetVector Interrupt

Function

Returns the vector for a specified interrupt.

DOS Function

35h

DOS Versions

2, 3

Input

Interrupt	Which interrupt to return the vector of.

Output

es:bx	vector for the indicated interrupt

Registers Modified

ax, bx, es, flags

Found in IDOS.MAC and MDOS.MAC


GetDiskSpace

Syntax

GetDiskSpace Disk

Function

Returns the amount of space available on the specified disk.

DOS Function

36h

DOS Versions

2, 3

Input

Disk	Which disk to check (0 = default, 1 = A, etc.)

Output

ax	sectors per cluster

FFFFh	if specified drive doesn't exist

bx	# of available clusters

cx	bytes per sector

dx	clusters per drive

Registers Modified

ax, bx, cx, dx, flags

Found in IDOS.MAC and MDOS.MAC


GetSetCountryInfo

Syntax

GetSetCountryInfo   BufferSeg, BufferOfs,                             ShortCode, LongCode

Function

Gets or sets the current country information. Note that you can only set the country information if running on DOS version 3.0 or later. Note that if ShortCode < 255 then you do not need to provide the LongCode parameter. If the LongCode parameter is provided it will be loaded into the apprpriate register regardless of the value of ShortCode.

DOS Function

38h

DOS Versions

2, 3

Input

BufferSeg	Segment address of the buffer to store the information in.

BufferOfs	offset of the storage buffer.

ShortCode	< 255 = Specific country code < 255

0FFh = Country code >= 255 so use LongCode

LongCode	Country code >= 255

Output

bx	country code

ds:dx	pointer to the information buffer

Registers Modified

ax, bx, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


CreateDir

Syntax

CreateDir   StringSeg StringOfs

Function

Creates a directory using the name pointed to by StringSeg:StringOfs.

DOS Function

39h

DOS Versions

2, 3

Input

StringSeg	Segment address of string containing directory name

StringOfs	Offset from StringSeg of directory name

Output

If function successful:

Carry flag	clear

If function failed

Carry flag	set

ax	error code:

3	Path not found

5	Access denied

Registers Modified

ax, dx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


RemoveDir

Syntax

RemoveDir   StringSeg, StringOfs

Function

Macro deletes the indicated directory.

DOS Function

3Ah

DOS Versions

2, 3

Input

StringSeg	Segment address of string containing directory name

StringOfs	Offset from StringSeg of directory name

Output

If function successful:

Carry flag	clear

If function failed

Carry flag	set

ax	error code:

3	Path not found

5	Access denied

6	Current directory

16d	Current directory

Registers Modified

ax, dx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


ChangeDirectory

Syntax

ChangeDirectory StringSeg, StringOfs

Function

Sets the current directory to the directory pointed to by StringSeg:StringOfs.

DOS Function

3Bh

DOS Versions

2, 3

Input

StringSeg	segment address of ASCIIZ string

StringOfs	offset within StringSeg of directory name

Output

If function successful:

Carry flag	clear

If function failed

Carry flag	set

ax = error code:

3	Path not found

Registers Modified

ax, dx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


CreateFile

Syntax

CreateFile  Attributes, StringSeg, StringOfs

Function

Creates a new file or truncates an existing file to 0 bytes. A file associated with the file is returned.

DOS Function

3Ch

DOS Versions

2, 3

Input

Attributes	File's attributes

StringSeg	Segment address of ASCIIZ file spec.

StringOfs	Offset within StringSeg of file spec.

Output

If function successful:

Carry flag	clear

ax	file handle

If function failed

Carry flag	set

ax	error code:

3	Path not found

4	No handle available

5	Access denied

Registers Modified

ax, cx, dx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


OpenFile

Syntax

OpenFile  AccessMode, StringSeg, StringOfs

Function

Opens an exiting file and returns a file handle associated with the file.

DOS Function

3Dh

DOS Versions

2, 3

Input

AccessMode	File access mode as defined below

BITS	VALUE	FUNCTION	DOS VERSION

0-2	000	Read Access	2.0 & 3.0

001	Write Access	2.0 & 3.0

010	Read/Write Access	2.0 & 3.0

3	0	Reserved

4-6	000	Sharing mode, compatability mode	3.0

001	Sharing mode, read/write access denied	3.0

010	Sharing mode, Write access denied	3.0

011	Sharing mode, Read access denied	3.0

100	Sharing mode, Full access permitted	3.0

7	0	Inheritance flag, File inherited by child processes	3.0

1	Inheritance flag, File private to current process	3.0

StringSeg	Segment address of ASCIIZ file spec.

StringOfs	Offset within StringSeg of file spec.

Output

If function successful:

Carry flag	clear

ax	file handle

If function failed

Carry flag	set

ax	error code:

1	Function number invalid

2	File not found

3	Path not found or file doesn't exist

4	No handle available

5	Access denied

OCH	File access code invalid

Registers Modified

ax, dx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


CloseFile

Syntax

CloseFile Handle

Function

Closes a file associated with a file handle.

DOS Function

3Eh

DOS Versions

2, 3

Input

Handle	File handle of file to close

Output

If function successful:

Carry flag	clear

If function failed:

Carry flag	set

ax	error code:

6	handle invalid or not open

Registers Modified

ax, bx, Flags

Found in IDOS.MAC and MDOS.MAC


ReadFile

Syntax

ReadFile    Handle, Count, StringSeg, StringOfs

Function

Reads Count bytes from the file referenced by the file handle.

DOS Function

3Fh

DOS Versions

2, 3

Input

Handle	DOS file handle of file to read from

Count	# of bytes to read

StringSeg	Segment address of buffer to store data in

StringOfs	offset within StringSeg of storage buffer

Output

If function successful:

Carry flag	clear

ax	# of bytes read(0 if EOF)

If function failed

Carry flag	set

ax	error code:

5	Access denied

6	Invalid handle or file not open

Registers Modified

ax, bx, cx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


WriteFile

Syntax

WriteFile    Handle, Count, StringSeg,                      StringOfs

Function

Writes Count bytes to the file referenced by the file handle.

DOS Function

40h

DOS Versions

2, 3

Input

Handle	DOS file handle of file to write to

Count	# of bytes to write

StringSeg	Segment address of buffer storing data

StringOfs	offset within StringSeg of storage buffer

Output

If function successful:

Carry flag	clear

ax	# of bytes read(0 if disk full)

If function failed

Carry flag	set

ax	error code:

5	Access denied

6	Invalid handle or file not open

Registers Modified

ax, bx, cx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


DeleteFile

Syntax

DeleteFile  StringSeg, StringOfs

Function

Deletes the file pointed to by StringSeg:StringOfs.

DOS Function

41h

DOS Versions

2, 3

Input

StringSeg	segment address of the filename

StringOfs	offset from StringSeg of the filename

Output

If function successful:

Carry flag	clear

If function failed

Carry flag	set

ax	error code:

2	File not found

5	Access denied

Registers Modified

ax, dx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


MoveFilePtr

Syntax

MoveFilePtr Mode, Handle, OffsetHigh,                     OffsetLow

Function

Positions the file pointer in the file referenced by Handle.

DOS Function

42h

DOS Versions

2, 3

Input

Mode	Offset method as define below

MODE	FUNCTION

0	absolute byte offset from beginning of file(always unsigned long integer)

1	byte offset from current location (signed long integer)

2	byte offset from end of file(signed long integer)

Handle	File handle

OffsetHigh	Most significant word of offset

OffsetLow	Least significant word of offset

Output

If function successful:

Carry flag	clear

dx	most significant word of new pointer

ax/	least significant word of new pointer

If function failed

Carry flag	set

ax	error code:

1	Function number invalid

6	Handle invalid or not open

Registers Modified

ax, bx, cx, dx, Flags

Found in IDOS.MAC and MDOS.MAC


GetSetAttributes

Syntax

GetSetAttributes    Mode, Attributes,                             StringSeg, StringOfs

Function

Gets or sets the file attributes.

DOS Function

43h

DOS Versions

2, 3

Input

Mode

0	Get file attributes

1	Set file attributes

Attributes	New attributes or location to store file's current attributes.

StringSeg	Segment address of the filename to check/modify

StringOfs	Offset within StringSeg of the filename

Output

If function successful:

Carry flag	clear

If al = 0 on call

cx	attribute

If function failed:

Carry flag	set

ax	error code:

1	Function code invalid

2	File not found

3	Path not found or file doesn't exist

5	Attribute can't be changed

Registers Modified

ax, cx, dx, ds, Flags

Found in IDOS.MAC and MDOS.MAC


IOCTL

Syntax

IOCTL      Function, HandleDrive, Count, BufSegDevInfo, BufferOfs

Function

Passes control information to a device driver. Note that you must provide either the buffer address parameters or the device information parameter but not both.

DOS Function

44h

DOS Versions

2, 3

Input

Function	What to do as defined below:

FUNCTION	RESULT

00h	Get device information

01h	Set device information

02h	Read from character device control channel to a buffer

03h	Write to a character device control channel from a buffer

04h	Read from block device control channel to a buffer

05h	Write to a block device control channel from a buffer

06h	Get the input status

07h	Get output status

08h	Check whether a block device is changable(DOS 3.0)

09h	Check whether a drive is local or remote(DOS 3.1 & Microsoft Networks)

0Ah	Check whether a handle is local or remote(DOS 3.1 & Microsoft Networks)

0Bh	Change the sharing retry count

HandleDrive	Handle(functions 0, 1, 2, 3, 6, 7, 0Ah)

Drive(0 = default, 1 = A, etc.)

Count	# of bytes to read/write

BufSegDevInfo	Represents Segment address of the input/output buffer(functions 2-5)

Represents device information(function 1).

BufferOfs	offset of the storage buffer(functions 2-5)

Output

Carry flag = clear 	operation successful

ax	# of bytes read/written(functions 2-5)

al	0 = not ready(functions 6-7)

1 = ready

ax	0 = removable(function 8)

1 = fixed

dx	Device information(function 0)

Carry flag = set

ax	error code

1 = Invalid function number

4 = No handle available

5 = Access denied

6 = Invalid handle or device not open

0Dh = Invalid data

0Fh = Invalid drive number

Registers Modified

ax, bx, cx, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


DuplicateHandle

Syntax

DuplicateHandle Handle

Function

Duplicates a file handle that is associated with an open file or device.

DOS Function

45h

DOS Versions

2, 3

Input

Handle	the handle to duplicate

Output

carry flag = clear

ax	new file handle

carry flag = set

ax	error code

4 = No more file handles available

6 = Invalid handle or file not open

Registers Modified

ax, bx, flags

Found in IDOS.MAC and MDOS.MAC


ForceDupHandle

Syntax

ForceDupHandle  OriginalHandle, HandleCopy

Function

Takes two file handles and makes the second one equal to the first.

DOS Function

46h

DOS Versions

2, 3

Input

Original	Original file handle

Copy    	Copy of the file handle

Output

carry flag = clear	operation successful

carry flag = set

ax	error code

4 = No more file handles available

6 = Invalid handle or file not open

Registers Modified

ax, bx, cx, flags

Found in IDOS.MAC and MDOS.MAC


GetCurrentDir

Syntax

GetCurrentDir   Drive, StringSeg, StringOfs

Function

Returns the current DOS directory on the indicated disk drive.

DOS Function

47h

DOS Versions

2, 3

Input

Drive	Disk drive(0 = default, 1 = A, etc.)

StringSeg	Segment address of 64-byte buffer to store directory name in

StringOfs	Offset within StringSeg of the 64-byte buffer

Output

If function successful:

Carry flag	clear

The buffer is filled with the full path

If function failed

Carry flag	set

ax	error code:

0Fh	Invalid drive specification

Registers Modified

ax, dl, si, ds, Flags

Found in IDOS.MAC and MDOS.MAC


AllocateMemory

Syntax

AllocateMemory  Paragraphs

Function

Allocates Paragraphs paragraphs of memory.

DOS Function

48h

DOS Versions

2, 3

Input

Paragraphs	# of paragraphs to allocate

Output

If function successful:

Carry flag	clear

ax	initial segment of allocated block

If function failed:

Carry flag	set

ax	error code:

7	If memory control blocks destroyed

8	If insufficient memory

bx	size of largest block available

Registers Modified

ax, bx, Flags

See Also

FreeMemory

ModifyMemory

Found in IDOS.MAC and MDOS.MAC


FreeMemory

Syntax

FreeMemory  BlockAddress

Function

Frees a DOS memory block.

DOS Function

49h

DOS Versions

2, 3

Input

BlockAddress	segment address of the memory block

Output

If function successful:

Carry flag	clear

If function failed:

Carry flag	set

ax	error code:

7	If memory control blocks destroyed

8	If insufficient memory

bx	size of largest block available

Registers Modified

ax, es, Flags

See Also

AllocateMemory

ModifyMemory

Found in IDOS.MAC and MDOS.MAC


ModifyMemory

Syntax

ModifyMemory    Size, MemoryBlock

Function

Modifies A DOS memory blocks size.

DOS Function

4Ah

DOS Versions

2, 3

Input

Size	New block size in paragraphs

MemoryBlock	Segment address of current DOS memory block

Output

If function successful:

Carry flag	clear

If function failed

Carry flag	set

ax	error code:

7	Memory control blocks destroyed

8	Insufficient memory

9	Incorrect segment in es

bx	maximum block size available

Registers Modified

ax, bx, es, Flags

See Also

AllocateMemory

FreeMemory

Found in IDOS.MAC and MDOS.MAC


Exec

Syntax

Exec    Type, ParmSeg, ParmOfs, ProgramSeg,                 ProgramOfs

Function

Runs another program or loads an overlay into memory.

DOS Function

4Bh

DOS Versions

2, 3

Input Syntax

Type	Indicates if the macro is running an application or loading an overlay

ParmSeg	Segment address of parameter block

ParmOfs	Offset of parameter block

ProgramSeg	Segment address of program specification

ProgramOfs	Offset of program specification

Output

carry flag = clear	operation successful

all registers except cs and ip are destroyed

carry flag = set	operation not successful

ax	error code

1 = Invalid function

2 = Program not found

5 = Access denied

8 = Insufficient memory to run the program

0Ah = Invalid environment

0Bh = Invalid format

Registers Modified

ax, bx, cx, dx, si, di, bp, sp, es, ds, ss, flags

Found in IDOS.MAC and MDOS.MAC


TerminateProgram

Syntax

TerminateProgram    ErrorLevel

Function

Terminates the program. If running on DOS 1.0 or 1.1 use Terminate10Program.

DOS Function

4Ch

DOS Versions

2, 3

Input

ErrorLevel	ErrorLevel to return to DOS

Output

None

Register modified

NA

Found in IDOS.MAC and MDOS.MAC


GetReturnCode

Syntax

GetReturnCode

Function

Gets the return code after an Exec.

DOS Function

4Dh

DOS Versions

2, 3

Input

none

Output

ah 	exit type

0 = normal program termination

1 = program was terminated by a CTRL-C

2 = A critical device error terminated the program

3 = Function 31h terminated the program

al	return code of child process

Registers Modified

ax, flags

Found in IDOS.MAC and MDOS.MAC


FindFirst

Syntax

FindFirst   Attributes, StringSeg, StringOfs

Function

Finds the first entry in a directory that matches the given file specification. The information about the file is then stored in the current DTA.

DOS Function

4Eh

DOS Services

2, 3

Input

Attributes	Attributes to use in search for file

StringSeg	segment address of the filename

StringOfs	offset from StringSeg of the filename

Output

If function successful:

Carry flag	clear

DTA is initialized with file information

If function failed

Carry flag	set

ax	error code:

2	Invalid path

12h	No matching entry found

Registers Modified

ax, cx, dx, ds, Flags

See Also

FindNext

Found in IDOS.MAC and MDOS.MAC


FindNext

Syntax

FindNext

Function

Finds the next entry in a directory that matches the file specification last given to FindNext. The information about the file is then stored in the current DTA.

DOS Function

4Fh DOS Services: 2, 3

Input

none

Output

If function successful:

Carry flag	clear

DTA is initialized with file information

If function failed

Carry flag	set

ax	error code:

12h	No matching entry found

Registers Modified

ax, Flags

See Also

FindFirst.

Found in IDOS.MAC and MDOS.MAC


GetVerifyFlag

Syntax

GetVerifyFlag

Function

Gets the current value of the system's verify flag.

DOS Function

54h

DOS Versions

2, 3

Input

none

Output

al 	current value

0 = verify off

1 = verify on

Registers Modified

ax, flags

Found in IDOS.MAC and MDOS.MAC


RenameFile

Syntax

RenameFile  OrigSeg, OrigOfs, NewSeg, NewOfs

Function

Renames a file.

DOS Function

56h

DOS Versions

2, 3

Input

OrigSeg	Segment address of the string containing the original filename

OrigOfs	Offset of the string

NewSeg 	Segment address of the new filename

NewOfs 	Offset of the new filename string

Output

carry flag = clear	operation successful

carry flag = set	operation unsuccessful

ax	error code

2 = File not found

3 = File couldn't be found

5 = Access denied

11h = A different device

Registers Modified

ax, dx, di, ds, es, flags

Found in IDOS.MAC and MDOS.MAC


GetSetFileDateTime

Syntax

GetSetFileDateTime  GetSet, Handle, Time,                             Date

Function

Will get or set a file's date and time. Note that you only need to provide the Time and Date parameters when setting the file's Date and Time.

DOS Function

57h

DOS Versions

2, 3

Input

GetSet	0 = Get the file's date & time,

1 = Set them

Handle	File handle

Time	New time(GetSet = 1)

Date	New date(GetSet = 1)

Output

carry flag = clear	operation successful

carry flag = set	operation unsuccessful

ax	error code

1	Invalid function

6	Invalid file handle

Registers Modified

ax, bx, cx, dx, flags

Found in IDOS.MAC and MDOS.MAC


GetSetAllocationStrategy

Syntax

GetSetAllocationStrategy

Function

Gets or sets DOS's memory allocation strategy.

DOS Function

58h

DOS Versions

3

Input

GetSet	0 = get, 1 = set

Strategy	Code as defined below(GetSet = 1)

STRATEGY	FUNCTION

0	First fit

1	Best fit

2	Last fit

Output

carry flag = clear	operation successful

carry flag = set	operation unsuccessful

ax	error code

1 = Invalid function

Registers Modified

ax, bx, flags

Found in IDOS.MAC and MDOS.MAC


GetExtendedErrors

Syntax

GetExtendedErrors

Function

Returns extended error information about a DOS error that just occurrred.

DOS Function

59h

DOS Versions

3

Input

none

Output

ax	extended error code as define below

CODE	DESCRIPTION

1	Invalid function #

2	File not found

3	Path not found

4	Too many open files

5	Access denied

6	Invalid handle

7	Memory control blocks destroyed

8	Insufficient memory

9	Memory block address invalid

0Ah	Environment invalid

0Bh	Invalid format

0Ch	Invalid access code

0Dh	Invalid data

0Fh	Invalid disk drive

10h	Attempted to delete the current directory

11h	Not the same device

12h	No more files

13h	Disk is write-protected

14h	Unit unknown

15h	Drive not ready

16h	Unknown command

17h	Data error(CRC value)

18h	Bad request structure length

19h	Seek error

1Ah	Unknown medium type

1Bh	Sector not found

1Ch	Printer out of paper

1Dh	Write fault

1Eh	Read fault

1Fh	General failure

20h	Sharing violation

21h	Lock violation

22h	Disk change invalid

23h	FCB unavailable

50h	File already exists

52h	Cannot create the directory

53h	Int-24(critical error) failed

bh	error class as defined below

CLASS	DESCRIPTION

1	Out of a resource

2	A temporary situation like a locked record

3	Authorization error

4	Internal system error

5	Hardware failure

6	System software failure

7	Application software error

8	File or item not found

9	Invalid format or type for file or item

0Ah	File or item is interlocked

0Bh	Wrong disk or bad disk

0Ch	Any other error

bl	recommended action as defined below

ACTION	DESCRIPTION

1	Retry the operation a few times then prompt the user

2	Retry the operation with a small delay between retries, then prompt the user.

3	Get input from user

4	Abort the application gracefully

5	Abort immediately

6	Ignore the error

7	Retry the operation after the user corrects the problem

ch	location of the error as defined below

LOCATION	DESCRIPTION

1	Unknown

2	A block device like a disk or ram disk

3	Network related error

4	Serial device error

5	Memory related error

Registers Modified

ax, bx, cx, flags

Found in IDOS.MAC and MDOS.MAC


CreateTemporaryFile

Syntax

CreateTemporaryFile Attribute, FilenameSeg,                             FilenameOfs

Function

Creates a temporary file.

DOS Function

5Ah

DOS Versions

3

Input

Attribute	File attribute as defined below

ATTRIBUTE	DESCRIPTION

0	Normal file

1	Read-only

2	Hidden

4	System

FilenameSeg	Segment address of filename string

FilenameOfs	Offset of filename string

Output

carry flag = clear	operation successful

ax	file handle

ds:dx	address of the filename string

carry flag = set	operation unsuccessful

ax	error code

3 = Path not found

5 = Access denied

Registers Modified

ax, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


CreateNewFile

Syntax

CreateNewFile   Attribute, FilenameSeg,                         FilenameOfs

Function

Creates a new file. If the specified file already exists an error is returned.

DOS Function

5Bh

DOS Versions

3

Input

Attribute	File attribute as defined below

ATTRIBUTE	DESCRIPTION

0	Normal file

1	Read-only

2	Hidden

4	System

FilenameSeg	Segment address of filename string

FilenameOfs	Offset of filename string

Output

carry flag = clear	operation successful

ax	file handle

carry flag = set	operation unsuccessful

ax	error code

3 = Path not found

4 = No more file handles

5 = Access denied

50h = File already exists

Registers Modified

ax, cx, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


ControlFileAccess

Syntax

ControlFileAccess   LockUnlock, Handle,                             OffsetHigh, OffsetLow,

                            LengthHigh, LengthLow

Function

Locks or unlocks a record in a file on a networked system.

DOS Function

5Ch

DOS Versions

3

Input

LockUnlock 	0 = lock, 1 = unlock

Handle	File handle

OffsetHigh	High word of record offset

OffsetLow	Low word of record offset

LengthHigh	High word of record length

LengthLow	Low word of record length

Output

carry flag = cleared	operation successful

carry flag = set	operation unsuccessful

ax	error code

1 = Invalid function

6 = Invalid file handle

21h = All or part of the record is already locked

Registers Modified

ax, bx, cx, dx, si, di, flags

Found in IDOS.MAC and MDOS.MAC


GetMachineName

Syntax

GetMachineName  BufferSeg, BufferOfs

Function

Returns the local machine name on a network.

DOS Function

5Eh   Sub-Function: 00h

DOS Versions

3

Input

BufferSeg	Segment address of the string buffer

BufferOfs	Offset of the buffer

Output

carry flag = clear	operation successful

ch	= 0	name not defined

> 0	name defined

cl	NETBIOS name number(ch <> 0)

ds:dx	address of identifier(ch <> 0)

carry flag = set	operation unsuccessful

ax	error code

1	Invalid function code

Registers Modified

ax, cx, dx, ds, flags

Found in IDOS.MAC and MDOS.MAC


SetupPrinter

Syntax

SetupPrinter    BufferSeg, BufferOfs,                         ListIndex, StrLength

Function

Sets up a printer attached to the network.

DOS Function

5Eh

Sub-Function

02h

DOS Versions

3

Input

BufferSeg	Segment address of the setup string

BufferOfs	Offset of the buffer

ListIndex	Redirection list index

StrLength	Length of the setup string

Output

carry flag = clear	operation successful

carry flag = set	operation unsuccessful

ax	error code

1	Invalid function code

Registers Modified

ax, bx, cx, si, ds, flags

Found in IDOS.MAC and MDOS.MAC


GetPrinterSetup

Syntax

GetPrinterSetup BufferSeg, BufferOfs,                         ListIndex

Function

Returns the local machine name on a network.

DOS Function

5Eh

Sub-Function

03h

DOS Versions

3

Input

BufferSeg	Segment address of the string buffer

BufferOfs	Offset of the buffer

Listindex	Redirection list index (Function = 2-3)

Output

carry flag = clear	operation successful

cx	length of the printer setup string

es:di	address of the buffer holding the setup string

carry flag = set	operation unsuccessful

ax	error code

1	Invalid function code

Registers Modified

ax, bx, cx, di, es, flags

Found in IDOS.MAC and MDOS.MAC


GetListEntry

Syntax

GetListEntry    ListIndex, DeviceSeg,                         DeviceOfs, NetworkSeg,

                        NetworkOfs

Function

Gets a redirection list entry from the network system.

DOS Function

5Fh

Sub-function

02h

DOS Versions

3

Input

ListIndex	Redirection list index

DeviceSeg	Segment address of buffer to hold the device name

DeviceOfs	Offset of buffer

NetworkSeg	Segment address of buffer to hold the network's name

NetworkOfs	Offset of buffer

Output

carry flag = clear	operation successful

bh	device status flag(0 = valid device, 1 = invalid device)

bl	Device type(3 = printer, 4 = drive)

cx	Stored parameter

ds:si	address of device name

es:di	address of the network's name

carry flag = set	operation unsuccessful

ax	error code

1 = Invalid function

12h = No more files

Registers Modified

ax, bx, cx, dx, bp, si, di, es, ds, flags

GetListEntry

Syntax

GetListEntry Type, Save, DeviceSeg, DeviceOfs, NetworkSeg, NetworkOfs

Function

Redirects a device on a network.

DOS Function

5Fh

Sub-function

03h

DOS Versions

3

Input

Type	The device type as defined below

TYPE	DESCRIPTION

3	Printer

4	Disk drive

Save	A parameter that needs to be saved for the caller

DeviceSeg	Segment address of buffer to hold the device name

DeviceOfs	Offset of buffer

NetworkSeg	Segment address of buffer to hold the network's name

NetworkOfs	Offset of buffer

Output

carry flag = clear	operation successful

carry flag = set	operation unsuccessful

ax	error code

1 = Invalid function

3 = Path not found

5 = Access denied

8 = Insufficient memory

Registers Modified

ax, bx, cx, si, di, es, ds, flags

GetListEntry

Syntax

GetListEntry    DeviceSeg, DeviceOfs

Function

Redirects a device on a network.

DOS Function

5Fh

Sub-function

04h

DOS Versions

3

Input

DeviceSeg	Segment address of buffer to hold the device name

DeviceOfs	Offset of buffer

Output

carry flag = clear	operation successful

carry flag = set	operation unsuccessful

ax	error code

1 = Invalid function

0Fh	Redirection paused on server

Registers Modified

ax, si, ds, flags

Found in IDOS.MAC and MDOS.MAC


GetPSPAddress

Syntax

GetPSPAddress

Function

Returns the address of the current PSP.

DOS Function

62h

DOS Versions

3

Input

none

Output

bx	Segment address of the Program Segment Prefix(PSP)

Registers Modified

ah, bx, flags

Found in IDOS.MAC and MDOS.MAC


LeadByteTable

Syntax

LeadByteTable   Function, Console

Function

Returns the address of the system table of legal lead bytes or gets/sets the value of the interim console flag.

DOS Function

63h

DOS Versions

2.25

Input

Function

The sub-function as defined below:

FUNCTION	DESCRIPTION

0	Get the address of the system lead byte table

1	Setting the value of the console flag

2	Getting the value of the console flag

Console	Indicate if setting/getting the console flag(Function = 1)

Output ds:si	Address of the lead byte table (Function = 0)

dl	Value of the console flag(Function = 2)

Registers Modified

ax, dl, flags

Found in IDOS.MAC and MDOS.MAC


Macros Included with Turbo Assembler
Macros Included with Turbo Assembler.

The file MMACROS.ZIP contains several very useful include files.

Equate Files

Macro files

IBIOS.MAC

MBIOS.MAC

IMACROS.MAC

MMACROS.MAC

IDOS.MAC

MDOS.MAC


Table of Contents

Help on Help

Turbo Assember command line options

Predefined symbols

Operator precedence

Special Macro Operators

Turbo Assembler Include Files

Error List

Miscellaneous