1- NASMDownload NASM ( Click on this link ) and install it.
Now open the cmd and change your directory to the installation folder using these instructions
> C: > cd C:/tutorial/NASM
First instruction is for changing the drive to C if you are in any other drive.Second instruction is to change current directory to our installation directory. In my case I have installed nasm in "tutorial" folder of C drive.
Now you will have to put all your ASM files in this folder to assemble/compile them .
Alternatively, you can just go to the installation directory through WINDOWS EXPLORER and click/run "nasmpath.bat" file . This will setup path ( skipping everything we discussed above ) and open a new console/cmd/command prompt for you.
Now you can run nasm from anywhere in the cmd. but you will have to be in the directory where your code files are placed.
2- AFDNow download AFD and copy it to the installation folder i.e. where your nasm is installed
Open the CMD in the same way ( if you have closed the one we opened earlier ) and enter
If you don't get an error like the one in the image below then you are good to go. You can stop right here.
But if you get an error ( this is because you have a 64bit OS and afd runs on 32 bit one ) you will have to setup DOSBOX EMULATOR.
So let's continue with installing and configuring DOS box .
3- DOSBOXFirst of all create a Separate folder where you will put all the related files ( nasm, afd , code files ).
I have created a folder in C drive and named it "assembly" so my path will become "C:/assembly"
Finally, download DOSBOX and install it .
Move AFD.exe that we downloaded earlier to the new folder that we created i.e. C:/assembly.Other then that also move nasm.exe and another file cwsdpmi.exe ( from extracted folder ) to our work folder.
NASM that we downloaded earlier will not work in dosbox. you will have to download it from here ( NASM for DOS ) Download the zip file and extract it somewhere.
After complete installation , Go to Dosbox installation directory and run "DOSBox 0.74 Options.bat". This will save you from the pain of searching the configuration file yourself and will open that file for you.
Copy these lines at the end of that file.
> MOUNT C > C:/assembly > C:Replace "C:/assembly" with the path of the folder that you created.
Now you can run dosbox and use nasm and afd.
Remember, whenever you add a new file to your work folder ( C:/assembly in my case ) you will have to press CTRL + F4 key so that dosbox update it's directory entries.
You can also enter "intro" command in dosbox for some useful information.
Now to test the environment run dosbox. Enter the following command
> echo mov ax,5 > test.asmThis will create a new file named test.asm and write "mov ax,5" to this file.
Finally, Enter these commands to check if everything is working fine.
> nasm test.asm -o test.com > afd test.comand the following screen should appear
This sums up basic steps of setting up environment for writing and debugging 8086 assembly code.
If you find any thing that I missed and must be added in this article then feel free to comment.