MASM 6.11 (1993) is the assembler this guide's examples were written for. Its driver ML assembles each file it is given and then runs the linker, LINK, on the results, so one command makes a program. C:\MASM611\BIN and C:\MASM611\BINR (the real-mode linker and tools) go on the PATH.
| Option | Effect |
|---|---|
| /AT | tiny model: link a .COM (passes /T to LINK) |
| /c | assemble only, write the .OBJ files and stop |
| /Fe name | name of the program (default: the first source's name) |
| /Fo name | name of the object file |
| /Fl | write a listing (.LST) |
| /Fm | have LINK write a map (.MAP) |
| /Zi | CodeView information in the objects and the program |
| /W3 | more warnings |
| /nologo | no banner |
| /link ... | the rest of the line goes to LINK |
SET PATH=C:\MASM611\BIN ;C:\MASM611\BINR;%PATH%ML /AT HELLO.ASM ; HELLO.COMML HELLOX.ASM ; HELLOX.EXEML /c HELLOX.ASM ; HELLOX.OBJ only ...LINK HELLOX ; ; ... and the link on its ownML /Fl /Fm /Zi /FePROG.EXE MAIN.ASM PRINT.ASM
LINK
LINK takes five fields separated by commas: the object files (joined with +), the program, the map, the libraries and a definitions file (for Windows and OS/2 programs). A field left empty takes its default, and the closing semicolon accepts the defaults for all the rest; without it LINK asks for each field in turn. /T writes a .COM, /CO keeps CodeView information, /MAP adds the public names to the map.
LINK MAIN+PRINT,PROG,PROG.MAP ;LINK MAIN,PROG,,UTIL.LIB ;LINK /T HELLO ;
LIB
LIB library commands; creates the library if it is not there. +obj adds a module, -obj removes one, -+obj replaces it, *obj copies it out to a .OBJ file. A second field names a listing of the library's modules and their public names: LIB UTIL.LIB,UTIL.LST;.
CodeView
CodeView (CV PROG) is the full-screen debugger: the source of a program built with /Zi in one window, registers, memory and a command line in others. F8 traces into, F10 steps over, F5 runs, F9 sets a breakpoint on the cursor's line, F4 shows the program's own screen. For the console and for programs without CodeView information there is DEBUG.
Pitfalls
A .COM needs the tiny model and ORG 100h, and must not have a stack segment; a .EXE without one gets warning L4021. LINK is case-insensitive by default: two names that differ only in case are one name. Objects built with /Zi carry 32-bit debug records that Borland's TLINK refuses ("32-bit record encountered"); assemble without /Zi when linking with TLINK.