Please note: This document is not an attempt to replace the documentation already written by Mike Saunders in 'How to write a simple OS'. I wrote this documentation to show the steps in building myfirst.asm file to a myfirst.iso file on Windows.
Please read all of the steps before downloading the tools to build your project.
We will be using the Command Console in Windows. On Vista or Windows 7 you can run this by typing cmd in the search box. There will be a small command console window that will pull up and will look something like this inside the window: c:\Users\User Name>. We want to get to the C prompt, so type cd\ and this will bring you to the root of the tree directory, which is c:\>.
Once you are at the C prompt type md asm. Typing the md will make a directory/folder called asm and that directory is where we will place the tools NASM and CDRTOOLS listed above to build our project files.
Now, use the links above and download NASM, CDRTOOLS, and VirtualBox. Make sure you install the NASM and CDRTOOLS in the c:\asm> directory we just made. You can choose a different directory or use the default directory when you install VirtualBox. I should point out for the NASM Assembler and CDRTOOLS that I downloaded, they were zip files. You will need to unzip the files to a folder and copy the content from that folder over to the c:\asm> directory/folder.
Note: when testing on Windows XP, I used WINZIP to unzip the files.
With all the tools installed and ready to work under the asm directory, we can start building the project.
Open up Notepad and type or copy and paste the assembly example (myfirst.asm) code located on this page into Notepad. Save the file as myfirst.asm in the c:\asm> directory.
Build the myfirst.asm file into myfirst.bin file at the c:\asm> directory by typing:
nasm -f bin -o myfirst.bin myfirst.asm
Note: To get in the asm directory in the Console Window, type cd asm and hit Enter.
Next, we build myfirst.bin to myfirst.flp (floppy image) file.
copy /b myfirst.bin myfirst.flp
Once we have our myfirst.flp file we want to make another directory in the asm directory.
md cdiso
Now, we want to copy the myfirst.flp from the asm directory to the cdiso directory.
copy myfirst.flp c:\asm\cdiso
Last step in the Command Console is to build the myfirst.iso file. The CDRTOOLS will have the file mkisofs.exe, which is like the Linux command used to build the .iso file. For the Windows version of the mkisofs you will need to type this next line in the Console Window like so:
mkisofs -no-emul-boot -boot-load-size 4 -o myfirst.iso -b myfirst.flp cdiso/
This will be the output you should get that shows the .iso file build was successful.
Size of boot image is 4 sectors -> No emulation Total translation table size: 2048 Total rockridge attributes bytes: 0 Total directory bytes: 158 Path table size(bytes): 10 Max brk space used 3000 48 extents written (0 Mb)
The myfirst.iso file will be located in the c:\asm directory. Now you can run VirtualBox to test this .iso file and see that it works before running off a real CD. There are lots of tutorials that can show you how to load .iso files on VirtualBox, so I won't cover those steps. I hope this documentation is helpful.