Printing To Screen: Difference between revisions

Jump to navigation Jump to search
m
Why doesn't rollback affect only the last edit? :-/
[unchecked revision][unchecked revision]
m (Reverted edits by Bellezzasolo (talk) to last revision by Solar)
m (Why doesn't rollback affect only the last edit? :-/)
Line 27:
If you have a pointer to video memory and want to write a string, here is how you might do it;
 
<source lang="c">
<pre>
// note this example will always write to the top
// line of the screen
Line 39:
}
}
</presource>
 
This simply cycles through each character in the string, and copies it to the appropriate place in video memory.
Line 108:
The good news are that <tt>stdarg.h</tt> is part of a freestanding implementation, so you can #include it even from your kernel source files. Under [[GCC]], the following simple implementation uses the gcc's built-in functionality to do all the work for you:
 
<source lang="c">
<pre>
#define va_start(v,l) __builtin_va_start(v,l)
#define va_arg(v,l) __builtin_va_arg(v,l)
Line 114:
#define va_copy(d,s) __builtin_va_copy(d,s)
typedef __builtin_va_list va_list;
</presource>
 
An implementation of <tt>stdarg.h</tt> and <tt>printf()</tt> is available from geezer/osd ([http://my.execpc.com/~geezer/osd/code/inc/stdarg.h stdarg.h], [http://my.execpc.com/~geezer/osd/code/inc/_printf.h _printf.h], [http://my.execpc.com/~geezer/osd/code/tinylib/stdio/doprintf.c doprintf.c]).
448

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu