V22.0201.002, Machine Organization I, Fall 97



The Turbo Assembler from Borland is called TASM. This software is assumed for this class, and provided in the PC labs. You can purchase your own copy from the NYU bookstore for about $75 (for cheaper sources, look at the course homepage under "other information").

MASM stand for Microsoft Assembler. It is very similar to TASM, and it is the assembler assumed in the text book. Moreover, TASM has a mode that makes it emulates MASM.

Associated with assemblers are typically two other pieces of software called the linker and debugger. The linker and debugger that comes with TASM are called TLINK and TD, respectively. The linker and debugger that comes with MASM are called LINK and CODEVIEW (or, DEBUG, the DOS version of the debugger), respectively.

Appendix E in the textbook describes LINK, CODEVIEW and DEBUG. It is useful to to read this even if you are working with TASM.

What are the functions of the assembler and linker?

Basically, the assembler converts symbolic addresses into concrete addresses, and translates assembly instructions into machine instructions (essentially, bytes). But these ``concrete'' addresses are still not fully resolved because it may depend on where the instructions and data are physically loaded in the machine. The linker provides such information. The linker is also used to ``link'' together several modules into one big program (this is the reason for the linker's name!).

First Steps

You should read section 4.10 (p.70) of the textbook for this. There are 4 essential steps from creating an assembly program to producing an executable code.
  1. Use any text editor to create a source program. This file normally has name that ends with .asm. For example, hw1.asm might be appropriate for homework 1. A very simple editor which is available from DOS is called edit. You can begin editing by typing the following at the DOS prompt (indicated here by :>):
        :> edit hw1.asm
  2. Use TASM to convert the source program into an object file. The name of an object file normally ends with .obj. To do this, type the following at the DOS prompt:
        :> tasm hw1		
    This produces the file hw1.obj from the file hw1.asm.
  3. Use the linker TLINK to link your file(s) together into an executable file. In this case, you have only one file (hw1.obj) to link. The name of the executable file normally ends with .exe. For our example, you type the follwing at the DOS prompt:
        :> tlink hw1                     
    This produces the executable file called hw1.exe.
  4. Finally, you can run (or execute) the executable file:
        :> hw1                     
If you want information for debugging, click HERE

Comments? yap@nyu.edu