Skip to content

Commit

Permalink
Start of Tons of VGA Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
amanuel2 committed May 2, 2017
1 parent a98e3ba commit ff93421
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 17 deletions.
4 changes: 4 additions & 0 deletions include/platform/pc/drv/video/VGA/graphics/graphics.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#ifndef _VGA_VIDEO_GRAPHICS
#define _VGA_VIDEO_GRAPHICS

#include <misc/rgb.h>

#define RES_1_WIDTH 320
#define RES_1_HEIGHT 200
#define RES_1_COLORDEPTH 8

extern void setMode(int width, int height, int colorDepth,uint8_t background);
extern void vgaGrapicsPutPixel(int32_t x, int32_t y, uint8_t colorIndex);
extern void clearVgaGraphics();

#endif
16 changes: 8 additions & 8 deletions include/platform/pc/drv/video/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ extern size_t video_driver_width;
extern size_t video_driver_height;
extern char* video_driver_name;
extern char* video_driver_mode;
extern char* video_driver_fullname;

extern char* video_driver_fullname;

extern struct device_driver_t video_driver;


Expand All @@ -24,7 +24,7 @@ typedef void(*clear_t)(void);
typedef void(*putch_t)(char c);
typedef void(*scroll_t)(int offset);
typedef int(*update_cursor_t)(int row,int col, uint8_t crsr_start,uint8_t crsr_end);
typedef void(*put_pixel_t)(int32_t x, int32_t y, rgb_t rgb);
typedef void(*put_pixel_t)(int32_t x, int32_t y, uint8_t color_index);


/*
Expand Down Expand Up @@ -66,13 +66,13 @@ struct video_driver_t
uint16_t status;
char* name;
};


extern struct video_driver_t *video_drivers[];

#endif /*ARCH_DRV_VIDEO_H_*/









5 changes: 5 additions & 0 deletions platform/pc/drv/video/VGA/graphics/graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ void setMode(int width, int height, int colorDepth, uint8_t background)
fillRectangle(0,0,RES_1_WIDTH,RES_1_HEIGHT,background);
}

void clearVgaGraphics()
{
fillRectangle(0,0,RES_1_WIDTH,RES_1_HEIGHT,0x0);
}


void writeRegister(uint8_t * register_res)
{
Expand Down
6 changes: 3 additions & 3 deletions platform/pc/drv/video/VGA/textmode/vga_textmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

int init_vga_textmode()
{
__textmode.w = video_driver_width;
__textmode.h = video_driver_height;
__textmode.name = video_driver_fullname;
__textmode.w = 80;
__textmode.h = 25;
__textmode.name = "VGA_TEXTMODE_80_x_25";
return STATUS_OK;
}

Expand Down
12 changes: 11 additions & 1 deletion platform/pc/drv/video/VGA/vga.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,17 @@ int init_vga_driver()
else if(strcmp(video_driver_mode, "GRAPHICS")==0)
{
vga_driver.mode = GRAPHICS_MODE;
// /vga_driver.put_pixel = function();
vga_driver.put_pixel = vgaGrapicsPutPixel;
set_mode_util(
0,
vgaGrapicsPutPixel,
clearVgaGraphics,
0,
0
);
vga_driver.name = "VGA_TEXTMODE_320_x_200";
vga_driver.fg = 7;
vga_driver.bg = 0;
}

return STATUS_OK;
Expand Down
5 changes: 0 additions & 5 deletions platform/pc/drv/video/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ struct device_driver_t video_driver =
.version = "STATUS_VERSION_NA"
};

size_t video_driver_width = 80;
size_t video_driver_height = 25;
char* video_driver_name = "VGA";
char* video_driver_mode = "TEXTMODE";
char* video_driver_fullname = "VGA_TEXTMODE_80_x_25";

struct video_driver_t *video_drivers[] =
{
Expand Down

0 comments on commit ff93421

Please sign in to comment.