screen.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /* Text screen: a grid of character cells (char + VGA attribute) plus a cursor.
  2. Pure cell-buffer logic — no framebuffer access. The window manager renders
  3. these screens into windows. */
  4. #ifndef SCREEN_H
  5. #define SCREEN_H
  6. #define SCREEN_COLS 64
  7. #define SCREEN_ROWS 32
  8. struct text_screen {
  9. unsigned short cells[SCREEN_COLS * SCREEN_ROWS];
  10. unsigned int cols;
  11. unsigned int rows;
  12. unsigned int cursor; /* linear index 0..cols*rows-1 */
  13. unsigned int cursor_attr;
  14. unsigned int cursor_visible;
  15. /* Cell rendering bookkeeping for the boot console. */
  16. int dirty; /* content changed since the last draw */
  17. unsigned int dmg_col0, dmg_col1;
  18. unsigned int dmg_row0, dmg_row1;
  19. };
  20. void screen_init(struct text_screen *s);
  21. void screen_clear(struct text_screen *s);
  22. void screen_putchar(struct text_screen *s, char c);
  23. void screen_putstr(struct text_screen *s, const char *str);
  24. void screen_puthex(struct text_screen *s, unsigned int n);
  25. void screen_put_at(struct text_screen *s, unsigned int pos, unsigned short value);
  26. /* Mark the cell the cursor sits in. */
  27. void screen_damage_cursor(struct text_screen *s);
  28. #endif