/* FIXME: resetting the c64 should be handled in the upper layer */ static int set_mmc64_enabled(int val, void *param) { LOG(("MMC64: set_enabled: '%s' %d to %d", mmc64_bios_filename, mmc64_enabled, val)); if (!mmc64_enabled && val) { /* activate mmc64 */ if (param) { /* if the param is != NULL, then we should load the default image file */ LOG(("MMC64: set_enabled(1) '%s'", mmc64_bios_filename)); if (mmc64_bios_filename) { if (*mmc64_bios_filename) { if (cartridge_attach_image(CARTRIDGE_MMC64, mmc64_bios_filename) < 0) { LOG(("MMC64: set_enabled(1) did not register")); return -1; } /* mmc64_enabled = 1; */ /* cartridge_attach_image will end up calling set_mmc64_enabled again */ return 0; } } } else { LOG(("MMC64: set_enabled(0) '%s'", mmc64_bios_filename)); cart_power_off(); /* if the param is == NULL, then we should actually set the resource */ if (c64export_add(&export_res) < 0) { LOG(("MMC64: set_enabled(0) did not register")); return -1; } else { LOG(("MMC64: set_enabled registered")); if (mmc64_activate() < 0) { return -1; } mmc64_enabled = 1; cart_set_port_exrom_slot0(1); cart_port_config_changed_slot0(); mmc64_clockport_list_item = io_source_register(mmc64_current_clockport_device); mmc64_io1_list_item = io_source_register(&mmc64_io1_device); mmc64_io2_list_item = io_source_register(&mmc64_io2_device); mmc64_reset(); } } } else if (mmc64_enabled && !val) { /* remove mmc64 */ if (mmc64_deactivate() < 0) { return -1; } cart_power_off(); c64export_remove(&export_res); mmc64_enabled = 0; cart_set_port_exrom_slot0(0); cart_port_config_changed_slot0(); io_source_unregister(mmc64_clockport_list_item); io_source_unregister(mmc64_io1_list_item); io_source_unregister(mmc64_io2_list_item); mmc64_clockport_list_item = NULL; mmc64_io1_list_item = NULL; mmc64_io2_list_item = NULL; } LOG(("MMC64: set_enabled done: '%s' %d : %d", mmc64_bios_filename, val, mmc64_enabled)); return 0; }
/* C64-specific reset sequence. */ void machine_specific_reset(void) { serial_traps_reset(); ciacore_reset(machine_context.cia1); ciacore_reset(machine_context.cia2); sid_reset(); if (!vsid_mode) { tpicore_reset(machine_context.tpi1); acia1_reset(); rs232drv_reset(); rsuser_reset(); printer_reset(); /* FIXME */ /* reset_reu(); */ } /* The VIC-II must be the *last* to be reset. */ vicii_reset(); if (vsid_mode) { psid_init_tune(); return; } cartridge_reset(); drive_reset(); datasette_reset(); reu_reset(); georam_reset(); ramcart_reset(); plus60k_reset(); plus256k_reset(); c64_256k_reset(); mmc64_reset(); }