Assembling an ALP program using TASM

31 Jul 2014 by admin


We assume you already have tasm installed in your system

  1. Open windows command prompt and navigate to TASM folder


  2. Open editor using the following command

  3. edit hello.asm

    Here hello.asm is the name of the file we want to edit.

    This will open the editor window.



  4. Type in the assembly language program you need.

    For this example We've shown a simple "hello world" program.




    Here is the code for your reference.
    .model small
    
                print macro m
                mov ah,09h
                lea dx,m
                int 21h
                endm
    
            .data
    
              message db 10,13, "Hello world $"
            
    		.code
    
            start:
              mov ax,@data
              mov ds,ax
              print message
    
              mov ah,4ch
              int 21h
    
              end start
              end
         
  5. Save the code and exit the editor using the file menu and return to command prompt.


  6. To assemble the file,type the following command
    tasm hello.asm

    Here "tasm" is the name of the assembler (Turo Assembler) and hello.asm is the file which is to be assembled.

    The assembler will produce an object file "hello.obj" if no errors are there in the program.

    If there are errors in your code, again launch the editor and modify your code to remove them and try again untill all errors are removed.




  7. This file is taken by the linker and an executable(.exe) file is produced.
    tlink hello.obj






  8. Finally,you can run the program using the .exe file hello.exe Here is a screenshot of the exeuting program.




Category: Assembly

Comments

comments powered by Disqus