mbee: merged the quickloads

This commit is contained in:
Robbbert 2021-04-30 18:42:05 +10:00
parent e33183fc28
commit 6c7c3a3388
3 changed files with 43 additions and 51 deletions

View File

@ -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->set_on_update_addr_change_callback(FUNC(mbee_state::crtc_update_addr));
m_crtc->out_vsync_callback().set(FUNC(mbee_state::crtc_vs)); 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, "quickload", "mwb,com,bee,bin", attotime::from_seconds(3)).set_load_callback(FUNC(mbee_state::quickload_cb));
QUICKLOAD(config, "quickload2", "bin", attotime::from_seconds(3)).set_load_callback(FUNC(mbee_state::quickload_bin));
CENTRONICS(config, m_centronics, centronics_devices, nullptr); CENTRONICS(config, m_centronics, centronics_devices, nullptr);
m_centronics->ack_handler().set(m_pio, FUNC(z80pio_device::strobe_a)); 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->set_on_update_addr_change_callback(FUNC(mbee_state::crtc_update_addr));
m_crtc->out_vsync_callback().set(FUNC(mbee_state::crtc_vs)); 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, "quickload", "mwb,com,bee,bin", attotime::from_seconds(2)).set_load_callback(FUNC(mbee_state::quickload_cb));
QUICKLOAD(config, "quickload2", "bin", attotime::from_seconds(2)).set_load_callback(FUNC(mbee_state::quickload_bin));
CENTRONICS(config, m_centronics, centronics_devices, "printer"); CENTRONICS(config, m_centronics, centronics_devices, "printer");
m_centronics->ack_handler().set(m_pio, FUNC(z80pio_device::strobe_a)); 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_PROGRAM, &mbee_state::mbeett_mem);
m_maincpu->set_addrmap(AS_IO, &mbee_state::mbeett_io); m_maincpu->set_addrmap(AS_IO, &mbee_state::mbeett_io);
config.device_remove("quickload"); config.device_remove("quickload");
config.device_remove("quickload2");
TIMER(config, "newkb_timer").configure_periodic(FUNC(mbee_state::newkb_timer), attotime::from_hz(50)); TIMER(config, "newkb_timer").configure_periodic(FUNC(mbee_state::newkb_timer), attotime::from_hz(50));
SCC8530(config, "scc", 4000000); // clock unknown SCC8530(config, "scc", 4000000); // clock unknown
} }

View File

@ -115,8 +115,7 @@ private:
void premium_palette(palette_device &palette) const; void premium_palette(palette_device &palette) const;
uint32_t screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(newkb_timer); TIMER_DEVICE_CALLBACK_MEMBER(newkb_timer);
DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_bee); DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb);
DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_bin);
WRITE_LINE_MEMBER(rtc_irq_w); WRITE_LINE_MEMBER(rtc_irq_w);
WRITE_LINE_MEMBER(fdc_intrq_w); WRITE_LINE_MEMBER(fdc_intrq_w);
WRITE_LINE_MEMBER(fdc_drq_w); WRITE_LINE_MEMBER(fdc_drq_w);

View File

@ -574,16 +574,44 @@ bit 4,5 : (banking main ram) 0x10 = 128k; 0x20 = 256k
Quickload Quickload
These load the standard BIN format, as well This loads the standard BIN format, as well
as BEE, COM and MWB files. 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); 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; 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(); size_t quickload_size = image.length();
if (image.is_filetype("mwb")) 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 */ space.write_word(0xa2,0x801e); /* fix warm-start vector to get around some copy-protections */
m_maincpu->set_pc(0x801e); m_maincpu->set_pc(0x801e);
@ -616,7 +644,8 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_bee)
else else
space.write_word(0xa2,0x8517); 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 */ /* 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++) 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 */ /* bee files - machine-language games that start at 0900 */
for (i = 0; i < quickload_size; i++) 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) if (autorun)
{ m_maincpu->set_pc(0x900);
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; return image_init_result::PASS;
} }