Run MASM programs on ubuntu.

Hello, in this post i will be presenting a very simple step-by-step procedures through which you can execute MASM programs with ease.

Now, there may be a lot of reasons for you to be able to execute the MASM programs on a Linux machine. One them could be:

  • You are not using windows anymore.(And yes, you may try this guide on Windows7 or above and give me feedback. It should work the same way. I have run and tested in Ubuntu 14.04 successfully).

My reason was quite simple,  i used Ubuntu(and still do) and was in need to get a way around this. After all the acronym MASM stands for Microsoft Macro Assembler. Which means the original installation supports only windows. Not anymore, i have another way around. 🙂

  1. So to begin with download the masm folder from the below link. https://drive.google.com/folderview?id=0B1DiPkxLHBZHTWVQVVNlYVptU3M&usp=sharing
    (You may not be able to download immediately, add these files to your Google drive ,then prepare the download by right-clicking the folder.)
  2. Then install the legendary dosbox
  •  To install dosbox on ubuntu, fire up the terminal( ctrl+alt+t) and run the command
    sudo apt-get install dosbox

That’s it, you are done.!
Yes, Now you can run MASM programs.

So, let me show you a demo of how to run the programs using dosbox and the files downloaded from the drive.

  • step1:Write your MASM program in you favorite text editor say: notepad/geany etc and save it in the masm folder, the folder which contains all the downloaded files from Google drive.
  • step2: Mount the location where the downloaded folder is available.
    To mount, open the dosbox and use the command
    mount c: ~/Downloads/masm
    and hit enter.
    (This command assumes that you have downloaded all the files from the drive and stored in folder masm in location Downloads. If you have done it differently change the command appropriately)
    once done, you should see something like this on your screen.
    1
  • Step3: Once it is mounted,change the present working directory to c.
    To do this use the command
    c:
    This should look like this:
    Screenshot from 2016-05-01 17:43:45
  • Step4: Verify if you have done above steps correctly by using the DOS command
    dir
    the dir command will list out all the files inside the masm folder, so if you have your program listed in, then you have done the above steps prefectly!.

    Along with these files you must see your asm file in the list.
    Screenshot from 2016-05-01 17:46:54
  • step5: I have already included a program inside it namely count99.asm, which counts from 00 to 99 and displays the output, so i will be using this file as example and demonstrate, you may use the file which you have recently saved in that folder. So now lets assemble the code, run the command
    masm count99;
    the general syntax could be      masm filename;

    It should look like this.
    Screenshot from 2016-05-01 17:48:47.png
    I
  • step6: To link the file use the command
    link count99;

    the general syntax could be            link filename;
    Screenshot from 2016-05-01 17:50:33
  • Step7: If there were no errors in assembling and linking( is said no errors 🙂 ) Then lets run the executable. The command is
    debug count99.exe
    the general syntax could be           debug filename.exe
    Screenshot from 2016-05-01 17:53:38.png
  • Step8: enter g before the hyphen(‘-‘) and enter.
    And you are done, you must the output on the screen.
    Screenshot from 2016-05-01 17:55:05.png
  • Once the output is displayed, enter q to quit.
    Screenshot from 2016-05-01 17:58:05.png

Tip: As you are using dosbox and sometimes you may want to run the output in fullscreen mode, then you can try this:

  1. ctrl+f10
    to lock the mouse for the dosbox.
  2. ctrl+enter
    to enter into full screenmode.

 Now you can see your output running in fullscreen.

I hope this guide was useful, Thank you.

10 thoughts on “Run MASM programs on ubuntu.

  1. heyy… You have explained how to run it on dosbox.. i am pretty noob to this…But, we have installed dosbox on ubuntu..then how did you run the asm code in application dosbox?

    Like

Leave a comment