WKern
Loading...
Searching...
No Matches
printer.c File Reference
#include <global.h>
#include <io/kio.h>
#include <types/nums.h>
#include <types/vargs.h>

Go to the source code of this file.

Functions

void Kcfp ()
 Clears the screen by filling the video memory with spaces.
void Kputchar (char c)
 Outputs a single character to the screen at the current cursor position.
void KputcharBackspace ()
 Handles backspace keypress by moving the cursor back and clearing the character.
void KprintHex (u32 num)
 Prints a 32-bit unsigned integer in hexadecimal format prefixed with "0x".
void KprintDec (int num)
 Prints a signed integer in decimal format.
void KprintStr (const char *str)
 Prints a null-terminated string to the screen.
void Kprintf (const char *fmt,...)
 Formatted output to the screen.

Function Documentation

◆ Kcfp()

void Kcfp ( )

Clears the screen by filling the video memory with spaces.

Resets cursor position to the top-left corner (0,0).

Definition at line 28 of file printer.c.

◆ KprintDec()

void KprintDec ( int num)

Prints a signed integer in decimal format.

Handles zero and negative numbers correctly.

Parameters
numThe number to print

Definition at line 108 of file printer.c.

◆ Kprintf()

void Kprintf ( const char * fmt,
... )

Formatted output to the screen.

Supports format specifiers:

  • c : character
  • s : string
  • d : signed decimal integer
  • x : unsigned hexadecimal integer
  • %% : literal percent sign
Parameters
fmtFormat string
...Variable arguments corresponding to format specifiers

Definition at line 152 of file printer.c.

◆ KprintHex()

void KprintHex ( u32 num)

Prints a 32-bit unsigned integer in hexadecimal format prefixed with "0x".

Example output: 0xDEADBEEF

Parameters
numThe number to print

Definition at line 92 of file printer.c.

◆ KprintStr()

void KprintStr ( const char * str)

Prints a null-terminated string to the screen.

Parameters
strPointer to the string to print

Definition at line 133 of file printer.c.

◆ Kputchar()

void Kputchar ( char c)

Outputs a single character to the screen at the current cursor position.

Supports newline ('
') to move cursor to the next line. Advances cursor position and scrolls screen if necessary.

Parameters
cCharacter to output

Definition at line 46 of file printer.c.

◆ KputcharBackspace()

void KputcharBackspace ( )

Handles backspace keypress by moving the cursor back and clearing the character.

Definition at line 71 of file printer.c.