Home > Academics, How To > Run MASM 8086 Assembler in Ubuntu or Windows 7(x64) using DOSBox

Run MASM 8086 Assembler in Ubuntu or Windows 7(x64) using DOSBox

Here’s how to run 16 bit DOS executables like the MASM assembler or Turbo C compiler in Ubuntu (GNU/Linux) or in 64 bit editions of Windows 7 using DOSBox, a DOS environment emulator. DOSBox is available for Linux as well as Windows.

DOSBox installation

For Ubuntu users (using repository)
Open the terminal and type in the following commands to download and install DOSbox in Ubuntu
sudo apt-get update
sudo apt-get install dosbox

You will find it installed under Applications_Menu->Games->DOSBox Emulator

For other GNU/Linux users
Download DOSbox from here.
Open terminal and cd to the directory containing the downloaded tar.gz file. Type in the following commands to build and install :
tar -xzvf dosbox-0.74.tar.gz
cd dosbox-0.74
./configure
make

Check the src subdir for the binary.

For Windows users
Download DOSbox from here.
Run the downloaded .exe file and install it like any other software.

Now that you’ve installed DOSBox, you’ll be able to run any 16bit or 32bit DOS executable inside it.

Download the 8086 MASM Assembler from here. The zip file contains the following files :
masm.exe, tasm.exe, link.exe, bin2hex.exe, exe2bin.exe, td.exe, edit.com and debug.exe

Windows users extract the .zip file into C:\ so that the path C:\8086 contains all the above mentioned files. GNU/Linux users can extract it and place it in say /home/prashanth/8086

Launch DOSBox and type the following commands :
For Linux users :
mount c /home/prashanth/8086
c:

For Windows :
mount c c:\8086
c:

DOSBox in Ubuntu

DOSBox running in Ubuntu

Now the contents of the folder /home/prashanth/8086 or c:\8086 is mounted as c: drive inside the DOS emulator. You can assemble programs inside DOSBox as you do in your Microprocessor Lab under Windows XP; i.e your usual sequence of commands -
edit file.asm
masm file.asm
link file
debug file.exe

When you are done, type exit to quit DOSBox.

P.S : For GNU/Linux users, there’s an alternative assembler known as the NASM. NASM is considered to be one of the most popular assemblers for GNU/Linux.

Downloads :
DOSBox for Linux : dosbox-0.74.tar.gz
DOSBox for Windows : DOSBox0.74-win32-installer.exe
8086 Assembler : 8086_Assembler.zip

Be Sociable, Share!
  1. March 6th, 2011 at 00:25 | #1

    Awesome! Link added to the article on my blog!

  2. Nisith
    March 9th, 2011 at 23:38 | #2

    Thnx alot! much appreciated. .

  3. rajeev
    March 16th, 2011 at 17:56 | #3

    its run ok………but while debbuging using f8……..its not showing line………..and color also not same.

  4. Avin D’Silva
    March 26th, 2011 at 19:00 | #4

    Hi… gud info buddy…
    i guess u won’t be able to run a program on c or c++ using dos box .74 on a 32 bit or lower machine…there ll be a object code errror in the same…

  5. VIKAS KUMAR
    March 27th, 2011 at 13:57 | #5

    can some one help me by telling the procedure to view the code after
    edit xyz.asm ; and writing the code
    save it
    masm xyz;
    link xyz;
    xyz
    then i m not able to find the code view window

  6. Mahesh
    April 3rd, 2011 at 01:12 | #6

    thanx a lot. Very helpful it was.

  7. Anil
    April 3rd, 2011 at 23:48 | #7

    Hello,

    The window gets stuck after i use the “g” (Go command under DEBUG). I cannot type anything nor do i get an output. Please help me out!
    P.S. Brilliant stuff :)

  8. April 4th, 2011 at 21:40 | #8

    @Anil
    Umm..no, it doesn’t, at least on my side. I get a “Program terminated normally” response.

  9. April 24th, 2011 at 23:24 | #9

    Thanks!! Saved me from the trouble of installing xp on virtual box.

  10. Kapil S. Gorve
    April 26th, 2011 at 15:14 | #10

    thank u very much man!!!!!!!i got it run on my w7!!!!!thank u very much!!!!!

  11. Anup
    May 2nd, 2011 at 14:22 | #11

    Thanks a ton!….

  12. Irom Heithoi
    May 5th, 2011 at 11:15 | #12

    Thnx….
    Works absolutely Fine…
    Added the link…

  13. albert
    May 11th, 2011 at 08:16 | #13

    dude help me out ….wats the equivalent command for cv/p after
    edit filename.asm;
    masm/zi filename.asm;
    link/co filename.obj;
    “”"”cv/p filename “”"”"”"not working….saying cv isillegal command….
    someone plzz help me out…

  14. albert
    May 11th, 2011 at 08:43 | #14

    how to check the output ….like suppose if we have written a code….for printing a msg ….how to see that ???

  15. Srikanth
    May 11th, 2011 at 15:27 | #15

    How to go to the output window?

  16. Angela
    June 6th, 2011 at 22:54 | #16

    Thank you!! I will add this link to an article on my blog!!

  17. manoj
    July 23rd, 2011 at 11:30 | #17

    Thanks a lot…….it works very well…….

  18. Sachin Murali G
    July 24th, 2011 at 08:57 | #18

    Thnx a lot dud….. :-)

  19. mark
    July 26th, 2011 at 15:26 | #19

    Just how do we see the output of our asm? It only debugs errors. How? Thanks.

  20. zach
    July 30th, 2011 at 09:18 | #20

    dosbox window does not display anything here in my computer , please help

  21. harish
    August 8th, 2011 at 17:22 | #21

    respected sir,
    how to edit assembling programing and how to compile it

  22. hBAJDAhsdlkalkjd
    August 15th, 2011 at 12:46 | #22

    this software dosnt support 64bit w7.. pls help…

  23. September 2nd, 2011 at 10:40 | #23

    good

  24. September 2nd, 2011 at 10:42 | #24

    very good

  25. September 23rd, 2011 at 19:20 | #25

    How to see the output window?

  26. biju
    September 28th, 2011 at 23:02 | #26

    guys how i have run the prog of 8086
    wen i tried to run it shows nthng
    still no errors
    plzzz help..

  27. joey
    October 7th, 2011 at 20:40 | #27

    Thanks a lot! very helpful.

  28. October 22nd, 2011 at 18:35 | #28

    thanks for ur help…

  29. October 22nd, 2011 at 18:43 | #29

    it’s show error .exe file not found plz tell me any solution

  30. kalyani
    October 23rd, 2011 at 18:09 | #30

    i am not getting output when i type
    debug file.exe
    its not working

  31. adwait
    October 27th, 2011 at 14:17 | #31

    thanks a lot….

  32. Justin Jose
    October 27th, 2011 at 21:07 | #32

    error a2105:expected : instruction or directive..

    i think .code and .exit are shown as errors..

    wat am i supposed to do??
    pls help

  33. ADD
    October 29th, 2011 at 06:57 | #33

    why cant i use cv filename.exe ……………… it says that cv can’t be used ………..

  34. help
    November 14th, 2011 at 00:17 | #34

    my hello.exe file isnt running on win 7… when ever i write hello.exe.. my Dos Box closes. n if i try to open up my hello.exe manually it gives an error

    “Write falut writing error PRN”"

    some thin like dat.. kindly help me

  35. viperchaos
    November 15th, 2011 at 13:37 | #35

    thanks you very much!!! It really helps me!

  36. gopi
    November 18th, 2011 at 05:40 | #36

    thanks

  37. rahul
    January 11th, 2012 at 19:48 | #37

    i want the command which should b writen on the dos box window soo it starts 2 mount d c drive

  38. pramod
    January 17th, 2012 at 19:33 | #38

    well this is good but the only problem is that debug doesnt work
    reply to this qstn….

  39. pramod
    January 17th, 2012 at 20:40 | #39

    what to do if there is extended error 2…
    after debug command

  40. January 27th, 2012 at 11:31 | #40

    im gettin an error sayin io.h file not found
    can u please help to resolve this issue

  41. Mithil Bhoras
    January 31st, 2012 at 15:24 | #41

    How do run tasm in this? please help….

  42. santosh
    February 10th, 2012 at 11:41 | #42

    thanx for the stuff buddy……..
    kindly help me for my error,
    i tried to include a .mac file in the program with the path
    include c:\8086\read.mac in the program
    but still it is giving error the file not found (the file is there in the folder)

  43. saurabh
    February 11th, 2012 at 02:19 | #43

    howto run the program in massm give me
    commands

  44. manoj.h.p
    February 11th, 2012 at 19:30 | #44

    hay.. everyone….
    when i had tried for code viwer for detaild view and allocation of data in registers.. it said the code i used is illegal.. the code was “cv file name.exe”…. how to get code viewer.. plz help me out..
    thnx… with regards .

  45. srishti
    February 13th, 2012 at 18:54 | #45

    thanks a lot!!

  46. rakesh
    February 14th, 2012 at 20:30 | #46

    thanks prashanth :)

  47. Manu
    February 16th, 2012 at 14:12 | #47

    please tell how to debug and run the program
    ‘g’ command is not working

  48. February 18th, 2012 at 13:40 | #48

    please help me…how to debug

  49. Fahad
    February 19th, 2012 at 22:34 | #49

    What is the equivalent command for cv ? please reply asap.

  50. Fahad
    February 19th, 2012 at 22:36 | #50

    What is the commmand to execute the program?

  51. Shanky
    February 21st, 2012 at 23:30 | #51

    Thanks! Was very helpful.

  52. vinay
    February 21st, 2012 at 23:32 | #52

    thank u so much :) it helped me a lot………….also to the users who r not able to see the output…here is the suggestion…….
    type
    masm filename.asm;
    link filename.obj;
    debug filename.exe

    after this press ” t ” n enter……ur memory window opens n repeat the process for further steps

  53. vinay
    February 21st, 2012 at 23:35 | #53

    press “t” n press enter after the debug

  54. vinay
    February 21st, 2012 at 23:37 | #54

    am nt able to terminate the program….after the total execution of the program am nt able to exit it….help me out some1 :(

  55. koushik
    February 23rd, 2012 at 00:08 | #55

    Thanks man…..

  56. rizwan basha
    February 23rd, 2012 at 04:50 | #56

    thank u very much ……………

  57. dilip
    February 23rd, 2012 at 06:40 | #57

    thanks bro for helping me in working on masm in windows 7

  58. Rohit Sudhakar
    February 23rd, 2012 at 19:55 | #58

    Guys who are facing the problems with CV command here is the solution
    -Download cv.exe from online and paste it in the 8086 folder

    u vil get the same o/p as u see in the lab though the graphics is a bit different
    but much better than using the debug command

    Hope it helps you out

  59. mayank sharma
    February 28th, 2012 at 17:30 | #59

    thank u vry much 4 supporting…….

  60. sharad kotharkar
    March 2nd, 2012 at 20:33 | #60

    good work….thanks for sharing this info dude….

  61. sridevi
    March 4th, 2012 at 14:31 | #61

    while running a progarm im getting an error 2000: stack overflow why im getting this error?and how can rectify this?

  62. pooja
    March 4th, 2012 at 19:31 | #62

    hey guys, memory window doesn’t open at all.

    also on 32-bit windows there’s a command “cv file_name” after “link file_name”. doesn’t work here??

    help me out please (i tried pressing “t” after debug command and enter,but then no separate memory window opens)

  63. Puja
    March 6th, 2012 at 23:07 | #63

    Is there any way to use masm on windows 7 64 bit… please mention

  64. Puja
    March 6th, 2012 at 23:09 | #64

    Is there any way to use masm assembler on windows 7 64 bits…

  65. vineet
    March 13th, 2012 at 20:29 | #65

    HEY ROHIT,

    after copying cv.exe into 8086 file when i give cv command it is showing cannot run in dos mode..
    what shud i do??

  66. Vishal
    March 18th, 2012 at 12:31 | #66

    hello sir how u prepared emulated turbo c++ can we bulid emulated masm to run it on windows 7 64bit os?

  67. rag
    March 27th, 2012 at 00:20 | #67

    hey pls anyone help……
    after typing edit file.asm ,it is showing illegal command edit
    what to do .pls tell

  68. sunil s
    April 7th, 2012 at 03:22 | #68

    thanx man….
    really gud share…..

  69. walead
    April 8th, 2012 at 21:59 | #69

    cannot debug :error 2 heeelp :( (((

  70. Krithika
    April 16th, 2012 at 22:53 | #70

    I am not able to change directory or open any file. Windows 64 bit. Please help.

  71. Rafsan Tanveer
    April 27th, 2012 at 14:28 | #71

    thanks bro….
    but command -t is not working…..

  72. Shresha Prabhu
    April 27th, 2012 at 21:26 | #72

    Pai mamu, masth thanx.. thanx a lot!!

  73. chintan
    May 1st, 2012 at 23:48 | #73

    try this command TD file.exe it may help…

  74. arun
    May 5th, 2012 at 14:24 | #74

    @Krithika
    type
    z:\>mount c c:\8086
    c:\>edit file.asm

  75. arun
    May 5th, 2012 at 14:26 | #75

    @arun
    mount c c:\8086
    c:
    edit file.asm

  76. Raju
    May 8th, 2012 at 23:32 | #76

    I am Bangladeshi

  77. krishanu
    May 19th, 2012 at 11:38 | #77

    close ur computer

  78. May 20th, 2012 at 14:13 | #78

    i’m nt to change directory. it is saying directory does not exits.
    pls tel how to change my computer name.
    mine is a 32 bit Ubuntu UE 3.0

  79. May 20th, 2012 at 14:14 | #79

    I’m not able to change directory in Dosbox. what to do. plsss help

  80. vicky
    May 24th, 2012 at 19:48 | #80

    thank u very much…earlier i use to run win95 in dosbox to access debug option but this solution has made it more simple..thanks a lot

  81. vinay
    May 25th, 2012 at 21:40 | #81

    please help . it says program not found
    how to run ?

  82. vinay
    May 29th, 2012 at 10:13 | #82

    am gettin a EXTENDED error aft i debug even though i fin get it durin the masm file.asm; part of compiling……… anybody HELP !!!!!!!!!!!!!!!!! i hv got exams tom ……..plzzzzzzzzzzzzzzzzz

  83. jj
    May 29th, 2012 at 19:40 | #83

    I use windows 7(x64),I dont get o/p. All I get is this
    edit pa.asm
    masm pa.asm
    link pa.asm
    debug pa.asm
    _
    _
    _ can someone plzzzzzzz help? ASAP!!

  84. Souvikdas
    July 20th, 2012 at 23:27 | #84

    thanks a lot…

  85. Prateek
    August 7th, 2012 at 19:47 | #85

    Thanks a lot! faculty in my college said debugging on windows 7 x64 was not possible and you proved it wrong…Appreciate your post

  86. Prateek
    August 7th, 2012 at 19:49 | #86

    you need to enter ‘t’ for getting output at every step or enter ‘g’ to directly get the final output…:)@jj

  87. rakesh
    September 9th, 2012 at 21:36 | #87

    am unable to mount it on c…. i tried with the given command bt its of no use, can any one help me with this

  88. pradeep
    January 24th, 2013 at 01:09 | #88

    when i try to edit is saying that illegal command :edit
    any solution?

  89. priya
    February 15th, 2013 at 20:46 | #89

    can anyone tell me how to find out the path…like /home/name/8086 dosent work…shows up directory dosent exist:((

  90. Abhinav
    March 3rd, 2013 at 21:17 | #90

    @ people getting illegal command : Did you forget to download/extract 8086 assembler files into your directory?
    @priya The easiest way to find a path is to drag the file/directory and place it on the terminal

  91. Ananya shekar
    March 7th, 2013 at 08:41 | #91

    If i type debug file.exe , its showing in correct dos version.. im using MASM64. please help me out to debug

  92. Raushan
    March 20th, 2013 at 21:13 | #92

    thank u so much,its working but not in full screen mode on my laptop

  93. sindhu
    May 1st, 2013 at 03:12 | #93

    when i type masm file.asm, it shows
    object filename[filename.obj]:
    what am i supposed to type here???

  94. sindhu
    May 1st, 2013 at 03:16 | #94

    with ref to #93
    i had downloaded the masm 64 bit version for windows 7 from the following link:
    http://masm64bit.blogspot.in/
    pl help me……

  95. Rakshith K
    September 19th, 2013 at 16:07 | #95

    I hav downloaded the masm 64 bit version for windows 7……
    but it is not installing in my computer..,it is showing some error like “wndows cant find the ‘c:\masm\masm.exe’ make sure you typed the name correctly.”…..

    help me for this question……………

  96. john
    October 19th, 2013 at 22:48 | #96

    hello i am getting cv is an illegal command plzz help me out

  97. john
    October 19th, 2013 at 22:51 | #97

    @albert
    yeah even i hav da same doubt.plz help me…

  98. Agnel
    October 29th, 2013 at 13:03 | #98

    i hav entered a 8086 program for displaying a string “Hello” after executing there is no effect… still there is no error… how can i run that program… plz help me.. !!!

  99. vicky
    November 5th, 2013 at 09:20 | #99

    @agnel…pls post ur code here

  1. No trackbacks yet.