From ad7f1dd777eda2d6505118c4e47faba3f21e78ba Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Fri, 30 Jun 2017 11:11:10 +0200 Subject: added a VGA wait for retrace in graphics mode --- src/drivers/video/vga.c | 6 ++++++ src/drivers/video/vga.h | 1 + 2 files changed, 7 insertions(+) (limited to 'src/drivers') diff --git a/src/drivers/video/vga.c b/src/drivers/video/vga.c index b0b61f7..2080283 100644 --- a/src/drivers/video/vga.c +++ b/src/drivers/video/vga.c @@ -374,3 +374,9 @@ void vga_draw_char( vga_t *vga, const unsigned char c, const int x, const int y, } } +void vga_wait_for_retrace( vga_t *vga ) +{ + while( port8_read( &vga->attribute_controller_reset_port ) & 0x08 ); + while( !( port8_read( &vga->attribute_controller_reset_port ) & 0x08 ) ); +} + diff --git a/src/drivers/video/vga.h b/src/drivers/video/vga.h index 3b09c37..b9a5c87 100644 --- a/src/drivers/video/vga.h +++ b/src/drivers/video/vga.h @@ -80,5 +80,6 @@ void vga_set_pixel( vga_t *vga, const int x, const int y, const vga_color_t colo void vga_draw_rectangle( vga_t *vga, const int x, const int y, const int w, const int h, const vga_color_t color ); void vga_clear_screen( vga_t *vga, const vga_color_t color ); void vga_draw_char( vga_t *vga, const unsigned char c, const int x, const int y, const vga_color_t background, const vga_color_t foreground ); +void vga_wait_for_retrace( vga_t *vga ); #endif // VGA_H -- cgit v1.2.3-54-g00ecf