def _get_z80(ram, sp, pc, border): z80 = [0] * 86 z80[30] = 54 # Indicate a v3 Z80 snapshot set_z80_registers(z80, 'i=63', 'iy=23610', 'sp={}'.format(sp), 'pc={}'.format(pc)) set_z80_state(z80, 'iff=1', 'im=1', 'border={}'.format(border & 7)) for bank, data in ((5, ram[:16384]), (1, ram[16384:32768]), (2, ram[32768:49152])): z80 += make_z80_ram_block(data, bank + 3) return z80
def run(infile, options, outfile): header, snapshot = _read_z80(infile) for spec in options.moves: move(snapshot, spec) for spec in options.pokes: poke(snapshot, spec) set_z80_registers(header, *options.reg) set_z80_state(header, *options.state) _write_z80(header, snapshot, outfile)
def _get_z80(ram, options): z80 = [0] * 86 z80[30] = 54 # Indicate a v3 Z80 snapshot set_z80_registers(z80, 'i=63', 'iy=23610') set_z80_registers(z80, *options.reg) set_z80_state(z80, 'iff=1', 'im=1') set_z80_state(z80, *options.state) for bank, data in ((5, ram[:16384]), (1, ram[16384:32768]), (2, ram[32768:49152])): z80 += make_z80_ram_block(data, bank + 3) return z80