diff --git a/emulator/vpx-device/vpxlog.cpp b/emulator/vpx-device/vpxlog.cpp index 1a68de8..983b48f 100644 --- a/emulator/vpx-device/vpxlog.cpp +++ b/emulator/vpx-device/vpxlog.cpp @@ -669,23 +669,22 @@ static void pal_draw(HDC dc, int g, int cw, int ch) { Bitu start = vga.config.real_start; /* visible page start (bytes) */ Bitu stride = (Bitu)W * 2; /* 16bpp */ if (fb) { - /* The six displays are bit-packed into each 16bpp pixel: - * window 0 = the COLOR radar = bits 0-5 as 6-bit RGB (2 bits/chan) - * window g>=1 = a mono display = the 2-bit field at bit (4 + 2*g) - * (g=1 -> bits 6-7, ... g=5 -> bits 14-15) - * rendered as brightness. */ - unsigned shift = 4u + 2u * (unsigned)g; /* used for g>=1 */ + /* window 0 = the color radar = bits 0-7 (3:3:2 RGB); windows g>=1 = + * one single bit each, starting at bit 8 (g=1 -> bit 8 ... g=8 -> + * bit 15), rendered white/black -- so the remaining bits can be + * re-paired into their displays by eye. */ + unsigned bit = 7u + (unsigned)g; /* used for g>=1 */ for (int y = 0; y < H; y++) { Bitu ofs = start + (Bitu)y * stride; unsigned char *d = &img[(size_t)y * W * 3]; for (int x = 0; x < W; x++, ofs += 2, d += 3) { uint16_t px = *(const uint16_t *)(fb + (ofs & mask)); if (g == 0) { - d[0] = (unsigned char)(( px & 0x3u) * 85u); /* R: bits 0-1 */ - d[1] = (unsigned char)(((px >> 2u) & 0x3u) * 85u); /* G: bits 2-3 */ - d[2] = (unsigned char)(((px >> 4u) & 0x3u) * 85u); /* B: bits 4-5 */ + d[0] = (unsigned char)(( px & 0x7u) * 255u / 7u); /* R: bits 0-2 */ + d[1] = (unsigned char)(((px >> 3u) & 0x7u) * 255u / 7u); /* G: bits 3-5 */ + d[2] = (unsigned char)(((px >> 6u) & 0x3u) * 255u / 3u); /* B: bits 6-7 */ } else { - unsigned char v = (unsigned char)(((px >> shift) & 0x3u) * 85u); + unsigned char v = ((px >> bit) & 1u) ? 255 : 0; d[0] = d[1] = d[2] = v; } } @@ -742,19 +741,18 @@ static DWORD WINAPI rt_main(LPVOID) { if (!make_gl_window("VPX VelociRender (emulated)", 832, 512, 40, 40, &wnd, &dc, &gl)) return 1; - /* one 640x480 window per decoded display: window 0 = color radar - * (bits 0-5 RGB), windows 1-6 = the mono displays (2-bit fields). */ - const int NPAL = 7; - static const char *pal_titles[7] = { - "display 0 - radar (bits 0-5 RGB)", "display 1 (bits 6-7)", - "display 2 (bits 8-9)", "display 3 (bits 10-11)", - "display 4 (bits 12-13)", "display 5 (bits 14-15)", - "display 6 (bits 16-17)" }; - HWND pwnd[7]; HDC pdc[7]; HGLRC pgl[7]; - bool phave[7] = { false, false, false, false, false, false, false }; + /* window 0 = color radar (bits 0-7); windows 1-8 = single bits 8..15, + * fanned out so the user can re-pair them into their displays. */ + const int NPAL = 9; + static const char *pal_titles[9] = { + "display 0 - radar (bits 0-7)", + "bit 8", "bit 9", "bit 10", "bit 11", + "bit 12", "bit 13", "bit 14", "bit 15" }; + HWND pwnd[9]; HDC pdc[9]; HGLRC pgl[9]; + bool phave[9]; for (int g = 0; g < NPAL; g++) - phave[g] = make_gl_window(pal_titles[g], 640, 480, - 880 + (g % 3) * 650, 30 + (g / 3) * 470, + phave[g] = make_gl_window(pal_titles[g], 480, 360, + 700 + (g % 3) * 500, 20 + (g / 3) * 400, &pwnd[g], &pdc[g], &pgl[g]); VFrame cur;