# Withdrawn from src/supergrafx_python/vpc.py on 2026-11-19 (clean rewrite). Not to be read. # --- Vpc.WINDOW_ORIGIN (lines 54-60) #: U-SGX1: where the window edges fall. A window of width W covers the row's dots #: [0, W - 0x40 + ORIGIN[dot_divider]) and is off for W <= 0x40 (sgxtech: "values smaller #: than $0040 disable the window"; "windows start from the leftmost pixel of the physical #: screen"). The origin per dot clock (4 = 5.37 MHz, 3 = 7.16, 2 = 10.7) is Mednafen's #: calibrated `8 + 24`/`8 + 38`; Mesen2 uses 48 at every clock. Tier 5; the pictures decide #: (docs/m6-record.md). WINDOW_ORIGIN = {4: 32, 3: 46, 2: 32} # noqa: RUF012 # --- Vpc.window_edge (lines 171-175) def window_edge(self, width: int, div: int, dots: int) -> int: """The first row dot outside a window of register value `width` (0 = no window).""" if width <= self.WINDOW_OFF_AT_OR_BELOW: return 0 return min(dots, width - 0x40 + self.WINDOW_ORIGIN[div]) # --- Vpc._mix_run (lines 201-226) def _mix_run(self, a: Sequence[int], b: Sequence[int], cfg: int) -> list[int]: """One window area: `cfg` bit 0 enables VDC 1, bit 1 VDC 2, bits 3-2 the priority code.""" enable1, enable2, code = cfg & 1, cfg & 2, (cfg >> 2) & 3 if not enable1 and not enable2: # [hw: sgxtech] both layers off: colour 0 of the VCE table for every pixel, overscan too return [0] * len(a) if not enable2: return list(a) if not enable1: return list(b) if code in (1, 2) and self.PRIORITY_LABELS == "sgxtech": code = 3 - code if code == 1: # VDC 2 sprites in front of the VDC 1 background, behind VDC 1 sprites return [ q if (q & SPRITE and not p & SPRITE and q & COLOUR) else (p if p & COLOUR else q) for p, q in zip(a, b, strict=True) ] if code == 2: # VDC 1 sprites behind the VDC 2 background (they stay in front of VDC 2 sprites) return [ q if (p & SPRITE and not q & SPRITE and q & COLOUR) else (p if p & COLOUR else q) for p, q in zip(a, b, strict=True) ] # 00b and 11b: VDC 1 over VDC 2 wherever VDC 1 is opaque return [p if p & COLOUR else q for p, q in zip(a, b, strict=True)]