static int set_kernal_revision(int val, void *param)
{
    int trapfl;

    log_verbose("set_kernal_revision val:%d kernal_revision: %d", val, kernal_revision);
    if(!c64rom_isloaded()) {
        return 0;
    }
    /* disable device traps before kernal patching */
    if (machine_class != VICE_MACHINE_VSID) {
        resources_get_int("VirtualDevices", &trapfl);
        resources_set_int("VirtualDevices", 0);
    }
    /* patch kernal to given revision */
    if ((val != -1) && (patch_rom_idx(val) < 0)) {
        val = -1;
    }
    memcpy(c64memrom_kernal64_trap_rom, c64memrom_kernal64_rom, C64_KERNAL_ROM_SIZE);
    if (kernal_revision != val) {
        machine_trigger_reset(MACHINE_RESET_MODE_HARD);
    }
    /* restore traps */
    if (machine_class != VICE_MACHINE_VSID) {
        resources_set_int("VirtualDevices", trapfl);
    }
    kernal_revision = val;
    log_verbose("set_kernal_revision new kernal_revision: %d", kernal_revision);
    return 0;
}
static int set_kernal_revision(const char *param, void *extra_param)
{
    uint16_t sum;                   /* ROM checksum */
    int id;                     /* ROM identification number */
    int rev = C64_KERNAL_UNKNOWN;
    int i = 0;

    if (!param) {
        return -1;
    }

    do {
        if (strcmp(kernal_match[i].name, param) == 0) {
            rev = kernal_match[i].rev;
        }
        i++;
    } while ((rev == C64_KERNAL_UNKNOWN) && (kernal_match[i].name != NULL));

    if(!c64rom_isloaded()) {
        kernal_revision = rev;
        return 0;
    }

    if (c64rom_get_kernal_chksum_id(&sum, &id) < 0) {
        id = C64_KERNAL_UNKNOWN;
        kernal_revision = id;
    } else {
        if (patch_rom_idx(rev) >= 0) {
            kernal_revision = rev;
        } else {
            kernal_revision = id;
        }
    }
    return 0;
}
Beispiel #3
0
static int set_kernal_revision(int val, void *param)
{
    if(!c64rom_isloaded()) {
        return 0;
    }
    if ((val != -1) && (patch_rom_idx(val) < 0)) {
        kernal_revision = -1;
    } else {
        kernal_revision = val;
    }
    memcpy(c64memrom_kernal64_trap_rom, c64memrom_kernal64_rom, C64_KERNAL_ROM_SIZE);
    return 0;
}