- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
void PPU::scanline() noexcept
{
if (control & CONTROL_MASK_BG_DISPLAY)
{
const int st = control & CONTROL_MASK_BG_WINDOW_TILE_DATA_SELECT ? 0x0000 : 0x0800;
const int sm = control & CONTROL_MASK_BG_TILE_MAP_DISPLAY_SELECT ? 0x1C00 : 0x1800;
for (int i = 0; i < 160; ++i)
{
const int im = sm + (scx + i) / 8 % 32 + (scy + ly) / 8 % 32 * 32;
const int vm = st == 0x0000 ? vram[im] :
(signed char) vram[im] + 128;
const unsigned px =
(vram[st + vm * 16 + (scy + ly) % 8 * 2 ] >> (7 - (scx + i) % 8) & 1) << 1 |
(vram[st + vm * 16 + (scy + ly) % 8 * 2 + 1] >> (7 - (scx + i) % 8) & 1);
framebuffer[(i + ly * 160) / 8 * 2] &= ~((px << 6) >> i % 8 * 2);
framebuffer[(i + ly * 160) / 8 * 2] |= (px << 6) >> i % 8 * 2;
framebuffer[(i + ly * 160) / 8 * 2 + 1] &= ~((px << 14) >> (i % 8 * 2));
framebuffer[(i + ly * 160) / 8 * 2 + 1] |= (px << 14) >> (i % 8 * 2);
}
}
...
Комментарии (0) RSS
Добавить комментарий