Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void VGA_text(int x, int y, char * text_ptr) {
- int offset;
- volatile char * character_buffer =
- (char *) VGA_CHAR_BUFFER_AVALON_CHAR_BUFFER_SLAVE_BASE; // VGA character buffer
- /* assume that the text string fits on one line */
- offset = (y << 7) + x;
- while (*(text_ptr)) {
- *(character_buffer + offset) = *(text_ptr); // write to the character buffer
- ++text_ptr;
- ++offset;
- }
- }
- /****************************************************************************************
- * Draw a filled rectangle on the VGA monitor
- ****************************************************************************************/
- void VGA_box(int x1, int y1, int x2, int y2, short pixel_color) {
- int pixel_ptr, row, col;
- /* assume that the box coordinates are valid */
- for (row = y1; row <= y2; row++)
- for (col = x1; col <= x2; ++col) {
- pixel_ptr = VGA_PIXEL_DMA_BASE + (row << 10) + (col << 1);
- *(short *) pixel_ptr = pixel_color; // set pixel color
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement