How to Setup FASM in MS-DOS or DOSBox

FASM (flat assembler) – “is a fast assembly language compiler for the x86 architecture processors, which does multiple passes to optimize the size of generated machine code. It is self-compilable and versions for different operating systems are provided. All the versions are designed to be used from the system command line and they should not differ in behavior.” (flat assembler 1.71 Programmer’s Manual. 1.1 Compiler Overview)


MS-DOS 6.22 (or later) or latest version DOSBox is already installed, configured and running.

1. Download the latest version of flat assembler for DOS. What you’ll get is a .zip file that contains all the files needed to use fasm. If you uncompressed the file, you will see something like below:


FASM requires a DOS Protected Mode Interface (DPMI) to run from DOS real mode environment, so make sure you download one as well. You can get the latest binary version for DOS from this site:

2. Depending on whether you are using MS-DOS 6.22 in Virtual Machine (e.g., VirtualBox) or DOSBox, getting these files into either of them requires different process.

For MS-DOS running in VirtualBox, you need to convert these files first into a disk image with software like WinImage. Of course you may use any disk image creation software as long as you can have a 1.44 MB floppy image of the files so you can feed it in MS-DOS VirtualBox as floppy. Below is the step-by-step tutorial on how to do it with WinImage:

A. Open WinImage
B. Click the “New” button. When the format dialog box appears, select the 1.44 MB Standard Format.
C. Drag all the files you want to save into the 1.44 MB Floppy Image, make sure they fit. Then click the “Save” button to save the image in the directory of your choice.
D. Run your MS-DOS virtual machine from VirtualBox, then mount the FASM image file you created above. The contents will be accessible via Drive A.
imageOnce it’s mounted. you can install FASM from there by simply copying the binaries into the hard disk of your MS-DOS virtual machine. You may use the following steps to install fasm:1. Create FASM directory in your hard disk:
md C:\FASM

2. Go to drive A and unzip FASM into “C:\FASM”. You may download pkunzip program from the following site if you don’t have one:
pkunzip –e –d c:\fasm.

You should see the following in you C:\FASM directory

Try running fasm, you should get the following error:

That’s because DPMI is not yet set. So the next step is to install DPMI.

E. DPMI Installation

1. Create a directory to install DPMI into. I put mine in C:\UTILS\DPMI

2. Extract DPMI into that directory

3. Execute DPMI using the following command

-p means terminate and stay resident. That is upon execution, dpmi immediately terminates but remains alive in the memory.
-s- means don’t use swap file.

4. After you executed DPMI, fasm should now run without any error:


F. Automate execution of DPMI and include fasm’s directory in the path. Edit autoexec.bat and add the following highlighted texts:
imageReboot your computer. You should now be able to use FASM without error.NOTE: Another way to execute DPMI automatically is through CONFIG.SYS. Just add the following line:


or if upper memory block (UMB) is available via EMM386.EXE, you may want to try INSTALLHIGH instead of INSTALL only.

3. How to Install FASM in DOSBox?

Since DOSBox uses your host operating system’s file system, all you have to do is extract the FASM files and DPMI files into the mounted directory used by DOSBox. Then edit the DOSBox configuration file (dosbox-0.74.conf) and add the following lines at the bottom:


Of course, make sure that you use the right path. This will automatically execute CWSDPMI.EXE upon startup. As an added convenience, make sure you add the path of FASM directory so you can run it anywhere in DOS. If everything is correct, you should see something like below:


Comments on this post

  1. I have learn some good stuff here. Certainly worth bookmarking for
    revisiting. I wonder how so much effort you place to make such a great informative site.

  2. Great article.

  3. I quite like reading a post that can make people think.

    Also, thank you for permitting me to comment!

  4. Thanks very nice blog!

  5. Your method of telling all in this post is really fastidious, all can effortlessly know
    it, Thanks a lot.

  6. I simply must tell you that you have an excellent and unique post that I really enjoyed reading.

  7. Magnificent items from you, man. I’ve be mindful your
    stuff previous to and you are simply extremely magnificent.
    I actually like what you have acquired here, certainly like what you are stating and
    the way in which through which you are saying it.
    You’re making it enjoyable and you still take care of to keep it
    wise. I cant wait to read much more from you.
    That is really a great web site.

  8. Good post! We are linking to this particularly great article on our website.
    Keep up the good writing.

  9. Keep this going please, great job!

  10. Good blog you have got here.. It’s difficult to find good quality writing like yours nowadays.
    I truly appreciate individuals like you!
    Take care!!

  11. Hello my friend! I want to say that this article is awesome, nice written and include approximately all significant infos. I’d like to peer more posts like this.

Leave a Reply

Your email address will not be published. Required fields are marked *

Trackbacks and Pinbacks on this post

No trackbacks.

TrackBack URL