: I don't think it would be possible to make a "Hello world OS" on a
: PC without using any assembler. Mainly because of the lack of a
: compiler that would produce pure op-code binaries, without any calls
: to Windows-specific kernel dlls and stuff like that. Perhaps there
: are C/C++ compilers made purely for the pentium processors without
: the need for an OS, I don't know.
Well I bought a book of C that describe the functionalities of the GCC
compiler and one is that it can produce freestanding programs. It says that
you can compile the code without linking to the "C Runtime" (an object that
has special initialization code for the operating system that you are
compiling for)
The compiler options are -ffreestanding, -nostartfiles and -nostdlib. With
this compiler options the programmer is in charge of implementing the
standard functions that he is going to use, like any printf or scanf.
But I have read many articles of this kind of programming that always
utilize Assembly. But if the code is not linked with any operating system
(pure independet code) then there should be a way of programming without
the use of assembly in any way.
Also GCC compiles code for different kind of processors.
This is an example of what it would be great:
typedef unsigned char* register;
enum registers{ax=placeofax,bx=placeofbx,cx=placeofcx}
register AX = (register) ax;
register BX = (register) bx;
register CX = (register) cx;
*AX = 10;
If that example could be true, it will be fabulous. Instead of using:
mov ax,10
mov ch 12Fh
jmp blah
or the c++ asm reserved keyword: asm("mov ax,10");
Is difficult to program in assembly. And I also don't understand how to use the asm keyword to interact with c++ code. Like for example create a
function in asm from within c++ using the asm keyword and then call it.
Is really complicated :(