Initialize the VGA to work with display driver's vgavideo.c

svn path=/trunk/; revision=1747
This commit is contained in:
Jason Filby 2001-03-29 17:45:50 +00:00
parent fbb680dffd
commit 74412de062

View file

@ -2,97 +2,6 @@
#include <debug.h>
#include "vgavideo.h"
void outxay(USHORT ad, UCHAR x, UCHAR y)
{
USHORT xy = (x << 8) + y;
VideoPortWritePortUshort((PUSHORT)ad, xy);
}
void setMode(VideoMode mode)
{
unsigned char x;
unsigned int y, c, a, m, n;
VideoPortWritePortUchar((PUCHAR)MISC, mode.Misc);
VideoPortWritePortUchar((PUCHAR)STATUS, 0);
VideoPortWritePortUchar((PUCHAR)FEATURE, mode.Feature);
for(x=0; x<5; x++)
{
outxay(SEQ, mode.Seq[x], x);
}
VideoPortWritePortUshort((PUSHORT)CRTC, 0x11);
VideoPortWritePortUshort((PUSHORT)CRTC, (mode.Crtc[0x11] & 0x7f));
for(x=0; x<25; x++)
{
outxay(CRTC, mode.Crtc[x], x);
}
for(x=0; x<9; x++)
{
outxay(GRAPHICS, mode.Gfx[x], x);
}
x=VideoPortReadPortUchar((PUCHAR)FEATURE);
for(x=0; x<21; x++)
{
VideoPortWritePortUchar((PUCHAR)ATTRIB, x);
VideoPortWritePortUchar((PUCHAR)ATTRIB, mode.Attrib[x]);
}
x=VideoPortReadPortUchar((PUCHAR)STATUS);
VideoPortWritePortUchar((PUCHAR)ATTRIB, 0x20);
}
VideoMode Mode12 = {
0xa000, /* 0xe3, */ 0xc3, 0x00,
{0x02, 0x01, 0x0f, 0x00, 0x06 },
{0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, 0x00, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x59, 0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
0xff},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x0f, 0xff},
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
0x0c, 0x0d, 0x0e, 0x0f, 0x81, 0x00, 0x0f, 0x00, 0x00}
};
VideoMode Mode13 = {
0xa000, 0x63, 0x00,
{0x03, 0x01, 0x0f, 0x00, 0x0e},
{0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f, 0x00, 0x41, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x9c, 0x0e, 0x8f, 0x28, 0x40, 0x96, 0xb9, 0xa3,
0xff},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x07, 0x0f, 0xff},
{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
0x0c, 0x0d, 0x0e, 0x0f, 0x41, 0x00, 0x0f, 0x00, 0x00}
};
VideoMode Mode3 = {
0xb800, 0x67, 0x00,
{ 0x03, 0x00, 0x3, 0x00, 0x2 },
{ 0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, 0x00, 0x4f, 0x0e, 0x0f,
0x00, 0x00, 0x00, 0x00, 0x9c, 0x0e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3,
0xff },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, 0xff },
{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
0x0c, 0x0d, 0x0e, 0x0f, 0x0c, 0x00, 0x0f, 0x08, 0x00 }
};
void InitVGAMode()
{
int i;
@ -104,12 +13,15 @@ void InitVGAMode()
memset(&vxba, 0, sizeof(vxba));
vxba.Eax = 0x0012;
vps = VideoPortInt10(NULL, &vxba);
// setMode(Mode12);
// WRITE_PORT_USHORT((PUSHORT)0x3C4, 0x0f02); // index=MASK MAP, write to all bitplanes
// i = vidmem[0];
// VideoPortZeroMemory(vidmem, 38400);
// VideoPortZeroMemory(vidmem, 64000);
// Get the VGA into the mode we want to work with
WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08); // Set
WRITE_PORT_UCHAR((PUCHAR)0x3cf,0); // the MASK
WRITE_PORT_USHORT((PUSHORT)0x3ce,0x0205); // write mode = 2 (bits 0,1) read mode = 0 (bit 3)
i = READ_REGISTER_UCHAR(vidmem); // Update bit buffer
WRITE_REGISTER_UCHAR(vidmem, 0); // Write the pixel
WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08);
WRITE_PORT_UCHAR((PUCHAR)0x3cf,0xff);
vgaPreCalc();
}
@ -127,7 +39,7 @@ VOID VGAResetDevice(OUT PSTATUS_BLOCK StatusBlock)
CHECKPOINT;
Event = 0;
// setMode( Mode3 );
vxba.Eax = 0x0003;
vps = VideoPortInt10(NULL, &vxba);
RtlInitUnicodeString( &Name, L"\\TextConsoleRefreshEvent" );