Monday, April 11, 2011

Compiling Assembly using TASM in command prompt

Are you learning Assembly language, and confused about how to compile assembly file?
TASM20 is one of assembly compilers that works with Windows XP and Windows 2000 operating system. However, it does not work with Windows 7 64-bit operating system.
If you are using Windows XP or Windows 2000, you can try the following steps to compile and run assembly file.
To download TASM20, the compiler used for assembly file, click here.

Assumption: The Tasm.exe & Tlink.exe files used to compile assembly file are located at C:\tasm20\TASM.

1. Open command prompt by pressing Windows + R, or go to Start menu -> Run, then type "cmd" (without quotes).

2. Go to the folder where the Tasm.exe & Tlink.exe files used to compile assembly file are located, i.e. C:\tasm20\TASM.
cd\tasm20\tasm
 

3. For instance, we have made an assembly file named coba.asm used to print character 'A' as following:

4. Commands used:
- To compile the assembly file, use command:
tasm <asm_filename>.asm
e.g.
tasm coba.asm

After executing the command above, an object file (coba.asm) will be created.

- To create .COM file, use command:
tlink /t <obj_filename>.obj
e.g.
tlink /t coba.obj

- To run the result (.COM file), use command:
<com_filename>
e.g.
coba

5. That's all, folks :)
Share:

26 comments:

  1. very very thanksssssssssssssssssss

    ReplyDelete
  2. not working in Windows7

    ReplyDelete
  3. Yeah, apparently it does not work on Windows 7, too bad.

    ReplyDelete
    Replies
    1. But you can have a virtual XP on your Windows 7. Hence, you can access tasm and tlink on your virtual XP.

      Delete
  4. how can I make my name in an horizontal way? what is the proper code for it? Waiting for your response......

    ReplyDelete
  5. Ok, Honestly, I don't remember anymore, since I don't use it anymore. After seeing my old files, I find out a macro to print words.

    print macro strWords
    push ax
    push dx
    mov ah, 09h
    lea dx, strWords
    int 21h
    pop dx
    pop ax
    endm

    To call the macro to print the words:
    Process:
    str_Words db 'This is the sentence'
    print str_Words
    INT 20h

    PS: This code is not tested. You may want to test it out.

    ReplyDelete
  6. thanks alot.........

    ReplyDelete
  7. when i try to enter tlink calc it says. "Fatal: Unable to open file 'calc.obj'

    How do I resolve this?

    ReplyDelete
  8. Are you running it on Windows XP? Or? Try reading Yahoo Answers

    ReplyDelete
  9. Looks like I accidentally removed your comment ^^;
    Quoted: "Hello,

    Where can i download it (tasm and tlink)?"

    I think you can just google "download tasm and tlink" (without quote). It will directly shows on the first few entries ^^

    ReplyDelete
  10. how do i debug after the tlink command??

    ReplyDelete
  11. I have no idea how to debug this. Usually, we observe the error, and track back on the code. Please let me know if you get a way to debug it :)

    ReplyDelete
  12. Its got something to do with 'td'. But I don't remember the exact syntax. You can check the working of the registers using that command. But I can't recollect the exact thing.

    ReplyDelete
  13. what is tasm2msg? Is it something same as tasm.exe for compiling .asm files???

    ReplyDelete
  14. Hi, I'm not sure about this. From what I searched about tasm2msg, it is related to assembler output filter.

    ReplyDelete
  15. someone know the coordinates of plotting cx and dx on graphics?

    ReplyDelete
  16. What is the purpose of /t in linking process?

    ReplyDelete
  17. Hi Anonymous #1, I'm not sure anymore, haven't touched assembly for years.

    Anonymous #2, if you can use the tlink command, then you can actually find out the meaning of the parameter by typing "tlink /?" (without quote).

    Anonymous #3, that could be a way, but it's takes quite a bit of resource. Thanks for the sharing :)

    ReplyDelete
  18. thanks for a lot of answer that you give us.... more live for you

    ReplyDelete

About

Related Posts

Tableau Server Unable to Start due to Blocked Ports

Problem: Sometimes you might need to use different (from the default port) port on Tableau. By default, SSL is using port 443. For my case...

About Me

My photo
Is an ordinary unNoticed man, with a little knowledge to share and high dreams to achieve. I'd be glad if I can help others, 'coz the only thing for the triumph of evil is for a good man to do nothing. I like English and Chinese language, and know a little about them. Hence, for me, most things can best be expressed in Chinese, some in English, and the rest in others ^^

About Blog

You can find a lot of debugging and deploying problems while developing applications in .NET and Visual Basic here. There are also some querying tips in SQL and typical source codes which might be useful shared here.

Popular Posts

Blogroll

Followers

Follow by Email