Files
vt1200/xie/xie_schemes_raw.py
arti 17dfd24340 docs(xie): the VT1200 ROM has no DCT (JPEG) scheme -- measured
The question was whether this ROM answers "unsupported" for XieK_DCT.  It does,
at both layers, and it behaves exactly like an out-of-range scheme value.

SetTransport (minor 20), raw wire request, a fresh bitonal photomap per scheme:
  PCM / G31D / G32D / G42D -> accepted
  DCT (4) and 5            -> BadIDChoice(14), minor_op 20
So the ROM does not even implement the reference server's IsBitonal_ rules
(G42D is accepted on a 256-level photomap, where XieTransport.c would BadMatch),
but it does refuse 4 and above.

Export (minor 21) with the photomap's compression byte forced to each value
(the server never initialises it -- it holds the heap fill 0x55, which is why
harness/mame/xie_fix.lua pokes file 0x1B256):
  0..3 -> pixmap 4096/4096, no X error
  4    -> BadValue, nothing drawn
  5    -> BadValue, nothing drawn

And the ROM carries no JPEG machinery: no "JPEG"/"DCT" string, and the standard
Annex K quantisation table is absent in both zigzag and natural order (no flat
8x8 either).  A DCT codec carries one of those; this ROM carries none.

"DDX_RENDER: unsupported compression scheme" exists in the ROM but did not fire
in these runs, so it belongs to a path these probes do not reach -- recorded as
an open detail rather than claimed as the explanation.

Probes: xie/xiescheme.c (libXie, one scheme per connection) and
xie/xie_schemes_raw.py (raw protocol, exact error codes).
2026-11-01 23:55:27 +02:00

77 lines
2.7 KiB
Python

#!/usr/bin/env python3
"""Ask the server, in raw XIE 2.3 protocol, one question:
for each XieK_ compression scheme, does SetTransport accept it?
It builds a fresh bitonal photomap per scheme (a photomap that already has a
transport must match it on a second SetTransport, which would turn every later
attempt into a BadMatch for the wrong reason) and then sends a real
xieSetTransportReq (minor 20, 140 bytes) and prints whatever comes back.
Usage: xie_schemes_raw.py [host]
"""
import os
import struct
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, HERE)
sys.path.insert(0, os.path.join(HERE, "evidence"))
from probe23 import Cli, describe_all # noqa: E402
NAMES = {0: "PCM", 1: "G31D", 2: "G32D", 3: "G42D", 4: "DCT", 5: "(5)"}
def make_photomap(c, slot, levels=2):
"""xieCreatePhotoReq: bitonal 64x64, 1 component, 2 levels.
A distinct resource id per call -- reusing one after the first photomap owns
it is a BadIDChoice, which would mask the answer we are after.
"""
pid = c.new_id(0x0AAAA + slot * 0x100)
w = [2, pid, 64, 64, 0, 0, levels, 0, 0, 0x00000100, 0]
out = c.send(8, 12, b"".join(struct.pack("<I", x) for x in w))
return pid, describe_all(out)
def set_transport(c, pid, scheme, mode=1):
"""xieSetTransportReq, 140 bytes: 3C header + 4 + 4 + 4 + 4 + 24 + 96."""
w = [0] * 34
w[0] = pid
w[1] = 0 # compression_parameter
w[2] = scheme | (mode << 8) | (1 << 16) # scheme|mode|comp_org
w[3] = 1 # plane_mask
w[4] = 1 # pixel_stride[0] = 1
w[10] = 8 # scanline_stride[0] = 8
return c.send(20, 35, b"".join(struct.pack("<I", x) for x in w))
def main(argv):
c = Cli()
c.send(1, 2, struct.pack("<HH", 2, 3)) # init session
levels = int(argv[1]) if len(argv) > 1 else 2
schemes = [int(argv[2])] if len(argv) > 2 else (0, 1, 2, 3, 4, 5)
mode = int(argv[3]) if len(argv) > 3 else 1
print("levels=%d mode=%d (%s)" % (levels, mode,
"GetStream" if mode == 1 else "PutStream"))
for scheme in schemes:
pid, created = make_photomap(c, scheme, levels)
if "ERROR" in created:
print("%-5s create FAILED: %s" % (NAMES[scheme], created))
continue
r = set_transport(c, pid, scheme, mode)
kind = describe_all(r)
if "ERROR" in kind:
verdict = "REFUSED"
elif "NO REPLY" in kind or "NO PACKETS" in kind:
verdict = "ACCEPTED"
else:
verdict = "?"
print("%-5s SetTransport -> %-8s %s" % (NAMES[scheme], verdict, kind))
if __name__ == "__main__":
main(sys.argv)