Given that C is a system programming language, how can I compile C code into x86 source machine code that could be invoked without an operating system? (IE: It can be assumed that I have a boot sector that loads the source machine code from disk to memory, and then jumps directly to the first instruction).
And now, for the bonus points: Ideally, I would like to compile using the Visual Studio 2010 compiler, because I already have it. Otherwise, what's the best way to accomplish a task without having to set up a bunch of dependencies or make big configuration change variables throughout my system? I will compile on Windows 7.
Usually you do not. Instead, you usually compile your code and then (either using the linker or some other tool) extract the raw binary from the object file.
For example, on Linux, you can use the tool objcopyto copy an object file to a raw binary file.
objcopy
$ objcopy -O binary object.elf object.binary
, (printf, fopen, read ..). C. - , c ( gui ), , , . , ( , , C C) script , . (intel hex, srec, exe, com, coff, elf, raw binary ..), , .