Page 1 of 1

*very noob question* What is a very simple printf command?

Posted: Fri Jan 04, 2013 11:28 pm
by feare56
Ok I am pretty much a noob at OS dev but am a good c/++ programmer. I am also a visual kinda guy so I can learn from the most basic of code. I plan to make a hybrid monolithic-micro kernel so all the drivers and the filesystem. I am just asking for a basic one where it simply displays a character so I can test kernel and boot loader

Re: *very noob question* What is a very simple printf comman

Posted: Sat Jan 05, 2013 12:31 am
by Love4Boobies
Have you checked the wiki? We have articles that explain this sort of stuff and the tutorials even offer some rudimentary examples.

Re: *very noob question* What is a very simple printf comman

Posted: Sat Jan 05, 2013 9:48 am
by feare56
Oh I haven't seen that on the wiki thank you

Re: *very noob question* What is a very simple printf comman

Posted: Sat Jan 05, 2013 3:38 pm
by andyharglesis
If you want to print to the screen in the bootloader use BIOS int 0x10h(assuming this is x86-architecture).

Printf in C is absolutely nothing like writing to video memory, or more directly interfacing with hardware.

Printf is a written command to parse syntax into string data for a text terminal, or I/O stream console, which doesn't even exist on a bare-system unless you make one.

There's plenty of tutorials on printing to the screen using "Hello World" in x86 Real Mode 16-bit bootloaders, and they're not really that hard.

Using an x86 virtual machine you can test it pretty instantly as well, if in fear of using real hardware directly to execute it(and for other reasons).

Re: *very noob question* What is a very simple printf comman

Posted: Sat Jan 05, 2013 4:26 pm
by feare56
Thank you that helped a lot

Re: *very noob question* What is a very simple printf comman

Posted: Sun Jan 06, 2013 9:13 pm
by feare56
Windows and Mac and numerous others have that hybrid. And I think a monolithic is too much and a micro kernel is not enough

Re: *very noob question* What is a very simple printf comman

Posted: Sun Jan 06, 2013 9:27 pm
by ACcurrent
Read barebones

Re: *very noob question* What is a very simple printf comman

Posted: Sun Jan 13, 2013 8:37 am
by JamesParsons
Heres something

Code: Select all


// note this example will always write to the top
// line of the screen
void write_string( int colour, const char *string )
{
    volatile char *video = (volatile char*)0xB8000;
    while( *string != 0 )
    {
        *video++ = *string++;
        *video++ = colour;
    }
}
this was on the wiki Printing To Screen

Re: *very noob question* What is a very simple printf comman

Posted: Sun Jan 13, 2013 9:11 am
by feare56
Thank you