Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 18

TURBO Assembler{TASM}

PART I
The below explanation is used to provide the information about how to execute a
simple program (assembly language) in a Turbo Assembler.
Have patience in reading explanation provided for each step and remember that
this explanation is provided for the novice.
Step 1:
In order to execute a program, first you must have the software and the name of the
folder must be TASM.
The systems in the lab already consist this software, just you have to find out in
which drive it has, remember the path.

The folder name is TASM, and is available in C drive

Step 2: click on start and click on run

Step 3: type command or in short CMD and press enter

Step 4: this is the command window which has appeared, and the path is not
towards the software TASM.

Step 5: In order to change the path, type CD\ and press enter

Step 6: now select the path, as already you know that its in C drive(Ref. Step1),
but if its in another drive, type the drive name along with a colon ( D: ) and press
enter to select the drive .

Step 7: In Order to load the file TASM ,type CD TASM and press enter

Step 8: now the tasm will be loaded

Step 9: in order to start , type edit and press enter to get the assembler window
where u can type the program.

Step 10: in this window you can type the program

Step 11: for the explanation, the example program used is addition of two eight
bit numbers.

First number is 10h, and second number is 20h.which are stored in AL,BL
respectively. After addition the result will be stored in AL
The execution of the program will start from the first instruction in code segment
(mov ax,data) and the label used is DATA and later it will be replaced with its
Equivalent ASCII value(u can observe in step 20) and for step by step execution
HLT is used(ref execution of the program step 24)

Step 12: after typing the program, save it

The name which is provided to save the program is rahim, and the file name must
have an extension asm, so it should be rahim.asm. if you want to store with a file
name first then it should be(first.asm)

Once the program is stored , you have to close the assembler window and have to
open the command window.
Click on file and select exit.

Step 13: once again you will get the same command window.

RECALL:
Previously what all you have done is you have opened the assembler and typed the
program and saved it.
NEXT STEPS: its the right time to execute the program, and for that you have to
provide series of commands and the first one of it will be explained in the next step,
so sit tight and continue
Step 14:
To check for syntax errors ,the command is TASM filename.asm

As the file name was rahim , so it will be tasm rahim.asm, and press enter

Step 15: if there are any errors it will show the errors, so once again you have to
edit the program with a command edit rahim.asm and fix the errors and repeat

step 14. If its error free then go to step 16, as its the first program so I am in a
positive mood so I dont want to discuss about errors (If you got errors, just check
the program provided in the step 11, and it should match your program)

Step 16: the next command is used to link the program with the TASM and the
syntax for it is
TLINK filename.OBJ, and press enter

As the file name is rahim, so it should be tlink rahim.obj and press enter and you
will get the next slide which is shown

Step 17: this step is used to execute the program in debug mode, the syntax is
DEBUG Filename.exe
And press enter

As the file name is rahim, so it should be debug rahim.exe and press enter and
you will get a symbol (-)

Step 18: type U and press enter as to get the program

Step 19 : after pressing enter you will get

Step 20: you have to find the first instruction of your program(read the explanation
provided in step 11) and it will be

You have to observe the value towards the left hand side (:0010) thats the starting
address of the program
In order to start execution from 0010, u have to replace the instruction pointer
value(IP)

Step 21: to change the IP address, type R and space IP .( R IP) and press enter.

Step 22: as the first location 0000 will be available, now enter 0010 and press enter.

Step 23: once again u will get a (-) symbol

Step 24: now the execution can be carried either by single step execution
mode( one instruction will be executed once) or by break point (complete
execution/till a break point)
For step by step HLT will be used and for complete execution replace HLT with INT
03
As its the first program, let us deal with step by step execution, in debug inorder to
execute step by step the command used is T and press enetr

The next instruction that has to be execute will be available at the bottom. (ex:
MOV DS,AX), and all the contents of registers will be shown and as all registers are
sixteen bits, and these bits are represented with hexa decimal numbers, so four
digita are used to represent 16-bit(using 8421 code) ,continue step 24 till you get
halt. But check after every instruction is executed whats the status of registers.

Step 25:

Refer step 11 ,where the first number is placed in AL register ,and the registers
which will be displayed are of 16 bits(for al check lower two digits of AX,for ah check
higher two digits of AX registersame is applicable for BX,CX and DX)
First number is 10,second number is 20, after addition the result is available in AL
register(check AX register)
Step 26: after execution is completed the debug mode must be ended , for that the
key word used is Q and press enter

Step 26: once again you will get command window

Step 27: In order to close command window type EXIT and press enter

Step 28: If you are reading this by now you have completed execution of a simple
program using TASM, if still you have some patience left out just check the
remaining steps, as earlier in discussion about how execution takes place(ref
explanation of step 24)
The next steps will deal with complete execution

Step 29:

If u observe the program , only one change is available and it is INT 03h which
replaced HLT. Thats it, after that follow step 12 to step 22
Step 30: now after that instead of T you have to use G and press enter such that
complete program will be executed.

Step 31:

If you observe in AX, u will have the result. But when you perform complete
execution, you will never know how the processor is executing the instructions, how
the data is transferred . so I recommend as a learners execute step by step.
Hope you have executed in both the ways, and you may feel using G is better than
using T ,but as a learners use T.
Congrats you have executed your first program in TASM, this is all about PART I, you
will be shortly provided with PART II of TASM

Coming Soon :

How to execute array of numbers


How to execute strings

You might also like