Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. struct __attribute__((packed)) VideoChar { char c; char color; };
  2.  
  3. char* video = (char*) 0xb8000;
  4. int x = 0;
  5. int y = 0;
  6.  
  7. void clearScreen(void)
  8. {
  9.     for(int i = 0; i <= 2000; i++)
  10.     {
  11.         video[i * 2] = ' ';
  12.        
  13.         video[i * 2 + 1] = 0x00;
  14.     }
  15. }
  16.  
  17. void puts(const char * string)
  18. {
  19.     for (int i = 0; string[i] != 0; i++)
  20.     {
  21.         VideoChar vchar;
  22.         vchar.c = string[i];
  23.         vchar.color = 0x0f;
  24.        
  25.         video[x + 80 * y] = vchar;
  26.        
  27.         x++;
  28.     }
  29. }
  30.  
  31. void putc(char c)
  32. {  
  33.     VideoChar vchar;
  34.     vchar.c = string[i];
  35.     vchar.color = 0x0f;
  36.    
  37.     video[x + 80 * y] = c;
  38.    
  39.     x++;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement