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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
feare56
Member
Member
Posts: 97
Joined: Sun Dec 23, 2012 5:48 pm

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

Post 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
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

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

Post by Love4Boobies »

Have you checked the wiki? We have articles that explain this sort of stuff and the tutorials even offer some rudimentary examples.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
feare56
Member
Member
Posts: 97
Joined: Sun Dec 23, 2012 5:48 pm

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

Post by feare56 »

Oh I haven't seen that on the wiki thank you
andyharglesis
Posts: 11
Joined: Thu Jan 03, 2013 4:40 pm

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

Post 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).
feare56
Member
Member
Posts: 97
Joined: Sun Dec 23, 2012 5:48 pm

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

Post by feare56 »

Thank you that helped a lot
feare56
Member
Member
Posts: 97
Joined: Sun Dec 23, 2012 5:48 pm

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

Post 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
ACcurrent
Member
Member
Posts: 125
Joined: Thu Aug 11, 2011 12:04 am
Location: Watching You

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

Post by ACcurrent »

Read barebones
Get back to work!
Github
JamesParsons
Posts: 17
Joined: Sat Jan 12, 2013 7:37 am

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

Post 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
REAL programmers aren't afraid to use goto's
feare56
Member
Member
Posts: 97
Joined: Sun Dec 23, 2012 5:48 pm

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

Post by feare56 »

Thank you
Post Reply