(Assume that your program is called "proj.asm")
1) First you need to type your program :
* In your Windows system, create a new file by choosing Start- Run, then type “notepad” (or go to Start- Programs- Accessories- Notepad)
* Now type your program and then save the file as proj.asm locally on your computer. (Note that you have to use the extension .asm for the file)
2) Now you can compile your program as follows:
* Open an MSDOS window by choosing Start- Run then type : “command” or “cmd”.
* Compile using:
tasm/z/zi proj.asm (Note that this assumes that you are compiling from the same directory where your proj.asm file is located)
The /z switch causes TASM to display the lines that generate compilation errors. The /zi switch enables information needed by the debugger to be included in the .OBJ file.
Note that you should use "real mode" assembler, TASM.EXE. Do not use the "protected mode" assembler TASM32.EXE for the assignments that will be given in class.
3) Run the Linker to generate an .EXE file from the .OBJ file:
In your MSDOS command line type:
tlink/v proj
4) Running the program:
Your final program (if there were no errors in the previous step) will have an .EXE ending. To just run it from the command line, type:
proj
If you want to use the debugger to examine the instructions, registers, etc., type:
td proj
This brings up the regular full-screen version of the Turbo debugger.
The Turbo debugger is a comprehensive menu-driven debugging package. Here are the debugging functions that are most important for you to know how to use as CS 2011 students:
1. Tracing the Program's Execution
When the Turbo debugger first starts, a Module Window which contains the source of your program is displayed. Executable lines of code are marked with a bullet in the left column of the window. You can set breakpoints or step to any of these lines of code. An arrow in the first column of the window indicates the location of the instruction pointer. This always points to the next statement to be executed. To execute just that instruction use one of the two methods listed under the Run menu item:
o Trace into (can use F7 key): executes one instruction; traces "into" procedures.
o Step over (can use F8 key): executes one instruction; skips (does not trace into) procedures.
Hitting either of these executes the instruction, and moves the arrow to the next instruction. As each instruction executes, the effects might be visible in the Registers Window and Watches Window.
2. Setting and Removing Breakpoints
To set a breakpoint, position the cursor on the desired line of source code and press F2. The line containing the breakpoint will turn red. Pressing F2 again removes the breakpoint. To execute all instructions from the current instruction pointer up to the next encountered breakpoint, choose Run (can use F9 key) from the Run menu item.
3. Examining Registers
Another window, the Registers Window, can be opened to examine the current value of the CPU registers and flags. The View menu can be used to open this Registers Window. The registers and flags might change as each instruction is executed.
4. Examining Memory
To examine memory, you will need to open an Inspector window. An Inspector window shows the contents of a data structure (or simple variable) in the program you are debugging. It also allows you to modify the contents of the data structure or variable.
To open an Inspector window, place the cursor on what you want to inspect and press CTRL-I. After you've examined the data item, press the ESC key to remove the Inspector window.
5. Viewing the Program's Output
Output written to the screen by a program is not immediately visible, since the main purpose of using a debugger is to examine the internal operation of the program. To observe what the user would see, press ALT-F5. The entire screen will change to a user-view showing the program's input and output (and possibly that of previous programs as well). Press any key to return to the debugger screen.