1- NASM
Download 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- AFD
Now download AFD and copy it to the installation folder i.e. where your nasm is installedOpen the CMD in the same way ( if you have closed the one we opened earlier ) and enter
> afd
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- DOSBOX
First 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"
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.
I got error illegal directoriy afd. Whts the problem?
ReplyDeleteAfd in win32
DeleteI am unable to download AFD file
ReplyDeletehow can we get output on black output screen?
ReplyDeleteYou can run AFD.EXE under 64-bit Windows by using Takeda's MS-DOS Player for Win32-x64, see http://takeda-toshiya.my.coocan.jp (run: msdos.exe -cAFD32.EXE AFD.EXE).
ReplyDeleteI found AFD.EXE on http://temp.retailsys.bg/, Version 1.00, 1987, works fine.
ILLEGAL COMMAND
ReplyDeletede raha hai nasm se agay dosbox
afd bhi ILLEGAL COMMAND hi hai
mount pe already mount hi de raha hai
After echo
ReplyDeleteboth nasm afd are resulting in ILLEGAL COMMAND.