"""Load a galaga-probe capture (target/probe/ram.bin) as numpy arrays. Layout per frame (see src/bin/galaga-probe.rs): u32 frame, u8 in0, u8 in1, video RAM 0x8000-0x87ff, work RAM 0x8800-0x8bff, 0x9000-0x93ff, 0x9800-0x9bff. """ import numpy as np RECORD = 4 + 2 + 0x800 + 3 * 0x400 REGIONS = {0x8000: (6, 0x800), 0x8800: (6 + 0x800, 0x400), 0x9000: (6 + 0xc00, 0x400), 0x9800: (6 + 0x1000, 0x400)} class Capture: def __init__(self, path="target/probe/ram.bin"): raw = np.fromfile(path, dtype=np.uint8) self.raw = raw.reshape(-1, RECORD) self.frames = self.raw[:, :4].copy().view("