|
Turbo Assembler Notes
Installation
These are the steps you need to follow to setup TasmIDE at home.
1. Download the file TasmIDE.zip.
2. Open the file using WinZip and extract its contents directly to the
descktop
(i.e. C:\WINDOWS\DESKTOP).
N.B. If you extract the file to a different location you will need to change the
path to tasm under Program -> Settings
3. Open the TasmIDE directory and double click on the TasmIDE executable file
Creating assembly
programs
You can use any text editor to enter assembly program but make sure to
save the file with extension .ASM. For example, you can use the MS-DOS text
editor (type Edit at DOS prompt to activate it). There are also many
IDE's (i.e. Integrated Development Environments) with added functionality
that are freely available on the net (check the Links
section).
However for basic exercises in this unit, the provided freeware TasmIDE and its
integrated editor should be sufficient.
This example is an assembly program that
displays a message on screen.
Using TASM tools directly (external from TasmIDE)
Assume that you have an assembly program in a file named Ex.asm.
Step 1: Compiling the assembly program
To assemble the file, use this command:
tasm Ex.asm
If there is no error in your program, this will create an object (binary) file
named Ex.obj. Otherwise, TASM will display an error message which indicates the
line numbers where errors appear together with descriptions of the errors.
Step 2: Linking the object file(s)
Now, to create an executable program from the object file Ex.obj,
type
tlink Ex
Note this will create an EXE file named Ex.exe. However, to create a COM
file, instead of the above command, use
tlink /t Ex
See the lecture notes for the differences between EXE and COM formats.
You can download templates for .EXE and .COM programs here.
Step 3: Running the program
To run the executable program, simply type the following at the DOS prompt:
Ex
Step 4: Debugging the program
To debug the program, we use Turbo Debugger TD.EXE:
td Ex
Debugging at source-code level
You can debug the program at source-code level by adding debugging information
using these commands
| EXE format |
COM format |
tasm /c /la /zi Ex.asm;
tlink /v Ex.obj, Ex.exe, Ex.map
tlink /t Ex
tdstrip -s Ex.exe
td Ex |
tasm /c /la /zi Ex.asm;
tlink /v Ex.obj, Ex.exe, Ex.map
tdstrip -s Ex.exe
td Ex |
Turbo Debugger lets you step through your assembly program instruction by
instruction (pressing F7) and see changes in the program variables, CPU
registers, etc (from View menu). It is an extremely useful tool for detecting
errors in program logic.
|