3

How can I run the code of Masm on Ubuntu? I cannot use Windows as a virtual machine and neither can I use Nasm.

Zanna
  • 69,223
  • 56
  • 216
  • 327
Bilal K
  • 31
  • 1
  • 1
  • 5
  • 1
    Alternatively you could also try an online compiler if this is just for educational purposes. Check out this [post](https://stackoverflow.com/questions/15627051/test-masm-programs-online). – Alex Jun 30 '20 at 13:55

2 Answers2

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.

karel
  • 110,292
  • 102
  • 269
  • 299
Saxtheowl
  • 1,609
  • 2
  • 9
  • 20
  • I tried the above one but while linking it is showing **Fatal Error L1903:obj not found** .. – Bilal K Oct 01 '19 at 19:19
  • And if i am trying to include `INCLUDE IRVINE32.inc` then it is showing me error **not found** @karael , @Saxtheowl – Bilal K Oct 01 '19 at 19:24
0

To use masm from your terminal, an easy way is with dosemu

sudo apt install dosemu

cd to where your MASM.EXE is located and execute

dosemu MASM.EXE <code.asm>

I've tried it with MASM 5.1, works perfectly.

Hope I have helped :)

Giorgos Saridakis
  • 736
  • 1
  • 5
  • 13