diff --git a/src/mess/drivers/aim65.c b/src/mess/drivers/aim65.c index 96a84d49991..54e610d8afb 100644 --- a/src/mess/drivers/aim65.c +++ b/src/mess/drivers/aim65.c @@ -146,8 +146,8 @@ INPUT_PORTS_END int aim65_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *slot_tag) { - UINT32 size = slot->common_get_size("rom"); - + UINT32 size = slot->common_get_size(slot_tag); + if (size > 0x1000) { image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); diff --git a/src/mess/drivers/pegasus.c b/src/mess/drivers/pegasus.c index 9e9eea371fd..e75c8b8dad4 100644 --- a/src/mess/drivers/pegasus.c +++ b/src/mess/drivers/pegasus.c @@ -33,7 +33,6 @@ hardware. TO DO: - - Identify which rom slots the multi-rom programs should be fitted to. - Work on the other non-working programs ****************************************************************************/ @@ -41,9 +40,10 @@ #include "emu.h" #include "cpu/m6809/m6809.h" #include "machine/6821pia.h" -#include "imagedev/cartslot.h" #include "imagedev/cassette.h" #include "sound/wave.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" @@ -56,12 +56,22 @@ public: m_cass(*this, "cassette"), m_pia_s(*this, "pia_s"), m_pia_u(*this, "pia_u"), + m_exp_00(*this, "exp00"), + m_exp_01(*this, "exp01"), + m_exp_02(*this, "exp02"), + m_exp_0c(*this, "exp0c"), + m_exp_0d(*this, "exp0d"), m_p_videoram(*this, "p_videoram"){ } required_device m_maincpu; required_device m_cass; required_device m_pia_s; required_device m_pia_u; + required_device m_exp_00; + required_device m_exp_01; + required_device m_exp_02; + required_device m_exp_0c; + required_device m_exp_0d; DECLARE_READ8_MEMBER( pegasus_keyboard_r ); DECLARE_READ8_MEMBER( pegasus_protection_r ); DECLARE_READ8_MEMBER( pegasus_pcg_r ); @@ -84,12 +94,14 @@ public: UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_DRIVER_INIT(pegasus); TIMER_DEVICE_CALLBACK_MEMBER(pegasus_firq); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pegasus_cart_1); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pegasus_cart_2); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pegasus_cart_3); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pegasus_cart_4); - DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pegasus_cart_5); - void pegasus_decrypt_rom( UINT16 addr ); + void pegasus_decrypt_rom(UINT8 *ROM); + + int load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag); + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp00_load) { return load_cart(image, m_exp_00, "0000"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp01_load) { return load_cart(image, m_exp_01, "1000"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp02_load) { return load_cart(image, m_exp_02, "2000"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp0c_load) { return load_cart(image, m_exp_0c, "c000"); } + DECLARE_DEVICE_IMAGE_LOAD_MEMBER(exp0d_load) { return load_cart(image, m_exp_0d, "d000"); } }; TIMER_DEVICE_CALLBACK_MEMBER(pegasus_state::pegasus_firq) @@ -171,10 +183,10 @@ READ8_MEMBER( pegasus_state::pegasus_protection_r ) static ADDRESS_MAP_START(pegasus_mem, AS_PROGRAM, 8, pegasus_state) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x2fff) AM_ROM + //AM_RANGE(0x0000, 0x2fff) // mapped by the cartslots 1-3 AM_RANGE(0xb000, 0xbdff) AM_RAM AM_RANGE(0xbe00, 0xbfff) AM_RAM AM_SHARE("p_videoram") - AM_RANGE(0xc000, 0xdfff) AM_ROM AM_WRITENOP + //AM_RANGE(0xc000, 0xdfff) // mapped by the cartslots 4-5 AM_RANGE(0xe000, 0xe1ff) AM_READ(pegasus_protection_r) AM_RANGE(0xe200, 0xe3ff) AM_READWRITE(pegasus_pcg_r,pegasus_pcg_w) AM_RANGE(0xe400, 0xe403) AM_MIRROR(0x1fc) AM_DEVREADWRITE("pia_u", pia6821_device, read, write) @@ -377,68 +389,77 @@ GFXDECODE_END /* An encrypted single rom starts with 02, decrypted with 20. Not sure what multipart roms will have. */ -void pegasus_state::pegasus_decrypt_rom( UINT16 addr ) +void pegasus_state::pegasus_decrypt_rom(UINT8 *ROM) { - UINT8 b, *ROM = memregion("maincpu")->base(); - UINT16 i, j; - UINT8 buff[0x1000]; - if (ROM[addr] == 0x02) + UINT8 b; + UINT16 j; + dynamic_buffer temp_copy; + temp_copy.resize(0x1000); + + if (ROM[0] == 0x02) { - for (i = 0; i < 0x1000; i++) + for (int i = 0; i < 0x1000; i++) { - b = ROM[addr|i]; - j = BITSWAP16( i, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 7 ); - b = BITSWAP8( b, 3, 2, 1, 0, 7, 6, 5, 4 ); - buff[j&0xfff] = b; + b = ROM[i]; + j = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 7); + b = BITSWAP8(b, 3, 2, 1, 0, 7, 6, 5, 4); + temp_copy[j & 0xfff] = b; } - for (i = 0; i < 0x1000; i++) - ROM[addr|i] = buff[i]; + memcpy(ROM, temp_copy, 0x1000); } } -DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_1 ) +int pegasus_state::load_cart(device_image_interface &image, generic_slot_device *slot, const char *reg_tag) { - image.fread(memregion("maincpu")->base() + 0x0000, 0x1000); - pegasus_decrypt_rom( 0x0000 ); + UINT32 size = slot->common_get_size(reg_tag); + bool any_socket = false; + + if (size > 0x1000) + { + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); + return IMAGE_INIT_FAIL; + } + + if (image.software_entry() != NULL && size == 0) + { + // we might be loading a cart compatible with all sockets! + // so try to get region "rom" + printf("universal\n"); + size = slot->common_get_size("rom"); + any_socket = true; - return IMAGE_INIT_PASS; -} - -DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_2 ) -{ - image.fread(memregion("maincpu")->base() + 0x1000, 0x1000); - pegasus_decrypt_rom( 0x1000 ); - - return IMAGE_INIT_PASS; -} - -DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_3 ) -{ - image.fread(memregion("maincpu")->base() + 0x2000, 0x1000); - pegasus_decrypt_rom( 0x2000 ); - - return IMAGE_INIT_PASS; -} - -DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_4 ) -{ - image.fread(memregion("maincpu")->base() + 0xc000, 0x1000); - pegasus_decrypt_rom( 0xc000 ); - - return IMAGE_INIT_PASS; -} - -DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_5 ) -{ - image.fread(memregion("maincpu")->base() + 0xd000, 0x1000); - pegasus_decrypt_rom( 0xd000 ); + if (size == 0) + { + astring errmsg; + errmsg.printf("Attempted to load a file that does not work in this socket.\nPlease check \"Usage\" field in the software list for the correct socket(s) to use."); + image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.cstr()); + return IMAGE_INIT_FAIL; + } + } + slot->rom_alloc(0x1000, 1); // we alloc 0x1000 also for smaller roms! + slot->common_load_rom(slot->get_rom_base(), size, any_socket ? "rom" : reg_tag); + + // raw images have to be decrypted + pegasus_decrypt_rom(slot->get_rom_base()); + return IMAGE_INIT_PASS; } void pegasus_state::machine_start() { m_p_pcgram = memregion("pcg")->base(); + + if (m_exp_00->cart_mounted()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x0fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_00)); + if (m_exp_01->cart_mounted()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000, 0x1fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_01)); + if (m_exp_02->cart_mounted()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x2fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_02)); + if (m_exp_0c->cart_mounted()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0xc000, 0xcfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_0c)); + if (m_exp_0d->cart_mounted()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0xd000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_exp_0d)); } void pegasus_state::machine_reset() @@ -448,9 +469,11 @@ void pegasus_state::machine_reset() m_control_bits = 0; } -DRIVER_INIT_MEMBER(pegasus_state,pegasus) +DRIVER_INIT_MEMBER(pegasus_state, pegasus) { - pegasus_decrypt_rom( 0xf000 ); + // decrypt monitor + UINT8 *base = memregion("maincpu")->base() + 0xf000; + pegasus_decrypt_rom(base); } static MACHINE_CONFIG_START( pegasus, pegasus_state ) @@ -488,27 +511,30 @@ static MACHINE_CONFIG_START( pegasus, pegasus_state ) MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - MCFG_DEVICE_ADD( "pia_u", PIA6821, 0) + MCFG_DEVICE_ADD("pia_u", PIA6821, 0) MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6809e_device, irq_line)) - MCFG_CARTSLOT_ADD("cart1") - MCFG_CARTSLOT_EXTENSION_LIST("bin") - MCFG_CARTSLOT_LOAD(pegasus_state,pegasus_cart_1) - MCFG_CARTSLOT_ADD("cart2") - MCFG_CARTSLOT_EXTENSION_LIST("bin") - MCFG_CARTSLOT_LOAD(pegasus_state,pegasus_cart_2) - MCFG_CARTSLOT_ADD("cart3") - MCFG_CARTSLOT_EXTENSION_LIST("bin") - MCFG_CARTSLOT_LOAD(pegasus_state,pegasus_cart_3) - MCFG_CARTSLOT_ADD("cart4") - MCFG_CARTSLOT_EXTENSION_LIST("bin") - MCFG_CARTSLOT_LOAD(pegasus_state,pegasus_cart_4) - MCFG_CARTSLOT_ADD("cart5") - MCFG_CARTSLOT_EXTENSION_LIST("bin") - MCFG_CARTSLOT_LOAD(pegasus_state,pegasus_cart_5) - MCFG_CASSETTE_ADD( "cassette" ) + MCFG_GENERIC_SOCKET_ADD("exp00", GENERIC_ROM8_WIDTH, generic_plain_slot, "pegasus_cart") + MCFG_GENERIC_LOAD(pegasus_state, exp00_load) + + MCFG_GENERIC_SOCKET_ADD("exp01", GENERIC_ROM8_WIDTH, generic_plain_slot, "pegasus_cart") + MCFG_GENERIC_LOAD(pegasus_state, exp01_load) + + MCFG_GENERIC_SOCKET_ADD("exp02", GENERIC_ROM8_WIDTH, generic_plain_slot, "pegasus_cart") + MCFG_GENERIC_LOAD(pegasus_state, exp02_load) + + MCFG_GENERIC_SOCKET_ADD("exp0c", GENERIC_ROM8_WIDTH, generic_plain_slot, "pegasus_cart") + MCFG_GENERIC_LOAD(pegasus_state, exp0c_load) + + MCFG_GENERIC_SOCKET_ADD("exp0d", GENERIC_ROM8_WIDTH, generic_plain_slot, "pegasus_cart") + MCFG_GENERIC_LOAD(pegasus_state, exp0d_load) + + MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED|CASSETTE_MOTOR_ENABLED) + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "pegasus_cart") MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( pegasusm, pegasus ) diff --git a/src/mess/drivers/pencil2.c b/src/mess/drivers/pencil2.c index 8b577bf15a6..0d730c98d8e 100644 --- a/src/mess/drivers/pencil2.c +++ b/src/mess/drivers/pencil2.c @@ -38,17 +38,11 @@ U14-21 TMM416P-3 (4116-3 16k x 1bit dynamic RAM) U22 74LS05 U23-24 SN74LS541 -BASIC CART PEN-700 11-50332-31 Rev.0 -SD-BASIC VERSION 2.0 FOR PENCIL II -(c) 1983 SOUNDIC ELECTRONICS LTD HONG KONG ALL RIGHTS RESERVED + +SD-BASIC usage: All commands must be in uppercase, which is the default at boot. The 'capslock' is done by pressing Shift and Esc together, and the cursor will change to a checkerboard pattern. -1 x 2732 -2 x 2764 -The roms were dumped by attaching a cable from the printer port to -a Super-80 and writing programs in Basic to transfer the bytes. -Therefore it is not known which rom "202" or "203" is which address range. MEMORY MAP @@ -61,17 +55,9 @@ The 16k dynamic RAM holds the BASIC program and the video/gfx etc but is banked out of view of a BASIC program. -KNOWN CARTS -SD-BASIC V1.0 -SD-BASIC V2.0 -Zaxxon -Smurf - - ToDo: - Cassette isn't working - Joysticks (no info) -- Cart slot (only 1 cart has been dumped, so probably no point coding it) ****************************************************************************/ @@ -80,9 +66,10 @@ ToDo: #include "video/tms9928a.h" #include "sound/sn76496.h" #include "bus/centronics/ctronics.h" -//#include "imagedev/cartslot.h" #include "imagedev/cassette.h" #include "sound/wave.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" class pencil2_state : public driver_device @@ -93,6 +80,7 @@ public: , m_maincpu(*this, "maincpu") , m_centronics(*this, "centronics") , m_cass(*this, "cassette") + , m_cart(*this, "cartslot") {} DECLARE_WRITE8_MEMBER(port10_w); @@ -105,20 +93,21 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(printer_ready_r); DECLARE_CUSTOM_INPUT_MEMBER(printer_ack_r); private: - virtual void machine_reset(); + virtual void machine_start(); int m_centronics_busy; int m_centronics_ack; required_device m_maincpu; required_device m_centronics; required_device m_cass; + required_device m_cart; }; static ADDRESS_MAP_START(pencil2_mem, AS_PROGRAM, 8, pencil2_state) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0x5FFF) AM_WRITENOP // stop error log filling up + AM_RANGE(0x2000, 0x5fff) AM_WRITENOP // stop error log filling up AM_RANGE(0x6000, 0x67ff) AM_MIRROR(0x1800) AM_RAM - AM_RANGE(0x8000, 0xffff) AM_ROM + //AM_RANGE(0x8000, 0xffff) // mapped by the cartslot ADDRESS_MAP_END static ADDRESS_MAP_START(pencil2_io, AS_IO, 8, pencil2_state) @@ -283,8 +272,10 @@ static INPUT_PORTS_START( pencil2 ) INPUT_PORTS_END -void pencil2_state::machine_reset() +void pencil2_state::machine_start() { + if (m_cart->cart_mounted()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x8000, 0xffff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); } static MACHINE_CONFIG_START( pencil2, pencil2_state ) @@ -310,11 +301,7 @@ static MACHINE_CONFIG_START( pencil2, pencil2_state ) MCFG_CASSETTE_ADD( "cassette" ) /* cartridge */ -// MCFG_CARTSLOT_ADD("cart") -// MCFG_CARTSLOT_EXTENSION_LIST("rom") -// MCFG_CARTSLOT_NOT_MANDATORY -// MCFG_CARTSLOT_LOAD(pencil2_cart) -// MCFG_CARTSLOT_INTERFACE("pencil2_cart") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", GENERIC_ROM8_WIDTH, generic_plain_slot, "pencil2_cart") /* printer */ MCFG_CENTRONICS_ADD("centronics", centronics_printers, "printer") @@ -322,17 +309,15 @@ static MACHINE_CONFIG_START( pencil2, pencil2_state ) MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(pencil2_state, write_centronics_busy)) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") + + /* Software lists */ + MCFG_SOFTWARE_LIST_ADD("cart_list", "pencil2") MACHINE_CONFIG_END /* ROM definition */ ROM_START( pencil2 ) ROM_REGION(0x10000, "maincpu", 0) ROM_LOAD( "mt.u4", 0x0000, 0x2000, CRC(338d7b59) SHA1(2f89985ac06971e00210ff992bf1e30a296d10e7) ) - ROM_LOAD( "1-or", 0xa000, 0x1000, CRC(1ddedccd) SHA1(5fc0d30b5997224b67bf286725468194359ced5a) ) - ROM_RELOAD( 0xb000, 0x1000 ) - ROM_LOAD( "203", 0x8000, 0x2000, CRC(f502175c) SHA1(cb2190e633e98586758008577265a7a2bc088233) ) - ROM_LOAD( "202", 0xc000, 0x2000, CRC(5171097d) SHA1(171999bc04dc98c74c0722b2866310d193dc0f82) ) -// ROM_CART_LOAD("cart", 0x8000, 0x8000, ROM_OPTIONAL) ROM_END /* Driver */ diff --git a/src/mess/drivers/sorcerer.c b/src/mess/drivers/sorcerer.c index 789479ed52d..3e0805d0325 100644 --- a/src/mess/drivers/sorcerer.c +++ b/src/mess/drivers/sorcerer.c @@ -163,7 +163,8 @@ static ADDRESS_MAP_START( sorcerer_mem, AS_PROGRAM, 8, sorcerer_state) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x07ff) AM_RAMBANK("boot") AM_RANGE(0x0800, 0xbfff) AM_RAM - AM_RANGE(0xc000, 0xefff) AM_ROM /* rom pac and bios */ + //AM_RANGE(0xc000, 0xdfff) // mapped by the cartslot + AM_RANGE(0xe000, 0xefff) AM_ROM /* rom pac and bios */ AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_REGION("maincpu", 0xf000) /* screen ram */ AM_RANGE(0xf800, 0xfbff) AM_ROM /* char rom */ AM_RANGE(0xfc00, 0xffff) AM_RAM AM_REGION("maincpu", 0xfc00) /* programmable chars */ @@ -175,7 +176,8 @@ static ADDRESS_MAP_START( sorcererd_mem, AS_PROGRAM, 8, sorcerer_state) AM_RANGE(0x0800, 0xbbff) AM_RAM AM_RANGE(0xbc00, 0xbcff) AM_ROM AM_RANGE(0xbe00, 0xbe03) AM_DEVREADWRITE("fdc", micropolis_device, read, write) - AM_RANGE(0xc000, 0xefff) AM_ROM /* rom pac and bios */ + //AM_RANGE(0xc000, 0xdfff) // mapped by the cartslot + AM_RANGE(0xe000, 0xefff) AM_ROM /* rom pac and bios */ AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_REGION("maincpu", 0xf000) /* screen ram */ AM_RANGE(0xf800, 0xfbff) AM_ROM /* char rom */ AM_RANGE(0xfc00, 0xffff) AM_RAM AM_REGION("maincpu", 0xfc00) /* programmable chars */ @@ -400,7 +402,6 @@ static MACHINE_CONFIG_START( sorcerer, sorcerer_state ) MCFG_CPU_PROGRAM_MAP(sorcerer_mem) MCFG_CPU_IO_MAP(sorcerer_io) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(50) @@ -449,9 +450,8 @@ static MACHINE_CONFIG_START( sorcerer, sorcerer_state ) MCFG_CASSETTE_INTERFACE("sorcerer_cass") /* cartridge */ - MCFG_CARTSLOT_ADD("cart") - MCFG_CARTSLOT_EXTENSION_LIST("rom,bin") - MCFG_CARTSLOT_INTERFACE("sorcerer_cart") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", GENERIC_ROM8_WIDTH, generic_plain_slot, "sorcerer_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom") /* software lists */ MCFG_SOFTWARE_LIST_ADD("cart_list","sorcerer_cart") @@ -477,7 +477,7 @@ static MACHINE_CONFIG_DERIVED( sorcererd, sorcerer ) MACHINE_CONFIG_END -DRIVER_INIT_MEMBER(sorcerer_state,sorcerer) +DRIVER_INIT_MEMBER(sorcerer_state, sorcerer) { UINT8 *RAM = memregion("maincpu")->base(); membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xe000); @@ -493,7 +493,6 @@ ROM_START(sorcerer) ROM_LOAD("exmo1-1.dat", 0xe000, 0x0800, CRC(ac924f67) SHA1(72fcad6dd1ed5ec0527f967604401284d0e4b6a1) ) /* monitor roms */ ROM_LOAD("exmo1-2.dat", 0xe800, 0x0800, CRC(ead1d0f6) SHA1(c68bed7344091bca135e427b4793cc7d49ca01be) ) ROM_LOAD("exchr-1.dat", 0xf800, 0x0400, CRC(4a7e1cdd) SHA1(2bf07a59c506b6e0c01ec721fb7b747b20f5dced) ) /* char rom */ - ROM_CART_LOAD("cart", 0xc000, 0x2000, ROM_OPTIONAL) ROM_END ROM_START(sorcererd) @@ -502,7 +501,6 @@ ROM_START(sorcererd) ROM_LOAD("exmo1-1.dat", 0xe000, 0x0800, CRC(ac924f67) SHA1(72fcad6dd1ed5ec0527f967604401284d0e4b6a1) ) /* monitor roms */ ROM_LOAD("exmo1-2.dat", 0xe800, 0x0800, CRC(ead1d0f6) SHA1(c68bed7344091bca135e427b4793cc7d49ca01be) ) ROM_LOAD("exchr-1.dat", 0xf800, 0x0400, CRC(4a7e1cdd) SHA1(2bf07a59c506b6e0c01ec721fb7b747b20f5dced) ) /* char rom */ - ROM_CART_LOAD("cart", 0xc000, 0x2000, ROM_OPTIONAL) ROM_REGION( 0x200, "proms", 0 ) ROM_LOAD_OPTIONAL("bruce.dat", 0x0000, 0x0020, CRC(fae922cb) SHA1(470a86844cfeab0d9282242e03ff1d8a1b2238d1) ) /* video prom */ diff --git a/src/mess/drivers/sv8000.c b/src/mess/drivers/sv8000.c index 8ee62b23aa6..b7bc6631783 100644 --- a/src/mess/drivers/sv8000.c +++ b/src/mess/drivers/sv8000.c @@ -27,10 +27,11 @@ Looking at the code of the cartridges it seems there is: #include "emu.h" #include "cpu/z80/z80.h" -#include "imagedev/cartslot.h" #include "machine/i8255.h" #include "sound/ay8910.h" #include "video/mc6847.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" class sv8000_state : public driver_device @@ -40,6 +41,7 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_s68047p(*this, "s68047p") + , m_cart(*this, "cartslot") , m_videoram(*this, "videoram") , m_io_row0(*this, "ROW0") , m_io_row1(*this, "ROW1") @@ -69,6 +71,7 @@ private: required_device m_maincpu; required_device m_s68047p; + required_device m_cart; required_shared_ptr m_videoram; required_ioport m_io_row0; required_ioport m_io_row1; @@ -91,7 +94,7 @@ private: static ADDRESS_MAP_START(sv8000_mem, AS_PROGRAM, 8, sv8000_state) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x0fff ) AM_ROM + //AM_RANGE(0x0000, 0x0fff) // mapped by the cartslot AM_RANGE( 0x8000, 0x83ff ) AM_RAM // Work RAM?? AM_RANGE( 0xc000, 0xcbff ) AM_RAM AM_SHARE("videoram") ADDRESS_MAP_END @@ -170,6 +173,9 @@ void sv8000_state::machine_start() m_intext = 0; m_inv = 0; + if (m_cart->cart_mounted()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0x0fff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + save_item(NAME(m_column)); save_item(NAME(m_ag)); save_item(NAME(m_gm2)); @@ -190,29 +196,17 @@ void sv8000_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER( sv8000_state, cart ) { - UINT8 *cart = memregion("maincpu")->base(); - - if (image.software_entry() == NULL) + UINT32 size = m_cart->common_get_size("rom"); + + if (size != 0x1000) { - UINT32 filesize = image.length(); - - if (filesize != 0x1000) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Incorrect or not support cartridge size"); - return IMAGE_INIT_FAIL; - } - - if (image.fread( cart, filesize) != filesize) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Error loading file"); - return IMAGE_INIT_FAIL; - } + image.seterror(IMAGE_ERROR_UNSPECIFIED, "Incorrect or not support cartridge size"); + return IMAGE_INIT_FAIL; } - else - { - memcpy(cart, image.get_software_region("rom"), image.get_software_region_length("rom")); - } - + + m_cart->rom_alloc(size, 1); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + return IMAGE_INIT_PASS; } @@ -261,7 +255,7 @@ WRITE8_MEMBER( sv8000_state::i8255_portb_w ) READ8_MEMBER( sv8000_state::i8255_portc_r ) { //logerror("i8255_portc_r\n"); - return 0xFF; + return 0xff; } @@ -274,7 +268,7 @@ WRITE8_MEMBER( sv8000_state::i8255_portc_w ) READ8_MEMBER( sv8000_state::ay_port_a_r ) { - UINT8 data = 0xFF; + UINT8 data = 0xff; //logerror("ay_port_a_r\n"); return data; @@ -404,11 +398,9 @@ static MACHINE_CONFIG_START( sv8000, sv8000_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) /* cartridge */ - MCFG_CARTSLOT_ADD("cart") - MCFG_CARTSLOT_EXTENSION_LIST("bin") - MCFG_CARTSLOT_MANDATORY - MCFG_CARTSLOT_LOAD(sv8000_state,cart) - MCFG_CARTSLOT_INTERFACE("sv8000_cart") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", GENERIC_ROM8_WIDTH, generic_plain_slot, "sv8000_cart") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(sv8000_state, cart) /* software lists */ MCFG_SOFTWARE_LIST_ADD("cart_list","sv8000") diff --git a/src/mess/drivers/ti74.c b/src/mess/drivers/ti74.c index fb68c8b4e0a..0f3ca0bcaa8 100644 --- a/src/mess/drivers/ti74.c +++ b/src/mess/drivers/ti74.c @@ -73,7 +73,8 @@ #include "cpu/tms7000/tms7000.h" #include "video/hd44780.h" #include "machine/nvram.h" -#include "imagedev/cartslot.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" #include "ti74.lh" #include "ti95.lh" @@ -85,10 +86,12 @@ public: ti74_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot"), m_battery_inp(*this, "BATTERY") { } required_device m_maincpu; + required_device m_cart; required_ioport m_battery_inp; ioport_port *m_key_matrix[8]; @@ -120,13 +123,7 @@ public: DEVICE_IMAGE_LOAD_MEMBER(ti74_state, ti74_cartridge) { - UINT8* pos = memregion("user1")->base(); - offs_t size; - - if (image.software_entry() == NULL) - size = image.length(); - else - size = image.get_software_region_length("rom"); + UINT32 size = m_cart->common_get_size("rom"); // max size is 32KB if (size > 0x8000) @@ -134,18 +131,10 @@ DEVICE_IMAGE_LOAD_MEMBER(ti74_state, ti74_cartridge) image.seterror(IMAGE_ERROR_UNSPECIFIED, "Invalid file size"); return IMAGE_INIT_FAIL; } - - if (image.software_entry() == NULL) - { - if (image.fread(pos, size) != size) - { - image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read file"); - return IMAGE_INIT_FAIL; - } - } - else - memcpy(pos, image.get_software_region("rom"), size); - + + m_cart->rom_alloc(size, 1); + m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); + return IMAGE_INIT_PASS; } @@ -276,7 +265,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, ti74_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x1000, 0x1001) AM_DEVREADWRITE("hd44780", hd44780_device, read, write) AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("sysram.ic3") - AM_RANGE(0x4000, 0xbfff) AM_ROM AM_REGION("user1", 0) + //AM_RANGE(0x4000, 0xbfff) // mapped by the cartslot AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("sysbank") ADDRESS_MAP_END @@ -507,6 +496,9 @@ void ti74_state::machine_start() for (int i = 0; i < 8; i++) m_key_matrix[i] = ioport(tags[i]); + if (m_cart->cart_mounted()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x4000, 0xbfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); + membank("sysbank")->configure_entries(0, 4, memregion("system")->base(), 0x2000); membank("sysbank")->set_entry(0); @@ -546,11 +538,10 @@ static MACHINE_CONFIG_START( ti74, ti74_state ) MCFG_HD44780_PIXEL_UPDATE_CB(ti74_pixel_update) /* cartridge */ - MCFG_CARTSLOT_ADD("cart") - MCFG_CARTSLOT_EXTENSION_LIST("bin,rom,256") - MCFG_CARTSLOT_NOT_MANDATORY - MCFG_CARTSLOT_LOAD(ti74_state, ti74_cartridge) - MCFG_CARTSLOT_INTERFACE("ti74_cart") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", GENERIC_ROM8_WIDTH, generic_plain_slot, "ti74_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom,256") + MCFG_GENERIC_LOAD(ti74_state, ti74_cartridge) + MCFG_SOFTWARE_LIST_ADD("cart_list", "ti74_cart") MACHINE_CONFIG_END @@ -581,11 +572,10 @@ static MACHINE_CONFIG_START( ti95, ti74_state ) MCFG_HD44780_PIXEL_UPDATE_CB(ti95_pixel_update) /* cartridge */ - MCFG_CARTSLOT_ADD("cart") - MCFG_CARTSLOT_EXTENSION_LIST("bin,rom,256") - MCFG_CARTSLOT_NOT_MANDATORY - MCFG_CARTSLOT_LOAD(ti74_state, ti74_cartridge) - MCFG_CARTSLOT_INTERFACE("ti95_cart") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", GENERIC_ROM8_WIDTH, generic_plain_slot, "ti95_cart") + MCFG_GENERIC_EXTENSIONS("bin,rom,256") + MCFG_GENERIC_LOAD(ti74_state, ti74_cartridge) + //MCFG_SOFTWARE_LIST_ADD("cart_list", "ti95_cart") MACHINE_CONFIG_END @@ -603,8 +593,6 @@ ROM_START( ti74 ) ROM_REGION( 0x8000, "system", 0 ) ROM_LOAD( "hn61256pc93.ic1", 0x0000, 0x8000, CRC(019aaa2f) SHA1(04a1e694a49d50602e45a7834846de4d9f7d587d) ) // system rom, banked - - ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) // cartridge area ROM_END @@ -614,8 +602,6 @@ ROM_START( ti95 ) ROM_REGION( 0x8000, "system", 0 ) ROM_LOAD( "hn61256pc95.ic1", 0x0000, 0x8000, CRC(c46d29ae) SHA1(c653f08590dbc28241a9f5a6c2541641bdb0208b) ) // system rom, banked - - ROM_REGION( 0x8000, "user1", ROMREGION_ERASEFF ) // cartridge area ROM_END diff --git a/src/mess/drivers/uzebox.c b/src/mess/drivers/uzebox.c index ca2952c4775..f052c82fae3 100644 --- a/src/mess/drivers/uzebox.c +++ b/src/mess/drivers/uzebox.c @@ -16,7 +16,8 @@ #include "emu.h" #include "cpu/avr8/avr8.h" #include "sound/dac.h" -#include "imagedev/cartslot.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" // overclocked to 8 * NTSC burst frequency #define MASTER_CLOCK 28618180 @@ -28,11 +29,12 @@ class uzebox_state : public driver_device public: uzebox_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - { - } + m_maincpu(*this, "maincpu"), + m_cart(*this, "cartslot") + { } required_device m_maincpu; + required_device m_cart; DECLARE_READ8_MEMBER(port_a_r); DECLARE_WRITE8_MEMBER(port_a_w); @@ -64,6 +66,9 @@ private: void uzebox_state::machine_start() { machine().first_screen()->register_screen_bitmap(m_bitmap); + + if (m_cart->cart_mounted()) + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0000, 0xffff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); } void uzebox_state::machine_reset() @@ -265,28 +270,24 @@ UINT32 uzebox_state::screen_update_uzebox(screen_device &screen, bitmap_rgb32 &b return 0; } -DEVICE_IMAGE_LOAD_MEMBER(uzebox_state,uzebox_cart) +DEVICE_IMAGE_LOAD_MEMBER(uzebox_state, uzebox_cart) { - UINT8* rom = (UINT8*)(*memregion("maincpu")); - - memset(rom, 0xff, memregion("maincpu")->bytes()); + UINT32 size = m_cart->common_get_size("rom"); + + m_cart->rom_alloc(size, 1); if (image.software_entry() == NULL) { - UINT32 size = image.length(); dynamic_buffer data(size); - image.fread(data, size); if (!strncmp((const char*)&data[0], "UZEBOX", 6)) - memcpy(rom, data + 0x200, size - 0x200); + memcpy(m_cart->get_rom_base(), data + 0x200, size - 0x200); else - memcpy(rom, data, size); + memcpy(m_cart->get_rom_base(), data, size); } else - { - memcpy(rom, image.get_software_region("rom"), image.get_software_region_length("rom")); - } + memcpy(m_cart->get_rom_base(), image.get_software_region("rom"), size); return IMAGE_INIT_PASS; } @@ -323,11 +324,11 @@ static MACHINE_CONFIG_START( uzebox, uzebox_state ) MCFG_SOUND_ADD("dac", DAC, 0) MCFG_SOUND_ROUTE(0, "avr8", 1.00) - MCFG_CARTSLOT_ADD("cart1") - MCFG_CARTSLOT_EXTENSION_LIST("bin,uze") - MCFG_CARTSLOT_MANDATORY - MCFG_CARTSLOT_LOAD(uzebox_state,uzebox_cart) - MCFG_CARTSLOT_INTERFACE("uzebox") + MCFG_GENERIC_CARTSLOT_ADD("cartslot", GENERIC_ROM8_WIDTH, generic_plain_slot, "uzebox") + MCFG_GENERIC_EXTENSIONS("bin,uze") + MCFG_GENERIC_MANDATORY + MCFG_GENERIC_LOAD(uzebox_state, uzebox_cart) + MCFG_SOFTWARE_LIST_ADD("eprom_list","uzebox") MACHINE_CONFIG_END diff --git a/src/mess/includes/sorcerer.h b/src/mess/includes/sorcerer.h index 823e52d1595..9d99c3ae3f4 100644 --- a/src/mess/includes/sorcerer.h +++ b/src/mess/includes/sorcerer.h @@ -15,13 +15,14 @@ #include "bus/centronics/ctronics.h" #include "bus/centronics/covox.h" #include "machine/ram.h" -#include "imagedev/cartslot.h" #include "imagedev/cassette.h" #include "imagedev/snapquik.h" #include "imagedev/flopdrv.h" #include "formats/sorc_dsk.h" #include "formats/sorc_cas.h" #include "machine/micropolis.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" #define SORCERER_USING_RS232 0 @@ -58,6 +59,7 @@ public: , m_wave2(*this, WAVE2_TAG) , m_uart(*this, "uart") , m_centronics(*this, "centronics") + , m_cart(*this, "cartslot") , m_ram(*this, RAM_TAG) , m_iop_config(*this, "CONFIG") , m_iop_vs(*this, "VS") @@ -96,6 +98,7 @@ private: required_device m_wave2; required_device m_uart; required_device m_centronics; + required_device m_cart; required_device m_ram; required_ioport m_iop_config; required_ioport m_iop_vs; diff --git a/src/mess/machine/sorcerer.c b/src/mess/machine/sorcerer.c index 446a7a634b0..7c47d5d6b72 100644 --- a/src/mess/machine/sorcerer.c +++ b/src/mess/machine/sorcerer.c @@ -372,6 +372,9 @@ void sorcerer_state::machine_start() space.unmap_readwrite(0x8000, endmem); break; } + + if (m_cart->cart_mounted()) + space.install_read_handler(0xc000, 0xdfff, read8_delegate(FUNC(generic_slot_device::read_rom),(generic_slot_device*)m_cart)); } MACHINE_START_MEMBER(sorcerer_state,sorcererd)