5 void outxay(PUSHORT ad
, UCHAR x
, UCHAR y
)
7 USHORT xy
= (x
<< 8) + y
;
9 VideoPortWritePortUshort(ad
, xy
);
12 void setMode(VideoMode mode
)
15 unsigned int y
, c
, a
, m
, n
;
17 VideoPortWritePortUchar((PUCHAR
)MISC
, mode
.Misc
);
18 VideoPortWritePortUchar((PUCHAR
)STATUS
, 0);
19 VideoPortWritePortUchar((PUCHAR
)FEATURE
, mode
.Feature
);
23 outxay((PUSHORT
)SEQ
, mode
.Seq
[x
], x
);
26 VideoPortWritePortUshort((PUSHORT
)CRTC
, 0x11);
27 VideoPortWritePortUshort((PUSHORT
)CRTC
, (mode
.Crtc
[0x11] & 0x7f));
31 outxay((PUSHORT
)CRTC
, mode
.Crtc
[x
], x
);
36 outxay((PUSHORT
)GRAPHICS
, mode
.Gfx
[x
], x
);
39 x
=VideoPortReadPortUchar((PUCHAR
)FEATURE
);
43 VideoPortWritePortUchar((PUCHAR
)ATTRIB
, x
);
44 VideoPortWritePortUchar((PUCHAR
)ATTRIB
, mode
.Attrib
[x
]);
47 x
=VideoPortReadPortUchar((PUCHAR
)STATUS
);
49 VideoPortWritePortUchar((PUCHAR
)ATTRIB
, 0x20);
55 {0x03, 0x01, 0x0f, 0x00, 0x06 },
57 {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, 0x00, 0x40, 0x00, 0x00,
58 0x00, 0x00, 0x00, 0x59, 0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
61 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff},
63 {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
64 0x0c, 0x0d, 0x0e, 0x0f, 0x81, 0x00, 0x0f, 0x00, 0x00}
70 VIDEO_X86_BIOS_ARGUMENTS vxba
;
73 // FIXME: Use Vidport to map the memory properly
74 vidmem
= (char *)(0xd0000000 + 0xa0000);
75 memset(&vxba
, 0, sizeof(vxba
));
77 vps
= VideoPortInt10(NULL
, &vxba
);
79 // Get VGA registers into the correct state (mainly for setting up the palette registers correctly)
82 // Get the VGA into the mode we want to work with
83 WRITE_PORT_UCHAR((PUCHAR
)0x3ce,0x08); // Set
84 WRITE_PORT_UCHAR((PUCHAR
)0x3cf,0); // the MASK
85 WRITE_PORT_USHORT((PUSHORT
)0x3ce,0x0205); // write mode = 2 (bits 0,1) read mode = 0 (bit 3)
86 i
= READ_REGISTER_UCHAR(vidmem
); // Update bit buffer
87 WRITE_REGISTER_UCHAR(vidmem
, 0); // Write the pixel
88 WRITE_PORT_UCHAR((PUCHAR
)0x3ce,0x08);
89 WRITE_PORT_UCHAR((PUCHAR
)0x3cf,0xff);
91 // Zero out video memory (clear a possibly trashed screen)
92 RtlZeroMemory(vidmem
, 64000);
97 VOID
VGAResetDevice(OUT PSTATUS_BLOCK StatusBlock
)
101 OBJECT_ATTRIBUTES Attr
;
104 VIDEO_X86_BIOS_ARGUMENTS vxba
;
106 ULONG ThreadRelease
= 1;
111 memset(&vxba
, 0, sizeof(vxba
));
113 vps
= VideoPortInt10(NULL
, &vxba
);
114 memset(&vxba
, 0, sizeof(vxba
));
116 vps
= VideoPortInt10(NULL
, &vxba
);
117 RtlInitUnicodeString( &Name
, L
"\\TextConsoleRefreshEvent" );
118 InitializeObjectAttributes( &Attr
, &Name
, 0, 0, 0 );
119 Status
= ZwOpenEvent( &Event
, STANDARD_RIGHTS_ALL
, &Attr
);
120 if( !NT_SUCCESS( Status
) )
121 DbgPrint( "VGA: Failed to open refresh event\n" );
123 ZwSetEvent( Event
, &ThreadRelease
);