You are about to perform a hard task.BUT it can be done.
Making operating system is hard until the boot part. After that you may create a platform to write your programs with.
As once I wanted to make an OS like you, I did some practice.
Do some research in WikiPedia.
First, you need to debug your program but how? You can not restart your computer to test it. It takes a long time. Also there is a risk for your computer and maybe the hardware. Because you are in real-mode of CPU (real-mode and protected-mode are modes of running code on CPU - for example, Windows runs program in protected mode and DOS in real mode) the hardware is in danger. Because in real mode there is no control on your program - there is no operating system on your operating system-. So you may CRASH your hardware.
So you need a Virtual Machine application, like Microsoft Virtual PC.
MS VPC is a free software. You can download it at:
"http://www.microsoft.com/downloads/details.aspx?FamilyID=28c97d22-6eb8-4a09-a7f7-f6c7a1f000b5&displaylang=en"
Then you can create a virtual PC
Second. Your operating system must be on a specific storage. Floppy disk, Hard disk or CD/DVD. Anyway as you don't use YOUR computer to test the OS and you use a virtual machine, it is so easier. You assign a storage image. Also you can use a real disk (only for floppy disk and CD). But I think that you can you a floppy disk image that is EXCATLY 1.44 MB (1,474,560 byte) or 720 KB (half of it).
You can easily write a C++ program to make an image file. It is faster than writing on a floppy disk.
Anyway, using floppy disk IMAGE is easier. Just use the VirtualMachine to make an image.
Note that usually HardDisk images should have header. (At the ending or the starting point of the file.)
Third. You need to do some research about this part but I tell some important matters of it. You need an assembler (like turbo assembler) that can write codes for old systems (I mean it is for DOS programming). Then you can use a linker (like turbo linker) to
make COM files. You should know them. They are files like EXEs except that they are pure and each byte of them can be an instruction for CPU. I found a pack for turbo assembler with some examples at
"http://pratik.tambe.googlepages.com/TASM.zip"
The TASM.exe file is the assembler and the TLINK.exe file is the linker. Also you can use TD.EXE for debugging.
NOTE: These files are 16-Bit and cannot be run on 64-Bit versions of Windows. You may install a 32 Bit version or use a DOS floppy disk or create a secondary VirtualMachine with your VirtualMachine program and install a 32Bit OS or DOS on the VM. (one VM for your OS and one VM for the assembler. You can create the image disk on one VM and then copy the image to the other VM - see instructions with your VirtualMachine program)
After linking you should insert the file in your disk image file. With a simple C++ program you can address it. Read the COM file(s), put them in an image file and fill the remaining space with empty characters. You will have a file with 1,474,560 bytes.
Third. Assembly. You should know the needed things for writing assembly programs. Using interrupts (see wikipedia) and else.
You should know how to access the disk without using drivers.
Fourth. Boot. Each disk has some sectors and the first sector is called a Boot sector. It doesn't matter so much that what is the size of the sector. Usually, hard disks have 8192 byte sectors and floppy disks have 512 byte sectors. In any situation the FIRST BYTES of the sector should be CPU instructions. In NTFS or FAT file system, the first bytes include a JUMP instruction. Some bytes after it are information about the disk that are not executable. The jump instruction jumps the CPU instruction pointer (IP) after this information and it continues to boot.
The 511th byte should be 0x55 (85 in decimal) and the 512th byte should be 0xAA (170). These two markers indicated that the disk is bootable and BIOS loads it. So the first program with all the information should be less than 511 bytes. There should be a COM file in the first part of the disk that the first bytes are instructions.
Now your simple C++ program changes as follows:
Copy the BOOT.COM file
Insert enough NULL characters to be 510 byte.
Put 0x55 , 0xAA
Put other parts of disk
Put enough NULL characters to be 1,474,560 bytes. (Or any other size)
Put the header if the disk is not a floppy disk (It is for your VirtualMachine, it should not be really on a real hard disk - Some VM Programs need the header at the starting point.)
FIFTH. Hardware. The most important aspect of an OS is contacting with hardware. OS uses in and out assembly instructions to communicate with hardware. The drivers an HAL.DLL in windows are intended for this. Also a good OS should switch to protected mode (PM) to run multiple programs (multi tasking). Also PM applies many security things to the client apps.
See wikipedia for