# Repro for a5200-python 844355d: a save state taken while a CX53 trak-ball is in use does not # continue identically. Run with the reference's interpreter, from /: # PYPY_GC_NURSERY=1M .venv-pypy/bin/python trak_state_repro.py "RealSports Football (USA).zip" import sys from a5200_python import state from a5200_python.system import Console rom = sys.argv[1] def drive(console, frames, start): pad = console.controllers.pads[0] for f in range(start, start + frames): pad.trakball = True pad.vx = 4.0 if f >= 480 else 0.0 console.run_frames(1) a = Console(rom) drive(a, 500, 1) saved = state.snapshot(a) ball_a = list(a.controllers._balls[0].out) drive(a, 10, 501) b = Console(rom) state.restore(b, saved) ball_b = list(b.controllers._balls[0].out) drive(b, 10, 501) print("trak-ball lag output at the save:", ball_a, "after restore:", ball_b) print("pad 1 x after 10 more frames: uninterrupted", a.controllers.pads[0].x, "restored", b.controllers.pads[0].x) print("POT0 target:", a.controllers.rc.target[0], b.controllers.rc.target[0]) print("RAM identical:", bytes(a.board.ram) == bytes(b.board.ram), "frame identical:", bytes(a.board.frame) == bytes(b.board.frame))