harness: explicit monochrome palette (pen 0 black, pen 1 white)

vt1200.cpp declared PALETTE(config, m_palette).set_entries(256) with no init
delegate, so render_active_line()'s pens 0/1 rendered in whatever MAME's
default palette held -- reported as red on screen.  Use
palette_device::MONOCHROME (emupal.cpp: palette_init_monochrome) with two
entries, so the colour is ours and deterministic.

Verified via a real MAME screenshot (screen:snapshot(), which renders through
the palette -- dump_frame()'s PPM is straight from bitmap pens and cannot show
colour): pal_mono_frame600.png is exactly black (0,0,0) + white (255,255,255).
palverify.lua takes the screenshot; the frame is the level-1 error screen.
This commit is contained in:
SDD committed 2026-10-16 13:02:50 +03:00
1 parent ac60ad2f89
commit db535c2adc
3 files changed
+34 -1

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

+30
View File
@@ -0,0 +1,30 @@
-- palverify.lua -- take a real MAME screenshot (video manager -> palette applied)
-- at a chosen frame. Unlike dump_frame()'s PPM (straight from bitmap pens), a
-- screen:snapshot() renders through the palette, so it is the correct instrument
-- for checking the mono colour ramp.
--
-- PAL_FRAME=<n> PAL_OUT=<abs path .png> <mame> ... -autoboot_script palverify.lua
local machine = manager.machine
local dbg = machine.debugger
local screens = machine.screens
local at = tonumber(os.getenv("PAL_FRAME") or "600")
local out = os.getenv("PAL_OUT") or "/home/arti/code/k-space/vt1200/harness/mame/pal_snap.png"
local screen = nil
for tag, s in pairs(screens) do screen = s; break end
if not screen then print("ERROR: no screen device"); machine:exit(); return end
local n = 0
emu.register_frame_done(function()
n = n + 1
if n == at then
local err = screen:snapshot(out)
print(string.format("SNAP frame=%d -> %s err=%s", n, out, tostring(err)))
machine:exit()
end
if n > at + 5 then machine:exit() end
end, "vt1200-palverify")
if dbg then dbg.execution_state = 'run' end
+4 -1
View File
@@ -1196,7 +1196,10 @@ void vt1200_state::vt1200(machine_config &config)
// 256 entries so the TMS34010 renderer can encode multi-bit pixels; the
// terminal's real output stage is a later question.
PALETTE(config, m_palette).set_entries(256);
// Explicit monochrome ramp: pen 0 = black, pen 1 = white. render_active_line()
// writes only pens 0/1, so with no init delegate the on-screen colour was
// whatever MAME's default palette held (reported: red). Two entries suffice.
PALETTE(config, m_palette, palette_device::MONOCHROME).set_entries(2);
// The two Signetics SCN2681 DUARTs (same family as the Motorola MC68681:
// 2681 = RD/WR strobes, 68681 = R/W + DTACK + interrupt vector). The