diff options
author | Robbbert <Robbbert@users.noreply.github.com> | 2021-04-30 18:42:05 +1000 |
---|---|---|
committer | Robbbert <Robbbert@users.noreply.github.com> | 2021-04-30 18:42:05 +1000 |
commit | 6c7c3a3388ccee34ee5c98c88414941837fc2a9c (patch) | |
tree | 5eb725b593b8e2364a7b79d5e36737239e87fdfb | |
parent | e33183fc28d8c36ca6bf9275bd1366d2e1a6570b (diff) |
mbee: merged the quickloads
-rw-r--r-- | src/mame/drivers/mbee.cpp | 7 | ||||
-rw-r--r-- | src/mame/includes/mbee.h | 3 | ||||
-rw-r--r-- | src/mame/machine/mbee.cpp | 84 |
3 files changed, 43 insertions, 51 deletions
diff --git a/src/mame/drivers/mbee.cpp b/src/mame/drivers/mbee.cpp index 9471e64e55c..845124e1be8 100644 --- a/src/mame/drivers/mbee.cpp +++ b/src/mame/drivers/mbee.cpp @@ -682,8 +682,7 @@ void mbee_state::mbee(machine_config &config) m_crtc->set_on_update_addr_change_callback(FUNC(mbee_state::crtc_update_addr)); m_crtc->out_vsync_callback().set(FUNC(mbee_state::crtc_vs)); - QUICKLOAD(config, "quickload", "mwb,com,bee", attotime::from_seconds(3)).set_load_callback(FUNC(mbee_state::quickload_bee)); - QUICKLOAD(config, "quickload2", "bin", attotime::from_seconds(3)).set_load_callback(FUNC(mbee_state::quickload_bin)); + QUICKLOAD(config, "quickload", "mwb,com,bee,bin", attotime::from_seconds(3)).set_load_callback(FUNC(mbee_state::quickload_cb)); CENTRONICS(config, m_centronics, centronics_devices, nullptr); m_centronics->ack_handler().set(m_pio, FUNC(z80pio_device::strobe_a)); @@ -737,8 +736,7 @@ void mbee_state::mbeeic(machine_config &config) m_crtc->set_on_update_addr_change_callback(FUNC(mbee_state::crtc_update_addr)); m_crtc->out_vsync_callback().set(FUNC(mbee_state::crtc_vs)); - QUICKLOAD(config, "quickload", "mwb,com,bee", attotime::from_seconds(2)).set_load_callback(FUNC(mbee_state::quickload_bee)); - QUICKLOAD(config, "quickload2", "bin", attotime::from_seconds(2)).set_load_callback(FUNC(mbee_state::quickload_bin)); + QUICKLOAD(config, "quickload", "mwb,com,bee,bin", attotime::from_seconds(2)).set_load_callback(FUNC(mbee_state::quickload_cb)); CENTRONICS(config, m_centronics, centronics_devices, "printer"); m_centronics->ack_handler().set(m_pio, FUNC(z80pio_device::strobe_a)); @@ -829,7 +827,6 @@ void mbee_state::mbeett(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &mbee_state::mbeett_mem); m_maincpu->set_addrmap(AS_IO, &mbee_state::mbeett_io); config.device_remove("quickload"); - config.device_remove("quickload2"); TIMER(config, "newkb_timer").configure_periodic(FUNC(mbee_state::newkb_timer), attotime::from_hz(50)); SCC8530(config, "scc", 4000000); // clock unknown } diff --git a/src/mame/includes/mbee.h b/src/mame/includes/mbee.h index d3de5626b73..57379dd3331 100644 --- a/src/mame/includes/mbee.h +++ b/src/mame/includes/mbee.h @@ -115,8 +115,7 @@ private: void premium_palette(palette_device &palette) const; uint32_t screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(newkb_timer); - DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_bee); - DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_bin); + DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb); WRITE_LINE_MEMBER(rtc_irq_w); WRITE_LINE_MEMBER(fdc_intrq_w); WRITE_LINE_MEMBER(fdc_drq_w); diff --git a/src/mame/machine/mbee.cpp b/src/mame/machine/mbee.cpp index 6613a8b63e2..5990c8c17ce 100644 --- a/src/mame/machine/mbee.cpp +++ b/src/mame/machine/mbee.cpp @@ -574,16 +574,44 @@ bit 4,5 : (banking main ram) 0x10 = 128k; 0x20 = 256k Quickload - These load the standard BIN format, as well + This loads the standard BIN format, as well as BEE, COM and MWB files. ************************************************************/ -QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_bee) +QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_cb) { address_space &space = m_maincpu->space(AS_PROGRAM); + bool autorun = BIT(m_io_config->read(), 0); + if (image.is_filetype("bin")) + { + uint16_t execute_address, start_addr, end_addr; + + /* load the binary into memory */ + if (z80bin_load_file(image, space, execute_address, start_addr, end_addr) != image_init_result::PASS) + return image_init_result::FAIL; + + /* is this file executable? */ + if (execute_address != 0xffff) + { + space.write_word(0xa6, execute_address); /* fix the EXEC command */ + + if (autorun) + { + space.write_word(0xa2, execute_address); /* fix warm-start vector to get around some copy-protections */ + m_maincpu->set_pc(execute_address); + } + else + { + space.write_word(0xa2, 0x8517); + } + } + + return image_init_result::PASS; + } + uint16_t i, j; - uint8_t data, sw = m_io_config->read() & 1; /* reading the config switch: 1 = autorun */ + uint8_t data; size_t quickload_size = image.length(); if (image.is_filetype("mwb")) @@ -608,7 +636,7 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_bee) } } - if (sw) + if (autorun) { space.write_word(0xa2,0x801e); /* fix warm-start vector to get around some copy-protections */ m_maincpu->set_pc(0x801e); @@ -616,7 +644,8 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_bee) else space.write_word(0xa2,0x8517); } - else if (image.is_filetype("com")) + else + if (image.is_filetype("com")) { /* com files - most com files are just machine-language games with a wrapper and don't need cp/m to be present */ for (i = 0; i < quickload_size; i++) @@ -638,9 +667,11 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_bee) } } - if (sw) m_maincpu->set_pc(0x100); + if (autorun) + m_maincpu->set_pc(0x100); } - else if (image.is_filetype("bee")) + else + if (image.is_filetype("bee")) { /* bee files - machine-language games that start at 0900 */ for (i = 0; i < quickload_size; i++) @@ -662,45 +693,10 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_bee) } } - if (sw) m_maincpu->set_pc(0x900); - } - - return image_init_result::PASS; -} - - -/*------------------------------------------------- - QUICKLOAD_LOAD_MEMBER( mbee_state::quickload_bin ) --------------------------------------------------*/ - -QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_bin) -{ - uint16_t execute_address, start_addr, end_addr; - int autorun; - address_space &space = m_maincpu->space(AS_PROGRAM); - - /* load the binary into memory */ - if (z80bin_load_file(image, space, execute_address, start_addr, end_addr) != image_init_result::PASS) - return image_init_result::FAIL; - - /* is this file executable? */ - if (execute_address != 0xffff) - { - /* check to see if autorun is on */ - autorun = m_io_config->read() & 1; - - space.write_word(0xa6, execute_address); /* fix the EXEC command */ - if (autorun) - { - space.write_word(0xa2, execute_address); /* fix warm-start vector to get around some copy-protections */ - m_maincpu->set_pc(execute_address); - } - else - { - space.write_word(0xa2, 0x8517); - } + m_maincpu->set_pc(0x900); } return image_init_result::PASS; } + |