int machine_load_rom( int page_num, const char *filename, const char *fallback, size_t expected_length ) { return machine_load_rom_bank( memory_map_rom, page_num, filename, fallback, expected_length ); }
static void speccyboot_reset( int hard_reset GCC_UNUSED ) { static int tap_opened = 0; speccyboot_rom_active = 0; if( !periph_is_active( PERIPH_TYPE_SPECCYBOOT ) ) return; if( machine_load_rom_bank( speccyboot_memory_map_romcs, 0, settings_current.rom_speccyboot, settings_default.rom_speccyboot, 0x2000 ) ) return; out_register_state = 0xff; /* force transitions to low */ speccyboot_register_write( 0, 0 ); /* * Open TAP. If this fails, SpeccyBoot emulation won't work. * * This is done here rather than in speccyboot_init() to ensure any * error messages are only displayed if SpeccyBoot emulation is * actually requested. */ if( !tap_opened ) { nic_enc28j60_init( nic ); tap_opened = 1; } }
static void opus_reset( int hard_reset ) { int i; opus_active = 0; opus_available = 0; if( !periph_is_active( PERIPH_TYPE_OPUS ) ) { return; } if( machine_load_rom_bank( opus_memory_map_romcs_rom, 0, settings_current.rom_opus, settings_default.rom_opus, 0x2000 ) ) { settings_current.opus = 0; periph_activate_type( PERIPH_TYPE_OPUS, 0 ); return; } for( i = 0; i < MEMORY_PAGES_IN_2K; i++ ) { struct memory_page *page = &opus_memory_map_romcs_ram[ i ]; page->page = opus_ram + i * MEMORY_PAGE_SIZE; page->offset = i * MEMORY_PAGE_SIZE; } machine_current->ram.romcs = 0; for( i = 0; i < MEMORY_PAGES_IN_2K; i++ ) opus_memory_map_romcs_ram[ i ].writable = 1; data_reg_a = 0; data_dir_a = 0; control_a = 0; data_reg_b = 0; data_dir_b = 0; control_b = 0; opus_available = 1; if( hard_reset ) memset( opus_ram, 0, sizeof( opus_ram ) ); wd_fdc_master_reset( opus_fdc ); for( i = 0; i < OPUS_NUM_DRIVES; i++ ) { ui_media_drive_update_menus( &opus_ui_drives[ i ], UI_MEDIA_DRIVE_UPDATE_ALL ); } opus_fdc->current_drive = &opus_drives[ 0 ]; fdd_select( &opus_drives[ 0 ], 1 ); machine_current->memory_map(); ui_statusbar_update( UI_STATUSBAR_ITEM_DISK, UI_STATUSBAR_STATE_INACTIVE ); }
static void didaktik_reset( int hard_reset ) { int i; didaktik80_active = 0; didaktik80_available = 0; ui_menu_activate( UI_MENU_ITEM_MACHINE_DIDAKTIK80_SNAP, 0 ); if( !periph_is_active( PERIPH_TYPE_DIDAKTIK80 ) ) { return; } if( machine_load_rom_bank( didaktik_memory_map_romcs_rom, 0, settings_current.rom_didaktik80, settings_default.rom_didaktik80, ROM_SIZE ) ) { settings_current.didaktik80 = 0; periph_activate_type( PERIPH_TYPE_DIDAKTIK80, 0 ); return; } ui_menu_activate( UI_MENU_ITEM_MACHINE_DIDAKTIK80_SNAP, 1 ); for( i = 0; i < MEMORY_PAGES_IN_2K; i++ ) { struct memory_page *page = &didaktik_memory_map_romcs_ram[ i ]; page->page = ram + i * MEMORY_PAGE_SIZE; page->offset = i * MEMORY_PAGE_SIZE; page->writable = 1; } machine_current->ram.romcs = 0; aux_register = 0; didaktik80_available = 1; if( hard_reset ) memset( ram, 0, sizeof( ram ) ); wd_fdc_master_reset( didaktik_fdc ); for( i = 0; i < DIDAKTIK80_NUM_DRIVES; i++ ) { ui_media_drive_update_menus( &didaktik_ui_drives[ i ], UI_MEDIA_DRIVE_UPDATE_ALL ); } didaktik_fdc->current_drive = &didaktik_drives[ 0 ]; fdd_select( &didaktik_drives[ 0 ], 1 ); fdd_select( &didaktik_drives[ 1 ], 0 ); machine_current->memory_map(); }
static void plusd_reset( int hard_reset ) { int i; plusd_active = 0; plusd_available = 0; if( !periph_is_active( PERIPH_TYPE_PLUSD ) ) { return; } if( machine_load_rom_bank( plusd_memory_map_romcs_rom, 0, settings_current.rom_plusd, settings_default.rom_plusd, 0x2000 ) ) { settings_current.plusd = 0; periph_activate_type( PERIPH_TYPE_PLUSD, 0 ); return; } machine_current->ram.romcs = 0; for( i = 0; i < MEMORY_PAGES_IN_8K; i++ ) { plusd_memory_map_romcs_ram[ i ].page = &plusd_ram[ i * MEMORY_PAGE_SIZE ]; plusd_memory_map_romcs_ram[ i ].writable = 1; } plusd_available = 1; plusd_active = 1; if( hard_reset ) memset( plusd_ram, 0, 0x2000 ); wd_fdc_master_reset( plusd_fdc ); for( i = 0; i < PLUSD_NUM_DRIVES; i++ ) { ui_media_drive_update_menus( &plusd_ui_drives[ i ], UI_MEDIA_DRIVE_UPDATE_ALL ); } plusd_fdc->current_drive = &plusd_drives[ 0 ]; fdd_select( &plusd_drives[ 0 ], 1 ); machine_current->memory_map(); ui_statusbar_update( UI_STATUSBAR_ITEM_DISK, UI_STATUSBAR_STATE_INACTIVE ); }
static int pentagon_reset(void) { int error; int i; error = machine_load_rom( 0, 0, settings_current.rom_pentagon512_0, settings_default.rom_pentagon512_0, 0x4000 ); if( error ) return error; error = machine_load_rom( 2, 1, settings_current.rom_pentagon512_1, settings_default.rom_pentagon512_1, 0x4000 ); if( error ) return error; error = machine_load_rom( 4, 2, settings_current.rom_pentagon512_3, settings_default.rom_pentagon512_3, 0x4000 ); if( error ) return error; error = machine_load_rom_bank( beta_memory_map_romcs, 0, 0, settings_current.rom_pentagon512_2, settings_default.rom_pentagon512_2, 0x4000 ); if( error ) return error; error = spec128_common_reset( 0 ); if( error ) return error; error = periph_setup( pentagon_peripherals, pentagon_peripherals_count ); if( error ) return error; periph_setup_kempston( PERIPH_PRESENT_OPTIONAL ); periph_setup_beta128( PERIPH_PRESENT_ALWAYS ); periph_update(); beta_builtin = 1; beta_active = 1; machine_current->ram.last_byte2 = 0; machine_current->ram.special = 0; /* Mark the least 384K as present/writeable */ for( i = 16; i < 64; i++ ) memory_map_ram[i].writable = 1; spec48_common_display_setup(); return 0; }
static void usource_reset( int hard_reset GCC_UNUSED ) { usource_active = 0; usource_available = 0; if( !periph_is_active( PERIPH_TYPE_USOURCE ) ) return; if( machine_load_rom_bank( usource_memory_map_romcs, 0, settings_current.rom_usource, settings_default.rom_usource, 0x2000 ) ) { settings_current.usource = 0; periph_activate_type( PERIPH_TYPE_USOURCE, 0 ); return; } machine_current->ram.romcs = 0; usource_available = 1; }