#ifndef VGA_H #define VGA_H #include #include "string.h" #include #include "interrupts.h" #include "port.h" #include "video.h" #define NOF_MODE_REGS 66 typedef struct { video_mode_t base; uint8_t regs[NOF_MODE_REGS]; uint8_t *segment; size_t segment_size; } vga_mode_t; typedef struct { video_t base; port8_t misc_port; port8_t crtc_index_port; port8_t crtc_data_port; port8_t sequencer_index_port; port8_t sequencer_data_port; port8_t graphics_controller_index_port; port8_t graphics_controller_data_port; port8_t attribute_controller_index_port; port8_t attribute_controller_read_port; port8_t attribute_controller_write_port; port8_t attribute_controller_reset_port; bool use_z_buffer; uint8_t *zbuffer; // stores either the address to the beginning of the segment // (real mapped I/O memory or the beginning of the Z buffer uint8_t *base_addr; } vga_t; typedef struct { video_vtable_t base; } vga_vtable_t; void vga_init( vga_t *vga, interrupt_t *interrupt, void *context ); void vga_activate( void *obj ); void vga_deactivate( void *obj ); void vga_deinit( void *obj ); void vga_print_name( void *obj ); void vga_print_info( void *obj ); bool vga_switch_mode( void *obj, const video_mode_t *mode ); void vga_set_pixel( void *, const int x, const int y, const video_rgb_color_t color ); void vga_draw_rectangle( void *, const int x, const int y, const int w, const int h, const video_rgb_color_t color ); void vga_clear_screen( void *, const video_rgb_color_t color ); void vga_draw_char( void *, const unsigned char c, const int x, const int y, const video_rgb_color_t background, const video_rgb_color_t foreground ); void vga_wait_for_retrace( void * ); void vga_use_z_buffer( void *, bool use ); void vga_refresh( void * ); #endif // VGA_H