How to use MASM for assembly language on Ubuntu?

Solution 1:

You can try using DOSBox with this guide. These instructions will run in all versions of Ubuntu.

  1. Download the all files in the masm folder from here.
  2. Install dosbox with the following command:

    sudo apt install dosbox
    

Usage

  1. Write an masm program (e.g. myProgram) in any text editor and save it.
  2. Mount the location where the downloaded folder is available (e.g. ~/Downloads). To mount, launch dosbox and run this command in dosbox:

    mount c: ~/Downloads/masm  
    
  3. Change the current working directory to c.

    c:
    
  4. Assemble the code.

    masm myProgram;
    
  5. Link the file.

    link myProgram;
    
  6. Run the executable.

    debug myProgram.exe  
    
  7. Type -g and press Enter.

  8. Once the output is displayed, enter q to quit.