Showing posts with label starting with tasm. Show all posts
Showing posts with label starting with tasm. Show all posts

Tuesday, 6 January 2015

Tutorial 1- Starting with Tasm


Assembly Language for INTEL 8086 

Tutorial 1-

Topics-


1. Key points to remember before starting 8086 
2. Downloading TASM
3. Using TASM 


Assembly Language for beginners could be overwhelming at times, but once the concept behind each instruction is known, things get easier.


I. Here are the few key points to keep in mind when you start learning assembly language:

1. Practicing using an emulator is a must- To actually understand what's happening with your data you should use an 8086 emulator like TASM, this also gives you a better understanding of each instruction.

2. Brushing up concepts of conversion of different bases to hexadecimal base is very essential.
For example:
Decimal- Hexadecimal
Octal- Hexadecimal

3. All data stored in the emulator is in hexadecimal (base 16) which also is the case in the actual microprocessor. The 8086 works with only hexadecimal numbers. (I'll talk about this in detail when we start programming)

4. Basic understanding of the 8086 microprocessor is a must.




II. Downloading TASM

Method 1- 


This link below will directly allow you to download an exe file which will help you guys to start off with your first program and is hassle free and very easy to use. But it's limited to windows 7 users. I'm not sure if there are other versions out yet. So feel free to just let us know.

You can download TASM from sourceforge for windows 7  by following the link
http://sourceforge.net/projects/tasmforwindows/


Method 2-

It's the conventional way of downloading the tasm files and download it in the drive you wish.
All the project files will be made in this directory itself.
http://sourceforge.net/projects/tasmeditor/
or

http://www.softpedia.com/get/Programming/Other-Programming-Files/TASM-Editor.shtml

Download the zip version and then extract to your desired path. Make sure you know where you're extracting as you'll need the path to build any program.





III. Using TASM

Method 1- 

If you guys have been successful in downloading the exe file. Then you just need to double click the shortcut created on the desktop.


Method 2

If you guys have downloaded using the tasm files, follow the steps below
1. Start-Command Prompt(or type cmd in search option)
2. type cd <path name>. cd stands for change directory in cmd and path name will be the path of your tasm folder, for eg: cd E:\Tasm\BIN


Once you've followed any of the two methods, you are ready to write your first assembly language program.

The steps mentioned below need to be taken always: 

1. Type edit (people using method 2, make sure you're in the directory)


2. A blue screen will pop up like shown below

Fig 1. Edit screen

3. Once this pops up type the following(Don't break your head too much on the code, I'll explain what's actually happening in the later tutorials)

code segment
           assume cs: code          
start: mov ch, 05                              ;we always start a commenting using ";"
          mov ah, 01                              ;tasm is not case sensitive
          mov ah, 4ch
          int 21h
code ends
end start

4. Now go to file, select save as, under file name type a name (max 7 character!!) followed by .asm. For eg: try.asm as shown below. Don't forget the .asm(stands for assembler), click ok


Fig 2. Save as screen (file_name.asm)

5. Now go to file, select exit

6. You'll get back to the dos screen, then type tasm file_name.asm(in my case tasm try.asm),
If there are no errors, you can proceed. If there are errors then you could just type edit file-name.asm ( edit try.asm) and make the corrections

7. Once there are no errors type tlink file_name.obj (tlink try.obj)

8. Then type td file_name.exe( td try.exe)- This basically takes you to the turbo debugger to put it in simple language it allows to understand what's happening at the microprocessor by creating it virtual environment. Once you enter the turbo debugger just press F7 and you'll be able to debug your program(It will be used when we deal with complex problems)

Fig 3. tasm and tlink


Fig 4. Turbo debugger


Congratulations!! you've built your first assembly language program. There's a lot do yet, it's just beginning.


Tune in for next tutorial, Basic architecture of 8086.