Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. void VGA_text(int x, int y, char * text_ptr) {
  2. int offset;
  3. volatile char * character_buffer =
  4. (char *) VGA_CHAR_BUFFER_AVALON_CHAR_BUFFER_SLAVE_BASE; // VGA character buffer
  5.  
  6. /* assume that the text string fits on one line */
  7. offset = (y << 7) + x;
  8. while (*(text_ptr)) {
  9. *(character_buffer + offset) = *(text_ptr); // write to the character buffer
  10. ++text_ptr;
  11. ++offset;
  12. }
  13. }
  14.  
  15. /****************************************************************************************
  16. * Draw a filled rectangle on the VGA monitor
  17. ****************************************************************************************/
  18. void VGA_box(int x1, int y1, int x2, int y2, short pixel_color) {
  19. int pixel_ptr, row, col;
  20.  
  21. /* assume that the box coordinates are valid */
  22. for (row = y1; row <= y2; row++)
  23. for (col = x1; col <= x2; ++col) {
  24. pixel_ptr = VGA_PIXEL_DMA_BASE + (row << 10) + (col << 1);
  25. *(short *) pixel_ptr = pixel_color; // set pixel color
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement