The Assembly Programming Master Book

In this chapter, I describe two competing products, MASM and TASM, and their advantages, drawbacks, common features, and differences. In the late 1980s, when I first started to work on an IBM PC, the first question that I asked more experienced colleagues was about Assembly language. Before that time, I was involved in programming for different computers, which mainly had limited resources. Naturally, Assembly language was the mainlanguage for such computers. [i] I started to work with MASM version 2, as far as I recall. Surprisingly, I started to write database applications using it. My project was not accomplished, but I have grown to love Assembly language. Some time later, I encountered Turbo Assembler 1.0. It operated considerably faster than MASM.

Later, I had to use both assemblers alternately. As you probably guessed, the first love was stronger. Nevertheless, now I must seriously tell you, which of the two products is best suited for writing Windows applications.

Command-Line Options of ML.EXE and TASM32.EXE

I'll start with reference information about the command-line options of ML.EXE (Table 5.1) and TASM32.EXE (Table 5.2). First consider the ML.EXE translator.

Table 5.1: Command-line parameters of the ML. EXE program

Parameter

Description

/?

Display help.

/AT

Create a COM file. Naturally, this option is not needed when programming for Windows.

/Bl<linker>

Use the alternative linker. The linker is supposed to start automatically.

/c

Compile without linking.

/CP

Preserve the case of user identifiers. This can be used for additional control.

/Cu

Toggle all user identifiers to uppercase.

/Cx

Preserve the case in all user identifiers declared as PUBLIC or EXTERNAL.

/coff

Generate object modules in the common object file format (COFF). This is a required option.

/D< name > = [string]

Define a text macro. This is useful for debugging with conditional compiling.

/EP

Output the preprocessed listing (program code with INCLUDE files) to stdout .

/F<hex>

Set the stack size (bytes). The default value is 1 MB.

/Fe<file>

Define a name for the resulting executable file name. This makes sense when used without the /c option.

/Fl<file>

Generate a listing file.

/Fm<file>

Generate a map file. This makes sense when used without the /c option.

/Fo<file>

Set the object file name.

/Fpi

Include the 80x87 coprocessor emulation code. This option became obsolete with the arrival of the i486 processor.

/Fr

Generate limited browser information.

/FR

Generate full browser information.

/G<c d / z>

Use a Pascal, C, or Stdcall calling convention.

/H<number>

Set the maximum length of external names .

/I<name>

Add the path for the INCLUDE files. Up to 10 /I options are allowed.

/link<opt>

Linker command-line options. This makes sense when used without the /c option.

/nologo

Do not display the compiler logo text.

/Sa

Maximize the listing format.

/Sc

Include timings in the listing.

/Sf

Generate a first-pass listing.

/Sl<number>

Set the listing line width.

/Sn

Suppress a symbol-table listing.

/Sp<number>

Set the listing page length.

/Ss<string>

Set listing subtitle text.

/St<string>

Set listing title text.

/Sx

Include fragments of conditional compiling in the listing.

/Ta<file>

Assemble files with a filename extension other than ASM.

/W<number>

Set the list of compile-time events that should be interpreted as warnings.

/Wx

Interpret warnings as errors.

/w

This is the same as /W0 or /WX.

/X

Ignore the path set by the INCLUDE environment variable.

/Zd

Debug information. This comprises only line numbers .

/Zf

Declare all names as PUBLIC .

/Zi

Include full debug information.

/Zm

Enable the compatibility mode with MASM 5.01.

/Zp<n>

Set structure alignment.

/Zs

Perform a syntax check only.

Table 5.2: Command-line parameters of the TASM32.EXE program

Parameter

Description

/? or /h

Display a help screen.

/a

Order segments in the object file alphabetically .

/s

Order segments in the object file sequentially.

/d<name>= [string]

Define a text macro. This is convenient for debugging using conditional compiling.

/e

Generate the 80x87 coprocessor emulation code.

/r

Resolve coprocessor instructions.

/i<string>

Set the path for INCLUDE files. The syntax is similar to that of the PATH command.

/j<dir>

Define the assembler startup directive.

/kh<number>

Specifies the maximum number of identifiers. The default value is 16,384.

/l

Generate a listing file.

/la

Generate a listing file and show high-level interface code inserted by the assembler.

/ml

Treat all identifiers as case sensitive.

/mx

Treat PUBLIC and EXTERNAL identifiers as case sensitive.

/mu

Interpret all characters in identifiers as uppercase.

/mv<number>

Set the maximum identifier length.

/m<number>

Set the number of translator passes . The default value is 1.

/n

Suppress the symbol table in the listing file.

/os, /o, /op, /oi

The object code type: Choose from standard, overlay, Pharlap, and IBM.

/p

Check for impure protected-mode code (e.g., the code with side effects).

/q

Remove all redundant information (e.g., all information not necessary for linking) from the object code.

/t

Suppress all messages on successful assembling.

/wo, /wl, /w2.

The level of message verbosity : Do not generate messages or generate messages.

/w+<xxx>/w-<xxx>

Generate (+) or do not generate ( ˆ ) messages of class xxx.

/x

Include false conditional assembling messages in the listing.

/z

Display the source line containing an error along with error messages.

/zi

Include debug information in the object code.

/zd

Include line numbers in the object code.

/zn

Do not include debug information in the object code.

To start assembling using MASM32 or TASM32, it is possible to use a special batch file. This is a normal text file that lists all command-line options. For example, instead of the MASM32/ml/c mt. asm command line, it is possible to create a text file containing the following commands:

/c mt.asm

Name the file MT.CMD, and issue the following command:

ml @mt.cmd.

TASM32 works with batch files in a similar way.

[i] For example, at one time Yamaha PCs were widely used in education. Those PCs had only 64 KB (later 128 KB) of RAM. Naturally, writing programs in high-level programming languages such as Pascal for such a PC was an impermissible luxury.

Категории