summaryrefslogtreecommitdiff
path: root/src/drivers/video/vga.c
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-06-17 08:47:07 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-06-17 08:47:07 +0200
commiteace3b5f238e5e4eaf4c2ffcbf741616a0d6a25f (patch)
tree6b4ceb442fe2729c8d22aa1231bb20d8144ea076 /src/drivers/video/vga.c
parent0061eeb77f73a7832c4c72aba8dd56dc91743171 (diff)
downloadabaos-eace3b5f238e5e4eaf4c2ffcbf741616a0d6a25f.tar.gz
abaos-eace3b5f238e5e4eaf4c2ffcbf741616a0d6a25f.tar.bz2
added the most complex VGA mode (640x480x4, only timings for now)
added graphics and text mode type parameter to vga_mode_t
Diffstat (limited to 'src/drivers/video/vga.c')
-rw-r--r--src/drivers/video/vga.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/drivers/video/vga.c b/src/drivers/video/vga.c
index bb73f1e..0d3c49a 100644
--- a/src/drivers/video/vga.c
+++ b/src/drivers/video/vga.c
@@ -101,10 +101,11 @@ static void write_registers( vga_t *vga, uint8_t *regs )
port8_write( &vga->attribute_controller_index_port, 0x20 );
}
-vga_mode_t vga_make_mode( const int x, const int y, const int color_depth )
+vga_mode_t vga_make_mode( const vga_mode_type_t mode_type, const int x, const int y, const int color_depth )
{
vga_mode_t mode;
+ mode.mode_type = mode_type;
mode.x = x;
mode.y = y;
mode.color_depth = color_depth;
@@ -114,7 +115,7 @@ vga_mode_t vga_make_mode( const int x, const int y, const int color_depth )
// from http://files.osdev.org/mirrors/geezer/osd/graphics/modes.c
static vga_mode_t modes[] = {
- { 640, 480, 4,
+ { VGA_MODE_TYPE_TEXT, 640, 480, 4,
{
/* MISC */
0x67,
@@ -135,7 +136,7 @@ static vga_mode_t modes[] = {
},
NULL
},
- { 320, 200, 8,
+ { VGA_MODE_TYPE_GRAPHICS, 320, 200, 8,
{
/* MISC */
0x63,
@@ -155,13 +156,35 @@ static vga_mode_t modes[] = {
0x41, 0x00, 0x0F, 0x00, 0x00
},
NULL
+ },
+ { VGA_MODE_TYPE_GRAPHICS, 640, 480, 4,
+ {
+ /* MISC */
+ 0xE3,
+ /* SEQ */
+ 0x03, 0x01, 0x08, 0x00, 0x06,
+ /* CRTC */
+ 0x5F, 0x4F, 0x50, 0x82, 0x54, 0x80, 0x0B, 0x3E,
+ 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xEA, 0x0C, 0xDF, 0x28, 0x00, 0xE7, 0x04, 0xE3,
+ 0xFF,
+ /* GC */
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x05, 0x0F,
+ 0xFF,
+ /* AC */
+ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
+ 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
+ 0x01, 0x00, 0x0F, 0x00, 0x00
+ },
+ NULL
}
};
bool vga_supports_mode( const vga_mode_t mode )
{
for( int i = 0; modes[i].x != 0; i++ ) {
- if( mode.x == modes[i].x &&
+ if( mode.mode_type == modes[i].mode_type &&
+ mode.x == modes[i].x &&
mode.y == modes[i].y &&
mode.color_depth == modes[i].color_depth ) {
return true;
@@ -174,7 +197,8 @@ bool vga_supports_mode( const vga_mode_t mode )
static int get_matching_mode_idx( const vga_mode_t mode )
{
for( int i = 0; modes[i].x != 0; i++ ) {
- if( mode.x == modes[i].x &&
+ if( mode.mode_type == modes[i].mode_type &&
+ mode.x == modes[i].x &&
mode.y == modes[i].y &&
mode.color_depth == modes[i].color_depth ) {
return i;