"""Consumer-boundary checks for the released Z80 instruction-core package.""" from z80_python import Z80CPU class ConsumerHost(Z80CPU): """Tiny deterministic host exercising only the documented package API.""" def __init__(self) -> None: super().__init__() self.memory = bytearray(0x10000) def read_byte(self, addr: int) -> int: return self.memory[addr & 0xFFFF] def write_byte(self, addr: int, value: int) -> None: self.memory[addr & 0xFFFF] = value & 0xFF def read_port(self, addr: int) -> int: return 0xFF def write_port(self, addr: int, value: int) -> None: pass def test_released_core_executes_through_documented_host_boundary() -> None: cpu = ConsumerHost() cpu.memory[:3] = bytes((0x3E, 0x2A, 0x3C)) # LD A,2Ah; INC A assert (cpu.step(), cpu.step(), cpu.a) == (7, 4, 0x2B)