2016-01-27 11:31:39 +00:00
|
|
|
Video video;
|
|
|
|
|
|
|
|
Video::Video() {
|
|
|
|
output = new uint32[224 * 224];
|
|
|
|
paletteLiteral = new uint32[1 << 12];
|
|
|
|
paletteStandard = new uint32[1 << 12];
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Video::power() -> void {
|
|
|
|
memory::fill(output(), 224 * 224 * sizeof(uint32));
|
|
|
|
|
2016-03-01 12:23:18 +00:00
|
|
|
for(uint12 color : range(1 << 12)) {
|
2016-01-28 11:39:49 +00:00
|
|
|
paletteLiteral[color] = color;
|
2016-01-27 11:31:39 +00:00
|
|
|
|
2016-03-01 12:23:18 +00:00
|
|
|
uint B = color.bits(0, 3);
|
|
|
|
uint G = color.bits(4, 7);
|
|
|
|
uint R = color.bits(8,11);
|
2016-01-27 11:31:39 +00:00
|
|
|
|
2016-01-28 11:39:49 +00:00
|
|
|
R = image::normalize(R, 4, 16);
|
|
|
|
G = image::normalize(G, 4, 16);
|
|
|
|
B = image::normalize(B, 4, 16);
|
|
|
|
paletteStandard[color] = interface->videoColor(R, G, B);
|
2016-01-27 11:31:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Video::refresh() -> void {
|
|
|
|
for(uint y = 0; y < 144; y++) {
|
|
|
|
auto source = ppu.output + y * 224;
|
|
|
|
for(uint x = 0; x < 224; x++) {
|
|
|
|
auto color = paletteStandard[*source++];
|
2016-03-08 11:34:00 +00:00
|
|
|
*(output() + (y + 40) * 224 + x) = color;
|
|
|
|
//*(output() + (223 - x) * 224 + 40 + y) = color;
|
2016-01-27 11:31:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
interface->videoRefresh(output(), 224 * sizeof(uint32), 224, 224);
|
|
|
|
}
|