def reloc_exit_patch(patch_data, relocs, start_address):
    """Relocate a piece of 6502 code to a given starting address."""
    patch_data = bytearray(patch_data)
    for i in relocs:
        address = patch_data[i] + (patch_data[i + 1] << 8) + start_address
        patch_data[i] = address & 0xFF
        patch_data[i + 1] = address >> 8
    return patch_data