Advertisement
Guest User

Untitled

a guest
Oct 5th, 2022
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. // stdio.c
  2. uint16_t encode_color(uint16_t color, char ch) {
  3.     return (uint16_t)(color << 8) | (uint16_t)ch;
  4. }
  5.  
  6. int printf(const char *restrict fmt, ...) {
  7.  
  8.     volatile uint16_t * out = (uint16_t* )0xb8000;
  9.  
  10.     for (uint16_t i = 0; fmt[i] != '\0'; i++) {
  11.         out[i] = encode_color(15, fmt[i]);
  12.     }
  13.     return 0;
  14. }
  15.  
  16. // kernel.c
  17. void kernel_main() {
  18.     printf("hello world");
  19. }
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement