From 8354ed9be385e630ace026e54f3498968e15bc21 Mon Sep 17 00:00:00 2001 From: Stefano Date: Fri, 23 Mar 2018 00:08:25 +0100 Subject: QuikLoad option on CP/M-80 machines (#3368) * QuickLoad option for the Decisionmate Loads .COM programs in memory if CPM-80 is loaded. Similar to the QuickLoad option for the Kaypro. * QuikLoad on Aussie Byte * QuikLoad on Aussie Byte * Safer QuikLoad on the DMV * Safer QuikLoad on Kaypro * Quikload on the QX-10 * Reverting to resolve conflicts with mamedev * Safer QuikLoad on the DecisionMate V * QuikLoad for the Aussie Byte * QuikLoad for the Epson QX-10 * QuikLoad for the Altos 5 * QuikLoad option for the Xerox 820 * Safer QuikLoad for the KayPro models * QuikLoad for the NCR DecisionMate * QuikLoad option for the Aussie Byte * QuikLoad for the QX-10 * QuikLoad for the Altos 5 * QuikLoad for the Xerox 820 * QuikLoad for the Aussie Byte * QuikLoad for the QX-10 * QuikLoad for the Altos 5 * QuikLoad for the Xerox820 + #3375 --- src/mame/drivers/altos5.cpp | 55 +++++++++++++++++++++++++++++++++++++++++ src/mame/drivers/aussiebyte.cpp | 55 +++++++++++++++++++++++++++++++++++++++++ src/mame/drivers/dmv.cpp | 14 ++++++----- src/mame/drivers/qx10.cpp | 54 ++++++++++++++++++++++++++++++++++++++++ src/mame/drivers/xerox820.cpp | 54 +++++++++++++++++++++++++++++++++++++++- src/mame/includes/aussiebyte.h | 4 +++ src/mame/machine/kaypro.cpp | 25 +++++++++++++------ 7 files changed, 246 insertions(+), 15 deletions(-) diff --git a/src/mame/drivers/altos5.cpp b/src/mame/drivers/altos5.cpp index fbc9ca57083..11c92793108 100644 --- a/src/mame/drivers/altos5.cpp +++ b/src/mame/drivers/altos5.cpp @@ -22,6 +22,9 @@ #include "machine/clock.h" #include "softlist.h" +#include "imagedev/snapquik.h" + + class altos5_state : public driver_device { public: @@ -38,6 +41,8 @@ public: DECLARE_DRIVER_INIT(altos5); void altos5(machine_config &config); + DECLARE_QUICKLOAD_LOAD_MEMBER(altos5); + protected: DECLARE_READ8_MEMBER(memory_read_byte); DECLARE_WRITE8_MEMBER(memory_write_byte); @@ -303,6 +308,55 @@ WRITE8_MEMBER( altos5_state::port09_w ) setup_banks(2); } + +/*********************************************************** + + Quickload + + This loads a .COM file to address 0x100 then jumps + there. Sometimes .COM has been renamed to .CPM to + prevent windows going ballistic. These can be loaded + as well. + +************************************************************/ + +QUICKLOAD_LOAD_MEMBER( altos5_state, altos5 ) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + + if (quickload_size >= 0xfd00) + return image_init_result::FAIL; + + setup_banks(2); + + /* Avoid loading a program if CP/M-80 is not in memory */ + if ((prog_space.read_byte(0) != 0xc3) || (prog_space.read_byte(5) != 0xc3)) + { + machine_reset(); + return image_init_result::FAIL; + } + + /* Load image to the TPA (Transient Program Area) */ + for (uint16_t i = 0; i < quickload_size; i++) + { + uint8_t data; + + if (image.fread( &data, 1) != 1) + return image_init_result::FAIL; + prog_space.write_byte(i+0x100, data); + } + + /* clear out command tail */ + prog_space.write_byte(0x80, 0); prog_space.write_byte(0x81, 0); + + /* Roughly set SP basing on the BDOS position */ + m_maincpu->set_state_int(Z80_SP, 256 * prog_space.read_byte(7) - 300); + m_maincpu->set_pc(0x100); // start program + + return image_init_result::PASS; +} + + static SLOT_INTERFACE_START( altos5_floppies ) SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) SLOT_INTERFACE_END @@ -422,6 +476,7 @@ MACHINE_CONFIG_START(altos5_state::altos5) MCFG_FLOPPY_DRIVE_SOUND(true) MCFG_SOFTWARE_LIST_ADD("flop_list", "altos5") + MCFG_QUICKLOAD_ADD("quickload", altos5_state, altos5, "com,cpm", 3) MACHINE_CONFIG_END diff --git a/src/mame/drivers/aussiebyte.cpp b/src/mame/drivers/aussiebyte.cpp index 3ae6fd6b9fc..d4b7d3e992c 100644 --- a/src/mame/drivers/aussiebyte.cpp +++ b/src/mame/drivers/aussiebyte.cpp @@ -423,6 +423,57 @@ static SLOT_INTERFACE_START( aussiebyte_floppies ) SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) SLOT_INTERFACE_END + +/*********************************************************** + + Quickload + + This loads a .COM file to address 0x100 then jumps + there. Sometimes .COM has been renamed to .CPM to + prevent windows going ballistic. These can be loaded + as well. + +************************************************************/ + +QUICKLOAD_LOAD_MEMBER( aussiebyte_state, aussiebyte ) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + + if (quickload_size >= 0xfd00) + return image_init_result::FAIL; + + /* RAM must be banked in */ + m_port15 = true; // disable boot rom + m_port1a = 4; + membank("bankr0")->set_entry(m_port1a); /* enable correct program bank */ + membank("bankw0")->set_entry(m_port1a); + + /* Avoid loading a program if CP/M-80 is not in memory */ + if ((prog_space.read_byte(0) != 0xc3) || (prog_space.read_byte(5) != 0xc3)) + { + machine_reset(); + return image_init_result::FAIL; + } + + /* Load image to the TPA (Transient Program Area) */ + for (uint16_t i = 0; i < quickload_size; i++) + { + uint8_t data; + if (image.fread( &data, 1) != 1) + return image_init_result::FAIL; + prog_space.write_byte(i+0x100, data); + } + + /* clear out command tail */ + prog_space.write_byte(0x80, 0); prog_space.write_byte(0x81, 0); + + /* Roughly set SP basing on the BDOS position */ + m_maincpu->set_state_int(Z80_SP, 256 * prog_space.read_byte(7) - 0x400); + m_maincpu->set_pc(0x100); // start program + + return image_init_result::PASS; +} + /*********************************************************** Machine Driver @@ -540,6 +591,10 @@ MACHINE_CONFIG_START(aussiebyte_state::aussiebyte) MCFG_MC6845_ADDR_CHANGED_CB(aussiebyte_state, crtc_update_addr) MCFG_MSM5832_ADD("rtc", XTAL(32'768)) + + /* quickload */ + MCFG_QUICKLOAD_ADD("quickload", aussiebyte_state, aussiebyte, "com,cpm", 3) + MACHINE_CONFIG_END diff --git a/src/mame/drivers/dmv.cpp b/src/mame/drivers/dmv.cpp index 3dd61bc823d..84b6e8ca456 100644 --- a/src/mame/drivers/dmv.cpp +++ b/src/mame/drivers/dmv.cpp @@ -387,25 +387,27 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( dmv_state::hgdc_draw_text ) QUICKLOAD_LOAD_MEMBER( dmv_state, dmv ) { - uint16_t i; - uint8_t data; - /* Avoid loading a program if CP/M-80 is not in memory */ - if ((m_ram->base()[0] != 0xc3) && (m_ram->base()[5] != 0xc3)) return image_init_result::FAIL; + if ((m_ram->base()[0] != 0xc3) || (m_ram->base()[5] != 0xc3)) + return image_init_result::FAIL; if (quickload_size >= 0xfd00) return image_init_result::FAIL; /* Load image to the TPA (Transient Program Area) */ - for (i = 0; i < quickload_size; i++) + for (uint16_t i = 0; i < quickload_size; i++) { - if (image.fread( &data, 1) != 1) return image_init_result::FAIL; + uint8_t data; + if (image.fread( &data, 1) != 1) + return image_init_result::FAIL; m_ram->base()[i+0x100] = data; } m_ram->base()[0x80] = m_ram->base()[0x81] = 0; // clear out command tail m_maincpu->set_pc(0x100); // start program + m_maincpu->set_state_int(Z80_SP, 256 * m_ram->base()[7] - 300); // put the stack a bit before BDOS + return image_init_result::PASS; } diff --git a/src/mame/drivers/qx10.cpp b/src/mame/drivers/qx10.cpp index e52a0bfc346..d08236ce272 100644 --- a/src/mame/drivers/qx10.cpp +++ b/src/mame/drivers/qx10.cpp @@ -48,6 +48,7 @@ #include "screen.h" #include "softlist.h" +#include "imagedev/snapquik.h" #define MAIN_CLK 15974400 @@ -131,6 +132,8 @@ public: DECLARE_WRITE_LINE_MEMBER(keyboard_clk); DECLARE_WRITE_LINE_MEMBER(keyboard_irq); + DECLARE_QUICKLOAD_LOAD_MEMBER(qx10); + uint8_t *m_char_rom; /* FDD */ @@ -326,6 +329,54 @@ WRITE8_MEMBER( qx10_state::cmos_sel_w ) update_memory_mapping(); } +/*********************************************************** + + Quickload + + This loads a .COM file to address 0x100 then jumps + there. Sometimes .COM has been renamed to .CPM to + prevent windows going ballistic. These can be loaded + as well. + +************************************************************/ + +QUICKLOAD_LOAD_MEMBER( qx10_state, qx10 ) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + + if (quickload_size >= 0xfd00) + return image_init_result::FAIL; + + /* The right RAM bank must be active */ + m_membank = 0; + update_memory_mapping(); + + /* Avoid loading a program if CP/M-80 is not in memory */ + if ((prog_space.read_byte(0) != 0xc3) || (prog_space.read_byte(5) != 0xc3)) + { + machine_reset(); + return image_init_result::FAIL; + } + + /* Load image to the TPA (Transient Program Area) */ + for (uint16_t i = 0; i < quickload_size; i++) + { + uint8_t data; + if (image.fread( &data, 1) != 1) + return image_init_result::FAIL; + prog_space.write_byte(i+0x100, data); + } + + /* clear out command tail */ + prog_space.write_byte(0x80, 0); prog_space.write_byte(0x81, 0); + + /* Roughly set SP basing on the BDOS position */ + m_maincpu->set_state_int(Z80_SP, 256 * prog_space.read_byte(7) - 300); + m_maincpu->set_pc(0x100); // start program + + return image_init_result::PASS; +} + /* FDD */ @@ -780,6 +831,9 @@ MACHINE_CONFIG_START(qx10_state::qx10) // software lists MCFG_SOFTWARE_LIST_ADD("flop_list", "qx10_flop") + + MCFG_QUICKLOAD_ADD("quickload", qx10_state, qx10, "com,cpm", 3) + MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mame/drivers/xerox820.cpp b/src/mame/drivers/xerox820.cpp index 340ff5a3afc..a83089253ad 100644 --- a/src/mame/drivers/xerox820.cpp +++ b/src/mame/drivers/xerox820.cpp @@ -386,10 +386,60 @@ static const z80_daisy_config xerox820_daisy_chain[] = { nullptr } }; + + +/*********************************************************** + + Quickload + + This loads a .COM file to address 0x100 then jumps + there. Sometimes .COM has been renamed to .CPM to + prevent windows going ballistic. These can be loaded + as well. + +************************************************************/ + +QUICKLOAD_LOAD_MEMBER( xerox820_state, xerox820 ) +{ + address_space& prog_space = m_maincpu->space(AS_PROGRAM); + + if (quickload_size >= 0xfd00) + return image_init_result::FAIL; + + bankswitch(0); + + /* Avoid loading a program if CP/M-80 is not in memory */ + if ((prog_space.read_byte(0) != 0xc3) || (prog_space.read_byte(5) != 0xc3)) + { + machine_reset(); + return image_init_result::FAIL; + } + + /* Load image to the TPA (Transient Program Area) */ + for (uint16_t i = 0; i < quickload_size; i++) + { + uint8_t data; + if (image.fread( &data, 1) != 1) + return image_init_result::FAIL; + prog_space.write_byte(i+0x100, data); + } + + /* clear out command tail */ + prog_space.write_byte(0x80, 0); prog_space.write_byte(0x81, 0); + + /* Roughly set SP basing on the BDOS position */ + m_maincpu->set_state_int(Z80_SP, 256 * prog_space.read_byte(7) - 300); + m_maincpu->set_pc(0x100); // start program + + return image_init_result::PASS; +} + + + /* WD1771 Interface */ static SLOT_INTERFACE_START( xerox820_floppies ) - SLOT_INTERFACE( "sa400", FLOPPY_525_SSSD_35T ) // Shugart SA-400 + SLOT_INTERFACE( "sa400", FLOPPY_525_SSSD ) // Shugart SA-400 SLOT_INTERFACE( "sa450", FLOPPY_525_DD ) // Shugart SA-450 SLOT_INTERFACE( "sa800", FLOPPY_8_SSDD ) // Shugart SA-800 SLOT_INTERFACE( "sa850", FLOPPY_8_DSDD ) // Shugart SA-850 @@ -616,6 +666,7 @@ MACHINE_CONFIG_START(xerox820_state::xerox820) // software lists MCFG_SOFTWARE_LIST_ADD("flop_list", "xerox820") + MCFG_QUICKLOAD_ADD("quickload", xerox820_state, xerox820, "com,cpm", 3) MACHINE_CONFIG_END MACHINE_CONFIG_START(bigboard_state::bigboard) @@ -719,6 +770,7 @@ MACHINE_CONFIG_START(xerox820ii_state::xerox820ii) // software lists MCFG_SOFTWARE_LIST_ADD("flop_list", "xerox820ii") + MCFG_QUICKLOAD_ADD("quickload", xerox820_state, xerox820, "com,cpm", 3) MACHINE_CONFIG_END MACHINE_CONFIG_START(xerox820ii_state::xerox168) diff --git a/src/mame/includes/aussiebyte.h b/src/mame/includes/aussiebyte.h index 9eb9790fcf5..d4299e8b82e 100644 --- a/src/mame/includes/aussiebyte.h +++ b/src/mame/includes/aussiebyte.h @@ -29,6 +29,8 @@ #include "video/mc6845.h" +#include "imagedev/snapquik.h" + /*********************************************************** @@ -62,6 +64,8 @@ public: void aussiebyte(machine_config &config); + DECLARE_QUICKLOAD_LOAD_MEMBER(aussiebyte); + protected: DECLARE_READ8_MEMBER(memory_read_byte); DECLARE_WRITE8_MEMBER(memory_write_byte); diff --git a/src/mame/machine/kaypro.cpp b/src/mame/machine/kaypro.cpp index f41a81b823a..e70d8b802e2 100644 --- a/src/mame/machine/kaypro.cpp +++ b/src/mame/machine/kaypro.cpp @@ -252,21 +252,30 @@ MACHINE_RESET_MEMBER( kaypro_state,kaypro ) QUICKLOAD_LOAD_MEMBER( kaypro_state, kaypro ) { uint8_t *RAM = memregion("rambank")->base(); - uint16_t i; - uint8_t data; + + /* Avoid loading a program if CP/M-80 is not in memory */ + if ((RAM[0] != 0xc3) || (RAM[5] != 0xc3)) + return image_init_result::FAIL; + + if (quickload_size >= 0xfd00) + return image_init_result::FAIL; /* Load image to the TPA (Transient Program Area) */ - for (i = 0; i < quickload_size; i++) + for (uint16_t i = 0; i < quickload_size; i++) { - if (image.fread( &data, 1) != 1) return image_init_result::FAIL; - + uint8_t data; + if (image.fread( &data, 1) != 1) + return image_init_result::FAIL; RAM[i+0x100] = data; } + membank("bankr0")->set_entry(0); membank("bank3")->set_entry(0); - RAM[0x80]=0; // clear out command tail - RAM[0x81]=0; - m_maincpu->set_pc(0x100); // start program + RAM[0x80]=0; RAM[0x81]=0; // clear out command tail + + m_maincpu->set_pc(0x100); // start program + m_maincpu->set_state_int(Z80_SP, 256 * RAM[7] - 300); // put the stack a bit before BDOS + return image_init_result::PASS; } -- cgit v1.2.3