Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. //this is so I can start coding logic without having to build a cross-compiler
  4. //the only s_* method that should access by external code is s_put_char(char,int)
  5.  
  6. //all methods beginning with s_* are referring to the screen output
  7. #define s_rows 25
  8. #define s_columns 80
  9. #define s_buffer_size 2000 //80x25 = 2000
  10.  
  11. char flags = 0;
  12.  
  13. //first bit is if the screen is inited or not.
  14. char s_buffer[s_buffer_size]; //80x25
  15.  
  16. void s_update()
  17. {
  18. system("cls");
  19. printf(s_buffer);
  20. }
  21.  
  22. void s_init()
  23. {
  24. int index = 0;
  25. while(index < s_buffer_size)
  26. {
  27. //s_buffer[index] = ' ';
  28. index++;
  29. }
  30. flags += 128; //flip first bit
  31. s_update;
  32. }
  33.  
  34. void s_put_char(char c, unsigned int index)
  35. {
  36. if(flags < 128){ s_init(); }
  37. //checks to see if the first bit is flipped or not.
  38. //if first bit not flipped, then screen needs to be inited
  39. s_buffer[index] = c;
  40. s_update();
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement