From 2461397c80a126d2c689278d3ab30097561acaf5 Mon Sep 17 00:00:00 2001 From: wilbertpol Date: Mon, 13 Mar 2023 19:35:01 +0000 Subject: bus/msx: Moved Yamaha module and minicart slots into their own folders. (#10984) Also defined MSX cartridge slot options in one place. --- scripts/src/bus.lua | 10 +- src/devices/bus/msx/cart/cartridge.cpp | 224 ++++++++++++++++++++------ src/devices/bus/msx/cart/cartridge.h | 18 ++- src/devices/bus/msx/cart/disk.cpp | 38 ++--- src/devices/bus/msx/cart/ram.cpp | 38 ++--- src/devices/bus/msx/cart/slotexpander.cpp | 1 + src/devices/bus/msx/cart/slotoptions.cpp | 79 ++++++++++ src/devices/bus/msx/cart/slotoptions.h | 82 ++++++++++ src/devices/bus/msx/cart/yamaha.cpp | 158 ------------------- src/devices/bus/msx/cart/yamaha.h | 63 -------- src/devices/bus/msx/cart/yamaha_ucn01.cpp | 1 + src/devices/bus/msx/minicart/minicart.cpp | 35 ++++ src/devices/bus/msx/minicart/minicart.h | 38 +++++ src/devices/bus/msx/module/module.cpp | 38 +++++ src/devices/bus/msx/module/module.h | 66 ++++++++ src/devices/bus/msx/module/sfg.cpp | 158 +++++++++++++++++++ src/devices/bus/msx/module/sfg.h | 63 ++++++++ src/devices/bus/msx/slot/cartridge.cpp | 254 +----------------------------- src/devices/bus/msx/slot/cartridge.h | 84 +++++----- src/mame/msx/msx.h | 3 + 20 files changed, 845 insertions(+), 606 deletions(-) create mode 100644 src/devices/bus/msx/cart/slotoptions.cpp create mode 100644 src/devices/bus/msx/cart/slotoptions.h delete mode 100644 src/devices/bus/msx/cart/yamaha.cpp delete mode 100644 src/devices/bus/msx/cart/yamaha.h create mode 100644 src/devices/bus/msx/minicart/minicart.cpp create mode 100644 src/devices/bus/msx/minicart/minicart.h create mode 100644 src/devices/bus/msx/module/module.cpp create mode 100644 src/devices/bus/msx/module/module.h create mode 100644 src/devices/bus/msx/module/sfg.cpp create mode 100644 src/devices/bus/msx/module/sfg.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 7dbc96e79c1..2d083d46f75 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -1939,16 +1939,22 @@ if (BUSES["MSX_SLOT"]~=null) then MAME_DIR .. "src/devices/bus/msx/cart/rtype.h", MAME_DIR .. "src/devices/bus/msx/cart/slotexpander.cpp", MAME_DIR .. "src/devices/bus/msx/cart/slotexpander.h", + MAME_DIR .. "src/devices/bus/msx/cart/slotoptions.cpp", + MAME_DIR .. "src/devices/bus/msx/cart/slotoptions.h", MAME_DIR .. "src/devices/bus/msx/cart/softcard.cpp", MAME_DIR .. "src/devices/bus/msx/cart/softcard.h", MAME_DIR .. "src/devices/bus/msx/cart/superloderunner.cpp", MAME_DIR .. "src/devices/bus/msx/cart/superloderunner.h", MAME_DIR .. "src/devices/bus/msx/cart/super_swangi.cpp", MAME_DIR .. "src/devices/bus/msx/cart/super_swangi.h", - MAME_DIR .. "src/devices/bus/msx/cart/yamaha.cpp", - MAME_DIR .. "src/devices/bus/msx/cart/yamaha.h", MAME_DIR .. "src/devices/bus/msx/cart/yamaha_ucn01.cpp", MAME_DIR .. "src/devices/bus/msx/cart/yamaha_ucn01.h", + MAME_DIR .. "src/devices/bus/msx/minicart/minicart.cpp", + MAME_DIR .. "src/devices/bus/msx/minicart/minicart.h", + MAME_DIR .. "src/devices/bus/msx/module/module.cpp", + MAME_DIR .. "src/devices/bus/msx/module/module.h", + MAME_DIR .. "src/devices/bus/msx/module/sfg.cpp", + MAME_DIR .. "src/devices/bus/msx/module/sfg.h", MAME_DIR .. "src/devices/bus/msx/softcard/softcard.cpp", MAME_DIR .. "src/devices/bus/msx/softcard/softcard.h", } diff --git a/src/devices/bus/msx/cart/cartridge.cpp b/src/devices/bus/msx/cart/cartridge.cpp index da745073fa9..3f7912c01d6 100644 --- a/src/devices/bus/msx/cart/cartridge.cpp +++ b/src/devices/bus/msx/cart/cartridge.cpp @@ -28,78 +28,198 @@ #include "ram.h" #include "rtype.h" #include "slotexpander.h" +#include "slotoptions.h" #include "softcard.h" #include "superloderunner.h" #include "super_swangi.h" -#include "yamaha.h" #include "yamaha_ucn01.h" #include "bus/msx/slot/cartridge.h" +DEFINE_DEVICE_TYPE(MSX_SLOT_CARTRIDGE, msx_slot_cartridge_device, "msx_slot_cartridge", "MSX Cartridge slot") + + void msx_cart(device_slot_interface &device, bool is_in_subslot) { + using namespace bus::msx::cart; msx_cart_disk_register_options(device); msx_cart_ram_register_options(device); - device.option_add_internal("arc", MSX_CART_ARC); - device.option_add_internal("ascii8", MSX_CART_ASCII8); - device.option_add_internal("ascii8_sram", MSX_CART_ASCII8_SRAM); - device.option_add_internal("ascii16", MSX_CART_ASCII16); - device.option_add_internal("ascii16_sram", MSX_CART_ASCII16_SRAM); - device.option_add_internal("cross_blaim", MSX_CART_CROSSBLAIM); - device.option_add_internal("dooly", MSX_CART_DOOLY); - device.option_add_internal("easispeech", MSX_CART_EASISPEECH); - device.option_add_internal("fmpac", MSX_CART_FMPAC); - device.option_add_internal("fs_sr022", MSX_CART_FS_SR022); - device.option_add_internal("gamemaster2", MSX_CART_GAMEMASTER2); - device.option_add_internal("halnote", MSX_CART_HALNOTE); - device.option_add_internal("hfox", MSX_CART_HFOX); - device.option_add_internal("holy_quran", MSX_CART_HOLY_QURAN); - device.option_add_internal("ink", MSX_CART_INK); - device.option_add_internal("kanji", MSX_CART_KANJI); - device.option_add_internal("keyboard_master", MSX_CART_KEYBOARD_MASTER); - device.option_add_internal("konami", MSX_CART_KONAMI); - device.option_add_internal("konami_scc", MSX_CART_KONAMI_SCC); - device.option_add_internal("korean_80in1", MSX_CART_KOREAN_80IN1); - device.option_add_internal("korean_90in1", MSX_CART_KOREAN_90IN1); - device.option_add_internal("korean_126in1", MSX_CART_KOREAN_126IN1); - device.option_add_internal("majutsushi", MSX_CART_MAJUTSUSHI); - device.option_add_internal("msxaud_fsca1", MSX_CART_MSX_AUDIO_FSCA1); - device.option_add_internal("msxaud_hxmu900", MSX_CART_MSX_AUDIO_HXMU900); - device.option_add_internal("msxaud_nms1205", MSX_CART_MSX_AUDIO_NMS1205); - device.option_add_internal("msxdos2j", MSX_CART_MSXDOS2J); - device.option_add_internal("msxdos2e", MSX_CART_MSXDOS2E); - device.option_add_internal("msxwrite", MSX_CART_MSXWRITE); - device.option_add_internal("nomapper", MSX_CART_NOMAPPER); - device.option_add_internal("rtype", MSX_CART_RTYPE); - device.option_add_internal("sound_snatcher", MSX_CART_SOUND_SNATCHER); - device.option_add_internal("sound_sdsnatch", MSX_CART_SOUND_SDSNATCHER); - device.option_add_internal("super_swangi", MSX_CART_SUPER_SWANGI); - device.option_add_internal("superloderunner", MSX_CART_SUPERLODERUNNER); - device.option_add_internal("synthesizer", MSX_CART_SYNTHESIZER); - device.option_add_internal("ec701", MSX_CART_EC701); - device.option_add("beepack", MSX_CART_BEEPACK); - device.option_add("bm_012", MSX_CART_BM_012); - device.option_add("moonsound", MSX_CART_MOONSOUND); - device.option_add("ucn01", MSX_CART_UCN01); + device.option_add_internal(slotoptions::ARC, MSX_CART_ARC); + device.option_add_internal(slotoptions::ASCII8, MSX_CART_ASCII8); + device.option_add_internal(slotoptions::ASCII8_SRAM, MSX_CART_ASCII8_SRAM); + device.option_add_internal(slotoptions::ASCII16, MSX_CART_ASCII16); + device.option_add_internal(slotoptions::ASCII16_SRAM, MSX_CART_ASCII16_SRAM); + device.option_add_internal(slotoptions::CROSS_BLAIM, MSX_CART_CROSSBLAIM); + device.option_add_internal(slotoptions::DOOLY, MSX_CART_DOOLY); + device.option_add_internal(slotoptions::EASISPEECH, MSX_CART_EASISPEECH); + device.option_add_internal(slotoptions::FMPAC, MSX_CART_FMPAC); + device.option_add_internal(slotoptions::FS_SR022, MSX_CART_FS_SR022); + device.option_add_internal(slotoptions::GAMEMASTER2, MSX_CART_GAMEMASTER2); + device.option_add_internal(slotoptions::HALNOTE, MSX_CART_HALNOTE); + device.option_add_internal(slotoptions::HFOX, MSX_CART_HFOX); + device.option_add_internal(slotoptions::HOLY_QURAN, MSX_CART_HOLY_QURAN); + device.option_add_internal(slotoptions::INK, MSX_CART_INK); + device.option_add_internal(slotoptions::KANJI, MSX_CART_KANJI); + device.option_add_internal(slotoptions::KEYBOARD_MASTER, MSX_CART_KEYBOARD_MASTER); + device.option_add_internal(slotoptions::KONAMI, MSX_CART_KONAMI); + device.option_add_internal(slotoptions::KONAMI_SCC, MSX_CART_KONAMI_SCC); + device.option_add_internal(slotoptions::KOREAN_80IN1, MSX_CART_KOREAN_80IN1); + device.option_add_internal(slotoptions::KOREAN_90IN1, MSX_CART_KOREAN_90IN1); + device.option_add_internal(slotoptions::KOREAN_126IN1, MSX_CART_KOREAN_126IN1); + device.option_add_internal(slotoptions::MAJUSTUSHI, MSX_CART_MAJUTSUSHI); + device.option_add_internal(slotoptions::MSXAUD_FSCA1, MSX_CART_MSX_AUDIO_FSCA1); + device.option_add_internal(slotoptions::MSXAUD_HXMU900, MSX_CART_MSX_AUDIO_HXMU900); + device.option_add_internal(slotoptions::MSXAUD_NMS1205, MSX_CART_MSX_AUDIO_NMS1205); + device.option_add_internal(slotoptions::MSXDOS2J, MSX_CART_MSXDOS2J); + device.option_add_internal(slotoptions::MSXDOS2E, MSX_CART_MSXDOS2E); + device.option_add_internal(slotoptions::MSXWRITE, MSX_CART_MSXWRITE); + device.option_add_internal(slotoptions::NOMAPPER, MSX_CART_NOMAPPER); + device.option_add_internal(slotoptions::RTYPE, MSX_CART_RTYPE); + device.option_add_internal(slotoptions::SOUND_SNATCHER, MSX_CART_SOUND_SNATCHER); + device.option_add_internal(slotoptions::SOUND_SDSNATCH, MSX_CART_SOUND_SDSNATCHER); + device.option_add_internal(slotoptions::SUPER_SWANGI, MSX_CART_SUPER_SWANGI); + device.option_add_internal(slotoptions::SUPERLODERUNNER, MSX_CART_SUPERLODERUNNER); + device.option_add_internal(slotoptions::SYNTHESIZER, MSX_CART_SYNTHESIZER); + device.option_add_internal(slotoptions::EC701, MSX_CART_EC701); + device.option_add(slotoptions::BEEPACK, MSX_CART_BEEPACK); + device.option_add(slotoptions::BM_012, MSX_CART_BM_012); + device.option_add(slotoptions::MOONSOUND, MSX_CART_MOONSOUND); + device.option_add(slotoptions::UCN01, MSX_CART_UCN01); + device.option_add(slotoptions::SOFTCARD, MSX_CART_SOFTCARD); if (!is_in_subslot) { - device.option_add("slotexp", MSX_CART_SLOTEXPANDER); + device.option_add(slotoptions::SLOTEXP, MSX_CART_SLOTEXPANDER); } - device.option_add("softcard", MSX_CART_SOFTCARD); } -// Several yamaha machines had 60 pin expansion slots. The pinouts of these slots was -// exactly the same as the regular 50 pin cartridge slots. The lowest 10 pins are simply -// not connected. -void msx_yamaha_60pin(device_slot_interface &device, bool is_in_subslot) +msx_slot_cartridge_device::msx_slot_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : msx_slot_cartridge_base_device(mconfig, MSX_SLOT_CARTRIDGE, tag, owner, clock) { - device.option_add("sfg01", MSX_CART_SFG01); - device.option_add("sfg05", MSX_CART_SFG05); } -void msx_yamaha_minicart(device_slot_interface &device, bool is_in_subslot) +std::string msx_slot_cartridge_device::get_default_card_software(get_default_card_software_hook &hook) const +{ + using namespace bus::msx::cart; + if (hook.image_file()) + { + // Check if there's some mapper related information in the hashfiles + std::string extrainfo; + if (hook.hashfile_extrainfo(extrainfo)) + { + int extrainfo_type = -1; + if (1 == sscanf(extrainfo.c_str(), "%d", &extrainfo_type)) + { + static const struct {int extrainfo; char const *const mapper;} extrainfo_map[] = { + { 0, slotoptions::NOMAPPER }, + { 1, slotoptions::MSXDOS2E }, + { 2, slotoptions::KONAMI_SCC }, + { 3, slotoptions::KONAMI }, + { 4, slotoptions::ASCII8 }, + { 5, slotoptions::ASCII16 }, + { 6, slotoptions::GAMEMASTER2 }, + { 7, slotoptions::ASCII8_SRAM }, + { 8, slotoptions::ASCII16_SRAM }, + { 9, slotoptions::RTYPE }, + { 10, slotoptions::MAJUSTUSHI }, + { 11, slotoptions::FMPAC }, + { 12, slotoptions::SUPERLODERUNNER }, + { 13, slotoptions::SYNTHESIZER }, + { 14, slotoptions::CROSS_BLAIM }, + { 16, slotoptions::KOREAN_80IN1 }, + { 17, slotoptions::KOREAN_126IN1 } + }; + + for (auto & elem : extrainfo_map) + { + if (elem.extrainfo == extrainfo_type) + { + return std::string(elem.mapper); + } + } + } + } + + // Not identified through hashfile, try automatic detection + u64 length; + if (hook.image_file()->length(length)) + { + osd_printf_warning("[%s] Error getting cartridge ROM length\n", tag()); + return std::string(slotoptions::NOMAPPER); + } + length = std::min(length, 4 * 1024 * 1024); + std::vector rom(length); + size_t actual; + if (hook.image_file()->read(&rom[0], length, actual)) + { + osd_printf_warning("[%s] Error reading from file\n", tag()); + return std::string(slotoptions::NOMAPPER); + } + return std::string(get_cart_type(&rom[0], length)); + } + return software_get_default_slot(bus::msx::cart::slotoptions::NOMAPPER); +} + + +char const *const msx_slot_cartridge_device::get_cart_type(const u8 *rom, u32 length) { - device.option_add_internal("nomapper", MSX_CART_NOMAPPER); + using namespace bus::msx::cart; + if (length < 0x10000) + { + return slotoptions::NOMAPPER; + } + + if ((rom[0x10] == 'Y') && (rom[0x11] == 'Z') && (length > 0x18000)) + { + return slotoptions::GAMEMASTER2; + } + + int kon4 = 0, kon5 = 0, asc8 = 0, asc16 = 0; + + for (int i=0; i < length-3; i++) + { + if (rom[i] == 0x32 && rom[i+1] == 0) + { + switch (rom[i+2]) + { + case 0x60: + case 0x70: + asc16++; + asc8++; + break; + + case 0x68: + case 0x78: + asc8++; + asc16--; + break; + } + + switch (rom[i+2]) + { + case 0x60: + case 0x80: + case 0xa0: + kon4++; + break; + + case 0x50: + case 0x70: + case 0x90: + case 0xb0: + kon5++; + break; + } + } + } + + if (std::max(kon4, kon5) > std::max(asc8, asc16)) + { + return (kon5 > kon4) ? slotoptions::KONAMI_SCC : slotoptions::KONAMI; + } + else + { + return (asc8 > asc16) ? slotoptions::ASCII8 : slotoptions::ASCII16; + } } diff --git a/src/devices/bus/msx/cart/cartridge.h b/src/devices/bus/msx/cart/cartridge.h index fcf2f96ab4b..812b4eccb12 100644 --- a/src/devices/bus/msx/cart/cartridge.h +++ b/src/devices/bus/msx/cart/cartridge.h @@ -5,10 +5,24 @@ #pragma once +#include "bus/msx/slot/cartridge.h" + void msx_cart(device_slot_interface &device, bool is_in_subslot); -void msx_yamaha_60pin(device_slot_interface &device, bool is_in_subslot); // 60 pin expansion slots as found in yamaha machines -void msx_yamaha_minicart(device_slot_interface &device, bool is_in_subslot); // 30 pin mini cartridge slot as found in some yamaha machines +DECLARE_DEVICE_TYPE(MSX_SLOT_CARTRIDGE, msx_slot_cartridge_device) + + +class msx_slot_cartridge_device : public msx_slot_cartridge_base_device +{ +public: + msx_slot_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; + +protected: + static char const *const get_cart_type(const u8 *rom, u32 length); +}; + #endif // MAME_BUS_MSX_CART_CARTRIDGE_H diff --git a/src/devices/bus/msx/cart/disk.cpp b/src/devices/bus/msx/cart/disk.cpp index 029b1fcfea5..227b8d48b19 100644 --- a/src/devices/bus/msx/cart/disk.cpp +++ b/src/devices/bus/msx/cart/disk.cpp @@ -103,6 +103,7 @@ #include "emu.h" #include "disk.h" +#include "slotoptions.h" #include "bus/msx/slot/cartridge.h" #include "imagedev/floppy.h" @@ -137,24 +138,25 @@ DECLARE_DEVICE_TYPE(MSX_CART_VY0010, msx_cart_interface) void msx_cart_disk_register_options(device_slot_interface &device) { - device.option_add_internal("disk_avdpf550", MSX_CART_AVDPF550); - device.option_add_internal("disk_cdx2", MSX_CART_CDX2); - device.option_add_internal("disk_ddx3", MSX_CART_DDX3); - device.option_add_internal("disk_fd03", MSX_CART_FD03); - device.option_add_internal("disk_fd051", MSX_CART_FD051); - device.option_add_internal("disk_fscf351", MSX_CART_FSCF351); - device.option_add_internal("disk_fsfd1", MSX_CART_FSFD1); - device.option_add_internal("disk_fsfd1a", MSX_CART_FSFD1A); - device.option_add_internal("disk_hb3600", MSX_CART_HB3600); - device.option_add_internal("disk_hbd20w", MSX_CART_HBD20W); - device.option_add_internal("disk_hbd50", MSX_CART_HBD50); - device.option_add_internal("disk_hbdf1", MSX_CART_HBDF1); - device.option_add_internal("disk_hxf101pe", MSX_CART_HXF101PE); - device.option_add_internal("disk_mfd001", MSX_CART_MFD001); - device.option_add_internal("disk_ml30dc", MSX_CART_ML30DC); - device.option_add_internal("disk_nms1200", MSX_CART_NMS1200); - device.option_add_internal("disk_tadpf550", MSX_CART_TADPF550); - device.option_add_internal("disk_vy0010", MSX_CART_VY0010); + using namespace bus::msx::cart; + device.option_add_internal(slotoptions::DISK_AVDPF550, MSX_CART_AVDPF550); + device.option_add_internal(slotoptions::DISK_CDX2, MSX_CART_CDX2); + device.option_add_internal(slotoptions::DISK_DDX3, MSX_CART_DDX3); + device.option_add_internal(slotoptions::DISK_FD03, MSX_CART_FD03); + device.option_add_internal(slotoptions::DISK_FD051, MSX_CART_FD051); + device.option_add_internal(slotoptions::DISK_FSCF351, MSX_CART_FSCF351); + device.option_add_internal(slotoptions::DISK_FSFD1, MSX_CART_FSFD1); + device.option_add_internal(slotoptions::DISK_FSFD1A, MSX_CART_FSFD1A); + device.option_add_internal(slotoptions::DISK_HB3600, MSX_CART_HB3600); + device.option_add_internal(slotoptions::DISK_HBD20W, MSX_CART_HBD20W); + device.option_add_internal(slotoptions::DISK_HBD50, MSX_CART_HBD50); + device.option_add_internal(slotoptions::DISK_HBDF1, MSX_CART_HBDF1); + device.option_add_internal(slotoptions::DISK_HXF101PE, MSX_CART_HXF101PE); + device.option_add_internal(slotoptions::DISK_MFD001, MSX_CART_MFD001); + device.option_add_internal(slotoptions::DISK_ML30DC, MSX_CART_ML30DC); + device.option_add_internal(slotoptions::DISK_NMS1200, MSX_CART_NMS1200); + device.option_add_internal(slotoptions::DISK_TADPF550, MSX_CART_TADPF550); + device.option_add_internal(slotoptions::DISK_VY0010, MSX_CART_VY0010); } diff --git a/src/devices/bus/msx/cart/ram.cpp b/src/devices/bus/msx/cart/ram.cpp index 83bafd2c8dd..9b98460df50 100644 --- a/src/devices/bus/msx/cart/ram.cpp +++ b/src/devices/bus/msx/cart/ram.cpp @@ -1,13 +1,5 @@ // license:BSD-3-Clause // copyright-holders:Wilbert Pol -#include "emu.h" -#include "ram.h" - -#include "bus/msx/slot/cartridge.h" - -#include "bus/generic/slot.h" - - /* Emulation of memory expansions for the MSX system. @@ -103,6 +95,15 @@ Not supported memory mappers: - Stichting CODE MCR-102 - 1MB memory mapper + RAM Disk + Printer buffer - Stichting CODE MCR-204 - 2MB memory mapper + RAM Disk + Printer buffer */ +#include "emu.h" +#include "ram.h" +#include "slotoptions.h" + +#include "bus/msx/slot/cartridge.h" + +#include "bus/generic/slot.h" + + DECLARE_DEVICE_TYPE(MSX_CART_16K_RAM, msx_cart_interface) DECLARE_DEVICE_TYPE(MSX_CART_32K_RAM, msx_cart_interface) @@ -117,16 +118,17 @@ DECLARE_DEVICE_TYPE(MSX_CART_4096K_MM_RAM, msx_cart_interface) void msx_cart_ram_register_options(device_slot_interface &device) { - device.option_add("ram16k", MSX_CART_16K_RAM); - device.option_add("ram32k", MSX_CART_32K_RAM); - device.option_add("ram48k", MSX_CART_48K_RAM); - device.option_add("ram64k", MSX_CART_64K_RAM); - device.option_add("mm256k", MSX_CART_256K_MM_RAM); - device.option_add("mm512k", MSX_CART_512K_MM_RAM); - device.option_add("mm768k", MSX_CART_768K_MM_RAM); - device.option_add("mm1024k", MSX_CART_1024K_MM_RAM); - device.option_add("mm2048k", MSX_CART_2048K_MM_RAM); - device.option_add("mm4096k", MSX_CART_4096K_MM_RAM); + using namespace bus::msx::cart; + device.option_add(slotoptions::RAM16K, MSX_CART_16K_RAM); + device.option_add(slotoptions::RAM32K, MSX_CART_32K_RAM); + device.option_add(slotoptions::RAM48K, MSX_CART_48K_RAM); + device.option_add(slotoptions::RAM64K, MSX_CART_64K_RAM); + device.option_add(slotoptions::MM256K, MSX_CART_256K_MM_RAM); + device.option_add(slotoptions::MM512K, MSX_CART_512K_MM_RAM); + device.option_add(slotoptions::MM768K, MSX_CART_768K_MM_RAM); + device.option_add(slotoptions::MM1024K, MSX_CART_1024K_MM_RAM); + device.option_add(slotoptions::MM2048K, MSX_CART_2048K_MM_RAM); + device.option_add(slotoptions::MM4096K, MSX_CART_4096K_MM_RAM); } namespace { diff --git a/src/devices/bus/msx/cart/slotexpander.cpp b/src/devices/bus/msx/cart/slotexpander.cpp index b627393e199..215fab148ac 100644 --- a/src/devices/bus/msx/cart/slotexpander.cpp +++ b/src/devices/bus/msx/cart/slotexpander.cpp @@ -2,6 +2,7 @@ // copyright-holders:Wilbert Pol #include "emu.h" #include "slotexpander.h" +#include "bus/msx/cart/cartridge.h" #include "machine/input_merger.h" /* diff --git a/src/devices/bus/msx/cart/slotoptions.cpp b/src/devices/bus/msx/cart/slotoptions.cpp new file mode 100644 index 00000000000..2971d8307de --- /dev/null +++ b/src/devices/bus/msx/cart/slotoptions.cpp @@ -0,0 +1,79 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "slotoptions.h" + +namespace bus::msx::cart::slotoptions { +char const *const ARC = "arc"; +char const *const ASCII8 = "ascii8"; +char const *const ASCII8_SRAM = "ascii8_sram"; +char const *const ASCII16 = "ascii16"; +char const *const ASCII16_SRAM = "ascii16_sram"; +char const *const BEEPACK = "beepack"; +char const *const BM_012 = "bm_012"; +char const *const CROSS_BLAIM = "cross_blaim"; +char const *const DISK_AVDPF550 = "disk_avdpf550"; +char const *const DISK_CDX2 = "disk_cdx2"; +char const *const DISK_DDX3 = "disk_ddx3"; +char const *const DISK_FD03 = "disk_fd03"; +char const *const DISK_FD051 = "disk_fd051"; +char const *const DISK_FSCF351 = "disk_fscf351"; +char const *const DISK_FSFD1 = "disk_fsfd1"; +char const *const DISK_FSFD1A = "disk_fsfd1a"; +char const *const DISK_HB3600 = "disk_hb3600"; +char const *const DISK_HBD20W = "disk_hbd20w"; +char const *const DISK_HBD50 = "disk_hbd50"; +char const *const DISK_HBDF1 = "disk_hbdf1"; +char const *const DISK_HXF101PE = "disk_hxf101pe"; +char const *const DISK_MFD001 = "disk_mfd001"; +char const *const DISK_ML30DC = "disk_ml30dc"; +char const *const DISK_NMS1200 = "disk_nms1200"; +char const *const DISK_TADPF550 = "disk_tadpf550"; +char const *const DISK_VY0010 = "disk_vy0010"; +char const *const DOOLY = "dooly"; +char const *const EC701 = "ec701"; +char const *const EASISPEECH = "easispeech"; +char const *const FMPAC = "fmpac"; +char const *const FS_SR022 = "fs_sr022"; +char const *const GAMEMASTER2 = "gamemaster2"; +char const *const HALNOTE = "halnote"; +char const *const HFOX = "hfox"; +char const *const HOLY_QURAN = "holy_quran"; +char const *const INK = "ink"; +char const *const KANJI = "kanji"; +char const *const KEYBOARD_MASTER = "keyboard_master"; +char const *const KONAMI = "konami"; +char const *const KONAMI_SCC = "konami_scc"; +char const *const KOREAN_80IN1 = "korean_80in1"; +char const *const KOREAN_90IN1 = "korean_90in1"; +char const *const KOREAN_126IN1 = "korean_126in1"; +char const *const MAJUSTUSHI = "majutsushi"; +char const *const MM256K = "mm256k"; +char const *const MM512K = "mm512k"; +char const *const MM768K = "mm768k"; +char const *const MM1024K = "mm1024k"; +char const *const MM2048K = "mm2048k"; +char const *const MM4096K = "mm4096k"; +char const *const MOONSOUND = "moonsound"; +char const *const MSXAUD_FSCA1 = "msxaud_fsca1"; +char const *const MSXAUD_HXMU900 = "msxaud_hxmu900"; +char const *const MSXAUD_NMS1205 = "msxaud_nms1205"; +char const *const MSXDOS2J = "msxdos2j"; +char const *const MSXDOS2E = "msxdos2e"; +char const *const MSXWRITE = "msxwrite"; +char const *const NOMAPPER = "nomapper"; +char const *const RAM16K = "ram16k"; +char const *const RAM32K = "ram32k"; +char const *const RAM48K = "ram48k"; +char const *const RAM64K = "ram64k"; +char const *const RTYPE = "rtype"; +char const *const SLOTEXP = "slotexp"; +char const *const SOFTCARD = "softcard"; +char const *const SOUND_SNATCHER = "sound_snatcher"; +char const *const SOUND_SDSNATCH = "sound_sdsnatch"; +char const *const SUPER_SWANGI = "super_swangi"; +char const *const SUPERLODERUNNER = "superloderunner"; +char const *const SYNTHESIZER = "synthesizer"; +char const *const UCN01 = "ucn01"; + +} // namespace bus::msx::cart::slotoptions + diff --git a/src/devices/bus/msx/cart/slotoptions.h b/src/devices/bus/msx/cart/slotoptions.h new file mode 100644 index 00000000000..68ba3fbce57 --- /dev/null +++ b/src/devices/bus/msx/cart/slotoptions.h @@ -0,0 +1,82 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#ifndef MAME_BUS_MSX_CART_SLOTOPTIONS_H +#define MAME_BUS_MSX_CART_SLOTOPTIONS_H + +#pragma once + +namespace bus::msx::cart::slotoptions { +extern char const *const ARC; +extern char const *const ASCII8; +extern char const *const ASCII8_SRAM; +extern char const *const ASCII16; +extern char const *const ASCII16_SRAM; +extern char const *const BEEPACK; +extern char const *const BM_012; +extern char const *const CROSS_BLAIM; +extern char const *const DISK_AVDPF550; +extern char const *const DISK_CDX2; +extern char const *const DISK_DDX3; +extern char const *const DISK_FD03; +extern char const *const DISK_FD051; +extern char const *const DISK_FSCF351; +extern char const *const DISK_FSFD1; +extern char const *const DISK_FSFD1A; +extern char const *const DISK_HB3600; +extern char const *const DISK_HBD20W; +extern char const *const DISK_HBD50; +extern char const *const DISK_HBDF1; +extern char const *const DISK_HXF101PE; +extern char const *const DISK_MFD001; +extern char const *const DISK_ML30DC; +extern char const *const DISK_NMS1200; +extern char const *const DISK_TADPF550; +extern char const *const DISK_VY0010; +extern char const *const DOOLY; +extern char const *const EC701; +extern char const *const EASISPEECH; +extern char const *const FMPAC; +extern char const *const FS_SR022; +extern char const *const GAMEMASTER2; +extern char const *const HALNOTE; +extern char const *const HFOX; +extern char const *const HOLY_QURAN; +extern char const *const INK; +extern char const *const KANJI; +extern char const *const KEYBOARD_MASTER; +extern char const *const KONAMI; +extern char const *const KONAMI_SCC; +extern char const *const KOREAN_80IN1; +extern char const *const KOREAN_90IN1; +extern char const *const KOREAN_126IN1; +extern char const *const MAJUSTUSHI; +extern char const *const MM256K; +extern char const *const MM512K; +extern char const *const MM768K; +extern char const *const MM1024K; +extern char const *const MM2048K ; +extern char const *const MM4096K; +extern char const *const MOONSOUND; +extern char const *const MSXAUD_FSCA1; +extern char const *const MSXAUD_HXMU900; +extern char const *const MSXAUD_NMS1205; +extern char const *const MSXDOS2J; +extern char const *const MSXDOS2E; +extern char const *const MSXWRITE; +extern char const *const NOMAPPER; +extern char const *const RAM16K; +extern char const *const RAM32K; +extern char const *const RAM48K; +extern char const *const RAM64K; +extern char const *const RTYPE; +extern char const *const SLOTEXP; +extern char const *const SOFTCARD; +extern char const *const SOUND_SNATCHER; +extern char const *const SOUND_SDSNATCH; +extern char const *const SUPER_SWANGI; +extern char const *const SUPERLODERUNNER; +extern char const *const SYNTHESIZER; +extern char const *const UCN01; +} // namespace bus::msx::cart::slotoptions + +#endif // MAME_BUS_MSX_CART_SLOTOPTIONS_H diff --git a/src/devices/bus/msx/cart/yamaha.cpp b/src/devices/bus/msx/cart/yamaha.cpp deleted file mode 100644 index 80fc4281b89..00000000000 --- a/src/devices/bus/msx/cart/yamaha.cpp +++ /dev/null @@ -1,158 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -/************************************************************************** - -Yamaha SFG01/SFG05 emulation - -**************************************************************************/ - -#include "emu.h" -#include "yamaha.h" - -#include "bus/midi/midi.h" -#include "speaker.h" - - -DEFINE_DEVICE_TYPE(MSX_CART_SFG01, msx_cart_sfg01_device, "msx_cart_sfg01", "MSX Cartridge - SFG01") -DEFINE_DEVICE_TYPE(MSX_CART_SFG05, msx_cart_sfg05_device, "msx_cart_sfg05", "MSX Cartridge - SFG05") - - -msx_cart_sfg_device::msx_cart_sfg_device(const machine_config &mconfig, const device_type type, const char *tag, device_t *owner, u32 clock) - : device_t(mconfig, type, tag, owner, clock) - , msx_cart_interface(mconfig, *this) - , m_region_sfg(*this, "sfg") - , m_ym2151(*this, "ym2151") - , m_kbdc(*this, "kbdc") - , m_ym2148(*this, "ym2148") - , m_ym2151_irq_state(CLEAR_LINE) - , m_ym2148_irq_state(CLEAR_LINE) - , m_rom_mask(0) -{ -} - -msx_cart_sfg01_device::msx_cart_sfg01_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : msx_cart_sfg_device(mconfig, MSX_CART_SFG01, tag, owner, clock) -{ -} - -msx_cart_sfg05_device::msx_cart_sfg05_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : msx_cart_sfg_device(mconfig, MSX_CART_SFG05, tag, owner, clock) -{ -} - -void msx_cart_sfg_device::device_add_mconfig(machine_config &config) -{ - // YM2151 (OPM) - // YM3012 (DAC) - // YM2148 (MKS) - - SPEAKER(config, "lspeaker").front_left(); - SPEAKER(config, "rspeaker").front_right(); - ym2151_device &ym2151(YM2151(config, m_ym2151, XTAL(3'579'545))); // The SFG01 uses a YM2151, the SFG05 uses a YM2164, input clock comes from the main cpu frequency - ym2151.irq_handler().set(FUNC(msx_cart_sfg_device::ym2151_irq_w)); - ym2151.add_route(0, "lspeaker", 0.80); - ym2151.add_route(1, "rspeaker", 0.80); - - YM2148(config, m_ym2148, XTAL(4'000'000)); - m_ym2148->txd_handler().set("mdout", FUNC(midi_port_device::write_txd)); - m_ym2148->port_write_handler().set("kbdc", FUNC(msx_audio_kbdc_port_device::write)); - m_ym2148->port_read_handler().set("kbdc", FUNC(msx_audio_kbdc_port_device::read)); - m_ym2148->irq_handler().set(FUNC(msx_cart_sfg_device::ym2148_irq_w)); - - MSX_AUDIO_KBDC_PORT(config, m_kbdc, msx_audio_keyboards, nullptr); - - MIDI_PORT(config, "mdout", midiout_slot, "midiout"); - MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set("ym2148", FUNC(ym2148_device::write_rxd)); -} - -void msx_cart_sfg05_device::device_add_mconfig(machine_config &config) -{ - msx_cart_sfg_device::device_add_mconfig(config); - - ym2164_device &ym2164(YM2164(config.replace(), m_ym2151, XTAL(3'579'545))); - ym2164.irq_handler().set(FUNC(msx_cart_sfg05_device::ym2151_irq_w)); - ym2164.add_route(0, "lspeaker", 0.80); - ym2164.add_route(1, "rspeaker", 0.80); -} - -ROM_START(msx_sfg01) - ROM_REGION(0x4000, "sfg", 0) - ROM_LOAD("sfg01.rom", 0x0, 0x4000, CRC(0995fb36) SHA1(434651305f92aa770a89e40b81125fb22d91603d)) // correct label is almost certainly "yamaha__ym2211-22702__48_18_89_b.ic104" though the datecode portion may vary between late 1983 and mid 1984 -ROM_END - -const tiny_rom_entry *msx_cart_sfg01_device::device_rom_region() const -{ - return ROM_NAME(msx_sfg01); -} - -ROM_START(msx_sfg05) - ROM_REGION(0x8000, "sfg", 0) - // Version string starts at $02BD - ROM_SYSTEM_BIOS(0, "m5.01.011", "SFG05 (original) M5.01.011") - ROMX_LOAD( "sfg05.rom", 0x0, 0x8000, CRC(2425c279) SHA1(d956167e234f60ad916120437120f86fc8c3c321), ROM_BIOS(0)) // correct label MIGHT be "yamaha__ym2301-23959.ic104" but this needs redump/verification - ROM_SYSTEM_BIOS(1, "m5.00.013", "SFG05 (SFG01 upgrade) M5.00.013") // SFG01 PCB, Yamaha official upgrade, has YM2151 instead of YM2164 - ROMX_LOAD( "sfg05a.rom", 0x0, 0x8000, CRC(5bc237f8) SHA1(930338f45c08228108c0831cc4a26014c2674718), ROM_BIOS(1)) // this came on a single eprom on a daughterboard on an SFG01 board which had been factory upgraded to SFG05 - ROM_SYSTEM_BIOS(2, "m5.00.011", "SFG05 M5.00.011") // Found in Sakhr AX-200M - ROMX_LOAD("sfg05_m5_00_011.rom", 0x0, 0x8000, BAD_DUMP CRC(9d5e20c9) SHA1(fcc385b90c65575e29fc009aa00b5120fc4c251a), ROM_BIOS(2)) // Still seems to have I/O reads at $7ff0 - $7fff -ROM_END - -const tiny_rom_entry *msx_cart_sfg05_device::device_rom_region() const -{ - return ROM_NAME(msx_sfg05); -} - -void msx_cart_sfg_device::device_start() -{ - // Set rom mask - m_rom_mask = m_region_sfg->bytes() - 1; - - maincpu().set_irq_acknowledge_callback(*this, FUNC(msx_cart_sfg_device::irq_callback)); - - page(0)->install_rom(0x0000, 0x3fff, m_region_sfg->base()); - if (m_region_sfg->bytes() == 0x8000) - { - page(1)->install_rom(0x4000, 0x7fff, m_region_sfg->base() + 0x4000); - } - else - { - page(1)->install_rom(0x4000, 0x7fff, m_region_sfg->base()); - } - - for (int i = 0; i < 4; i++) - { - // These addresses deliberately overlap - page(i)->install_read_handler(0x4000 * i + 0x3ff0, 0x4000 * i + 0x3ff6, read8sm_delegate(*m_ym2148, FUNC(ym2148_device::read))); - page(i)->install_read_handler(0x4000 * i + 0x3ff0, 0x4000 * i + 0x3ff1, read8sm_delegate(*m_ym2151, FUNC(ym_generic_device::read))); - page(i)->install_write_handler(0x4000 * i + 0x3ff0, 0x4000 * i + 0x3ff6, write8sm_delegate(*m_ym2148, FUNC(ym2148_device::write))); - page(i)->install_write_handler(0x4000 * i + 0x3ff0, 0x4000 * i + 0x3ff1, write8sm_delegate(*m_ym2151, FUNC(ym_generic_device::write))); - } -} - -IRQ_CALLBACK_MEMBER(msx_cart_sfg_device::irq_callback) -{ - return m_ym2148->get_irq_vector(); -} - -WRITE_LINE_MEMBER(msx_cart_sfg_device::ym2151_irq_w) -{ - m_ym2151_irq_state = state ? ASSERT_LINE : CLEAR_LINE; - check_irq(); -} - -WRITE_LINE_MEMBER(msx_cart_sfg_device::ym2148_irq_w) -{ - m_ym2148_irq_state = state ? ASSERT_LINE : CLEAR_LINE; - check_irq(); -} - -void msx_cart_sfg_device::check_irq() -{ - if (m_ym2151_irq_state != CLEAR_LINE || m_ym2148_irq_state != CLEAR_LINE) - { - irq_out(ASSERT_LINE); - } - else - { - irq_out(CLEAR_LINE); - } -} diff --git a/src/devices/bus/msx/cart/yamaha.h b/src/devices/bus/msx/cart/yamaha.h deleted file mode 100644 index f5b794dadfd..00000000000 --- a/src/devices/bus/msx/cart/yamaha.h +++ /dev/null @@ -1,63 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Wilbert Pol -#ifndef MAME_BUS_MSX_CART_YAMAHA_H -#define MAME_BUS_MSX_CART_YAMAHA_H - -#pragma once - -#include "bus/msx/slot/cartridge.h" -#include "msx_audio_kb.h" -#include "sound/ymopm.h" -#include "machine/ym2148.h" - - -DECLARE_DEVICE_TYPE(MSX_CART_SFG01, msx_cart_sfg01_device) -DECLARE_DEVICE_TYPE(MSX_CART_SFG05, msx_cart_sfg05_device) - - -class msx_cart_sfg_device : public device_t, public msx_cart_interface -{ -protected: - msx_cart_sfg_device(const machine_config &mconfig, const device_type type, const char *tag, device_t *owner, u32 clock); - - virtual void device_start() override; - - // device-level overrides - virtual void device_add_mconfig(machine_config &config) override; - - IRQ_CALLBACK_MEMBER(irq_callback); - - DECLARE_WRITE_LINE_MEMBER(ym2151_irq_w); - DECLARE_WRITE_LINE_MEMBER(ym2148_irq_w); - - required_memory_region m_region_sfg; - required_device m_ym2151; - required_device m_kbdc; - required_device m_ym2148; - int m_ym2151_irq_state; - int m_ym2148_irq_state; - u32 m_rom_mask; - - void check_irq(); -}; - - -class msx_cart_sfg01_device : public msx_cart_sfg_device -{ -public: - msx_cart_sfg01_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - - virtual const tiny_rom_entry *device_rom_region() const override; -}; - - -class msx_cart_sfg05_device : public msx_cart_sfg_device -{ -public: - msx_cart_sfg05_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - - virtual void device_add_mconfig(machine_config &config) override; - virtual const tiny_rom_entry *device_rom_region() const override; -}; - -#endif // MAME_BUS_MSX_CART_YAMAHA_H diff --git a/src/devices/bus/msx/cart/yamaha_ucn01.cpp b/src/devices/bus/msx/cart/yamaha_ucn01.cpp index 39aa35a9e46..1129f255af9 100644 --- a/src/devices/bus/msx/cart/yamaha_ucn01.cpp +++ b/src/devices/bus/msx/cart/yamaha_ucn01.cpp @@ -2,6 +2,7 @@ // copyright-holders:Wilbert Pol #include "emu.h" #include "yamaha_ucn01.h" +#include "bus/msx/module/module.h" /* Emulation of Yamaha UCN-01. diff --git a/src/devices/bus/msx/minicart/minicart.cpp b/src/devices/bus/msx/minicart/minicart.cpp new file mode 100644 index 00000000000..3f7c8bf53e6 --- /dev/null +++ b/src/devices/bus/msx/minicart/minicart.cpp @@ -0,0 +1,35 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "minicart.h" +#include "bus/msx/cart/nomapper.h" + + +namespace bus::msx::minicart::slotoptions { +char const *const NOMAPPER = "nomapper"; +} + +void msx_yamaha_minicart(device_slot_interface &device, bool is_in_subslot) +{ + using namespace bus::msx::minicart::slotoptions; + device.option_add_internal(NOMAPPER, MSX_CART_NOMAPPER); +} + + +DEFINE_DEVICE_TYPE(MSX_SLOT_YAMAHA_MINICART, msx_slot_yamaha_minicart_device, "msx_slot_yamaha_minicart", "MSX Yamaha Minicart slot") + + +msx_slot_yamaha_minicart_device::msx_slot_yamaha_minicart_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : msx_slot_cartridge_base_device(mconfig, MSX_SLOT_YAMAHA_MINICART, tag, owner, clock) +{ +} + +void msx_slot_yamaha_minicart_device::device_start() +{ +} + +std::string msx_slot_yamaha_minicart_device::get_default_card_software(get_default_card_software_hook &hook) const +{ + using namespace bus::msx::minicart::slotoptions; + return software_get_default_slot(NOMAPPER); +} diff --git a/src/devices/bus/msx/minicart/minicart.h b/src/devices/bus/msx/minicart/minicart.h new file mode 100644 index 00000000000..9da07418c0d --- /dev/null +++ b/src/devices/bus/msx/minicart/minicart.h @@ -0,0 +1,38 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + MSX Yamaha minicart slot + +Pinout of the 30 pin connector is unknown. + + ***************************************************************************/ +#ifndef MAME_BUS_MSX_MINICART_MINICART_H +#define MAME_BUS_MSX_MINICART_MINICART_H + +#pragma once + +#include "bus/msx/slot/cartridge.h" + + +void msx_yamaha_minicart(device_slot_interface &device, bool is_in_subslot); // 30 pin mini cartridge slot as found in some yamaha machines + + +DECLARE_DEVICE_TYPE(MSX_SLOT_YAMAHA_MINICART, msx_slot_yamaha_minicart_device) + + +class msx_slot_yamaha_minicart_device : public msx_slot_cartridge_base_device +{ +public: + msx_slot_yamaha_minicart_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual const char *image_interface() const noexcept override { return "msx_yamaha_minicart"; } + virtual const char *image_type_name() const noexcept override { return "yamahaminicart"; } + virtual const char *image_brief_type_name() const noexcept override { return "mini"; } + virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; + +protected: + virtual void device_start() override; +}; + +#endif // MAME_BUS_MSX_MINICART_MINICART_H diff --git a/src/devices/bus/msx/module/module.cpp b/src/devices/bus/msx/module/module.cpp new file mode 100644 index 00000000000..7a0f17d1ffc --- /dev/null +++ b/src/devices/bus/msx/module/module.cpp @@ -0,0 +1,38 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#include "emu.h" +#include "module.h" +#include "sfg.h" + + +namespace bus::msx::module::slotoptions { +char const *const SFG01 = "sfg01"; +char const *const SFG05 = "sfg05"; +} + + +void msx_yamaha_60pin(device_slot_interface &device, bool is_in_subslot) +{ + using namespace bus::msx::module; + device.option_add(slotoptions::SFG01, MSX_CART_SFG01); + device.option_add(slotoptions::SFG05, MSX_CART_SFG05); +} + + +DEFINE_DEVICE_TYPE(MSX_SLOT_YAMAHA_EXPANSION, msx_slot_yamaha_expansion_device, "msx_slot_yamaha_expansion", "MSX Yamaha Expansion slot") + + +msx_slot_yamaha_expansion_device::msx_slot_yamaha_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : msx_slot_cartridge_base_device(mconfig, MSX_SLOT_YAMAHA_EXPANSION, tag, owner, clock) +{ +} + +void msx_slot_yamaha_expansion_device::device_start() +{ +} + +std::string msx_slot_yamaha_expansion_device::get_default_card_software(get_default_card_software_hook &hook) const +{ + using namespace bus::msx::module; + return software_get_default_slot(slotoptions::SFG01); +} diff --git a/src/devices/bus/msx/module/module.h b/src/devices/bus/msx/module/module.h new file mode 100644 index 00000000000..4bd91b74c33 --- /dev/null +++ b/src/devices/bus/msx/module/module.h @@ -0,0 +1,66 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/*************************************************************************** + + MSX Yamaha module slot + + Cartridge edge connector (double-sided): + GND - 2 1 - SOUND OUT +Phase control - 4 3 - GND + B-Y - 6 5 - Y + R-Y - 8 7 - C VIDEO +CLOCK INT/EXT - 10 9 - EXT CLOCK + /CS2 - 12 11 - /CS1 + /SLTSL - 14 13 - /CS12 + /RFSH - 16 15 - reserved + /INT - 18 17 - /WAIT + /BUSDIR - 20 19 - /M1 + /MREQ - 22 21 - /IORQ + /RD - 24 23 - /WR + reserved - 26 25 - /RESET + A15 - 28 27 - A9 + A10 - 30 29 - A11 + A6 - 32 31 - A7 + A8 - 34 33 - A12 + A13 - 36 35 - A14 + A0 - 38 37 - A1 + A2 - 40 39 - A3 + A4 - 42 41 - A5 + D0 - 44 43 - D1 + D2 - 46 45 - D3 + D4 - 48 47 - D5 + D6 - 50 49 - D7 + CLOCK - 52 51 - GND + SW1 - 54 53 - GND + SW2 - 56 55 - +5V + +12V - 58 57 - +5V + -12V - 60 59 - SOUNDIN + + ***************************************************************************/ +#ifndef MAME_BUS_MSX_MODULE_MODULE_H +#define MAME_BUS_MSX_MODULE_MODULE_H + +#pragma once + +#include "bus/msx/slot/cartridge.h" + + +void msx_yamaha_60pin(device_slot_interface &device, bool is_in_subslot); // 60 pin expansion slots as found in yamaha machines +DECLARE_DEVICE_TYPE(MSX_SLOT_YAMAHA_EXPANSION, msx_slot_yamaha_expansion_device) + + +class msx_slot_yamaha_expansion_device : public msx_slot_cartridge_base_device +{ +public: + msx_slot_yamaha_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual const char *image_interface() const noexcept override { return "msx_yamaha_60pin"; } + virtual const char *image_type_name() const noexcept override { return "cartridge60pin"; } + virtual const char *image_brief_type_name() const noexcept override { return "cart60p"; } + virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; + +protected: + virtual void device_start() override; +}; + +#endif // MAME_BUS_MSX_MODULE_MODULE_H diff --git a/src/devices/bus/msx/module/sfg.cpp b/src/devices/bus/msx/module/sfg.cpp new file mode 100644 index 00000000000..44e3c281d58 --- /dev/null +++ b/src/devices/bus/msx/module/sfg.cpp @@ -0,0 +1,158 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +/************************************************************************** + +Yamaha SFG01/SFG05 emulation + +**************************************************************************/ + +#include "emu.h" +#include "sfg.h" + +#include "bus/midi/midi.h" +#include "speaker.h" + + +DEFINE_DEVICE_TYPE(MSX_CART_SFG01, msx_cart_sfg01_device, "msx_cart_sfg01", "MSX Cartridge - SFG01") +DEFINE_DEVICE_TYPE(MSX_CART_SFG05, msx_cart_sfg05_device, "msx_cart_sfg05", "MSX Cartridge - SFG05") + + +msx_cart_sfg_device::msx_cart_sfg_device(const machine_config &mconfig, const device_type type, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, type, tag, owner, clock) + , msx_cart_interface(mconfig, *this) + , m_region_sfg(*this, "sfg") + , m_ym2151(*this, "ym2151") + , m_kbdc(*this, "kbdc") + , m_ym2148(*this, "ym2148") + , m_ym2151_irq_state(CLEAR_LINE) + , m_ym2148_irq_state(CLEAR_LINE) + , m_rom_mask(0) +{ +} + +msx_cart_sfg01_device::msx_cart_sfg01_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : msx_cart_sfg_device(mconfig, MSX_CART_SFG01, tag, owner, clock) +{ +} + +msx_cart_sfg05_device::msx_cart_sfg05_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : msx_cart_sfg_device(mconfig, MSX_CART_SFG05, tag, owner, clock) +{ +} + +void msx_cart_sfg_device::device_add_mconfig(machine_config &config) +{ + // YM2151 (OPM) + // YM3012 (DAC) + // YM2148 (MKS) + + SPEAKER(config, "lspeaker").front_left(); + SPEAKER(config, "rspeaker").front_right(); + ym2151_device &ym2151(YM2151(config, m_ym2151, XTAL(3'579'545))); // The SFG01 uses a YM2151, the SFG05 uses a YM2164, input clock comes from the main cpu frequency + ym2151.irq_handler().set(FUNC(msx_cart_sfg_device::ym2151_irq_w)); + ym2151.add_route(0, "lspeaker", 0.80); + ym2151.add_route(1, "rspeaker", 0.80); + + YM2148(config, m_ym2148, XTAL(4'000'000)); + m_ym2148->txd_handler().set("mdout", FUNC(midi_port_device::write_txd)); + m_ym2148->port_write_handler().set("kbdc", FUNC(msx_audio_kbdc_port_device::write)); + m_ym2148->port_read_handler().set("kbdc", FUNC(msx_audio_kbdc_port_device::read)); + m_ym2148->irq_handler().set(FUNC(msx_cart_sfg_device::ym2148_irq_w)); + + MSX_AUDIO_KBDC_PORT(config, m_kbdc, msx_audio_keyboards, nullptr); + + MIDI_PORT(config, "mdout", midiout_slot, "midiout"); + MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set("ym2148", FUNC(ym2148_device::write_rxd)); +} + +void msx_cart_sfg05_device::device_add_mconfig(machine_config &config) +{ + msx_cart_sfg_device::device_add_mconfig(config); + + ym2164_device &ym2164(YM2164(config.replace(), m_ym2151, XTAL(3'579'545))); + ym2164.irq_handler().set(FUNC(msx_cart_sfg05_device::ym2151_irq_w)); + ym2164.add_route(0, "lspeaker", 0.80); + ym2164.add_route(1, "rspeaker", 0.80); +} + +ROM_START(msx_sfg01) + ROM_REGION(0x4000, "sfg", 0) + ROM_LOAD("sfg01.rom", 0x0, 0x4000, CRC(0995fb36) SHA1(434651305f92aa770a89e40b81125fb22d91603d)) // correct label is almost certainly "yamaha__ym2211-22702__48_18_89_b.ic104" though the datecode portion may vary between late 1983 and mid 1984 +ROM_END + +const tiny_rom_entry *msx_cart_sfg01_device::device_rom_region() const +{ + return ROM_NAME(msx_sfg01); +} + +ROM_START(msx_sfg05) + ROM_REGION(0x8000, "sfg", 0) + // Version string starts at $02BD + ROM_SYSTEM_BIOS(0, "m5.01.011", "SFG05 (original) M5.01.011") + ROMX_LOAD( "sfg05.rom", 0x0, 0x8000, CRC(2425c279) SHA1(d956167e234f60ad916120437120f86fc8c3c321), ROM_BIOS(0)) // correct label MIGHT be "yamaha__ym2301-23959.ic104" but this needs redump/verification + ROM_SYSTEM_BIOS(1, "m5.00.013", "SFG05 (SFG01 upgrade) M5.00.013") // SFG01 PCB, Yamaha official upgrade, has YM2151 instead of YM2164 + ROMX_LOAD( "sfg05a.rom", 0x0, 0x8000, CRC(5bc237f8) SHA1(930338f45c08228108c0831cc4a26014c2674718), ROM_BIOS(1)) // this came on a single eprom on a daughterboard on an SFG01 board which had been factory upgraded to SFG05 + ROM_SYSTEM_BIOS(2, "m5.00.011", "SFG05 M5.00.011") // Found in Sakhr AX-200M + ROMX_LOAD("sfg05_m5_00_011.rom", 0x0, 0x8000, BAD_DUMP CRC(9d5e20c9) SHA1(fcc385b90c65575e29fc009aa00b5120fc4c251a), ROM_BIOS(2)) // Still seems to have I/O reads at $7ff0 - $7fff +ROM_END + +const tiny_rom_entry *msx_cart_sfg05_device::device_rom_region() const +{ + return ROM_NAME(msx_sfg05); +} + +void msx_cart_sfg_device::device_start() +{ + // Set rom mask + m_rom_mask = m_region_sfg->bytes() - 1; + + maincpu().set_irq_acknowledge_callback(*this, FUNC(msx_cart_sfg_device::irq_callback)); + + page(0)->install_rom(0x0000, 0x3fff, m_region_sfg->base()); + if (m_region_sfg->bytes() == 0x8000) + { + page(1)->install_rom(0x4000, 0x7fff, m_region_sfg->base() + 0x4000); + } + else + { + page(1)->install_rom(0x4000, 0x7fff, m_region_sfg->base()); + } + + for (int i = 0; i < 4; i++) + { + // These addresses deliberately overlap + page(i)->install_read_handler(0x4000 * i + 0x3ff0, 0x4000 * i + 0x3ff6, read8sm_delegate(*m_ym2148, FUNC(ym2148_device::read))); + page(i)->install_read_handler(0x4000 * i + 0x3ff0, 0x4000 * i + 0x3ff1, read8sm_delegate(*m_ym2151, FUNC(ym_generic_device::read))); + page(i)->install_write_handler(0x4000 * i + 0x3ff0, 0x4000 * i + 0x3ff6, write8sm_delegate(*m_ym2148, FUNC(ym2148_device::write))); + page(i)->install_write_handler(0x4000 * i + 0x3ff0, 0x4000 * i + 0x3ff1, write8sm_delegate(*m_ym2151, FUNC(ym_generic_device::write))); + } +} + +IRQ_CALLBACK_MEMBER(msx_cart_sfg_device::irq_callback) +{ + return m_ym2148->get_irq_vector(); +} + +WRITE_LINE_MEMBER(msx_cart_sfg_device::ym2151_irq_w) +{ + m_ym2151_irq_state = state ? ASSERT_LINE : CLEAR_LINE; + check_irq(); +} + +WRITE_LINE_MEMBER(msx_cart_sfg_device::ym2148_irq_w) +{ + m_ym2148_irq_state = state ? ASSERT_LINE : CLEAR_LINE; + check_irq(); +} + +void msx_cart_sfg_device::check_irq() +{ + if (m_ym2151_irq_state != CLEAR_LINE || m_ym2148_irq_state != CLEAR_LINE) + { + irq_out(ASSERT_LINE); + } + else + { + irq_out(CLEAR_LINE); + } +} diff --git a/src/devices/bus/msx/module/sfg.h b/src/devices/bus/msx/module/sfg.h new file mode 100644 index 00000000000..0bd1590dad9 --- /dev/null +++ b/src/devices/bus/msx/module/sfg.h @@ -0,0 +1,63 @@ +// license:BSD-3-Clause +// copyright-holders:Wilbert Pol +#ifndef MAME_BUS_MSX_CART_YAMAHA_H +#define MAME_BUS_MSX_CART_YAMAHA_H + +#pragma once + +#include "bus/msx/slot/cartridge.h" +#include "bus/msx/cart/msx_audio_kb.h" +#include "sound/ymopm.h" +#include "machine/ym2148.h" + + +DECLARE_DEVICE_TYPE(MSX_CART_SFG01, msx_cart_sfg01_device) +DECLARE_DEVICE_TYPE(MSX_CART_SFG05, msx_cart_sfg05_device) + + +class msx_cart_sfg_device : public device_t, public msx_cart_interface +{ +protected: + msx_cart_sfg_device(const machine_config &mconfig, const device_type type, const char *tag, device_t *owner, u32 clock); + + virtual void device_start() override; + + // device-level overrides + virtual void device_add_mconfig(machine_config &config) override; + + IRQ_CALLBACK_MEMBER(irq_callback); + + DECLARE_WRITE_LINE_MEMBER(ym2151_irq_w); + DECLARE_WRITE_LINE_MEMBER(ym2148_irq_w); + + required_memory_region m_region_sfg; + required_device m_ym2151; + required_device m_kbdc; + required_device m_ym2148; + int m_ym2151_irq_state; + int m_ym2148_irq_state; + u32 m_rom_mask; + + void check_irq(); +}; + + +class msx_cart_sfg01_device : public msx_cart_sfg_device +{ +public: + msx_cart_sfg01_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual const tiny_rom_entry *device_rom_region() const override; +}; + + +class msx_cart_sfg05_device : public msx_cart_sfg_device +{ +public: + msx_cart_sfg05_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; +}; + +#endif // MAME_BUS_MSX_CART_YAMAHA_H diff --git a/src/devices/bus/msx/slot/cartridge.cpp b/src/devices/bus/msx/slot/cartridge.cpp index 2d2990488c7..673e1b40328 100644 --- a/src/devices/bus/msx/slot/cartridge.cpp +++ b/src/devices/bus/msx/slot/cartridge.cpp @@ -5,42 +5,7 @@ #include "hashfile.h" -enum -{ - NOMAPPER = 0, - ASCII8, - ASCII8_SRAM, - ASCII16, - ASCII16_SRAM, - CROSSBLAIM, - GAMEMASTER2, - KOREAN_80IN1, - KOREAN_90IN1, - KOREAN_126IN1, - FMPAC, - RTYPE, - KONAMI, - KONAMI_SCC, - SUPERLODERUNNER, - MAJUTSUSHI, - DISK_ROM, - SYNTHESIZER, - MSXDOS2 -}; - - -DEFINE_DEVICE_TYPE(MSX_SLOT_CARTRIDGE, msx_slot_cartridge_device, "msx_slot_cartridge", "MSX Cartridge slot") -DEFINE_DEVICE_TYPE(MSX_SLOT_YAMAHA_EXPANSION, msx_slot_yamaha_expansion_device, "msx_slot_yamaha_expansion", "MSX Yamaha Expansion slot") -DEFINE_DEVICE_TYPE(MSX_SLOT_YAMAHA_MINICART, msx_slot_yamaha_minicart_device, "msx_slot_yamaha_minicart", "MSX Yamaha Minicart slot") - - -msx_slot_cartridge_device::msx_slot_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : msx_slot_cartridge_device(mconfig, MSX_SLOT_CARTRIDGE, tag, owner, clock) -{ -} - - -msx_slot_cartridge_device::msx_slot_cartridge_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) +msx_slot_cartridge_base_device::msx_slot_cartridge_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, type, tag, owner, clock) , device_cartrom_image_interface(mconfig, *this) , device_slot_interface(mconfig, *this) @@ -51,47 +16,7 @@ msx_slot_cartridge_device::msx_slot_cartridge_device(const machine_config &mconf } -static const struct -{ - int pcb_id; - const char *slot_option; -} slot_list[] = -{ - { NOMAPPER, "nomapper" }, - { ASCII8, "ascii8" }, - { ASCII8_SRAM, "ascii8_sram" }, - { ASCII16, "ascii16" }, - { ASCII16_SRAM, "ascii16_sram" }, - { CROSSBLAIM, "cross_blaim" }, - { GAMEMASTER2, "gamemaster2" }, - { KOREAN_80IN1, "korean_80in1" }, - { KOREAN_90IN1, "korean_90in1" }, - { KOREAN_126IN1, "korean_126in1" }, - { FMPAC, "fmpac" }, - { RTYPE, "rtype" }, - { KONAMI, "konami" }, - { KONAMI_SCC, "konami_scc" }, - { SUPERLODERUNNER, "superloderunner" }, - { MAJUTSUSHI, "majutsushi" }, - { DISK_ROM, "disk_rom" }, - { SYNTHESIZER, "synthesizer" }, - { MSXDOS2, "msxdos2" } -}; - - -static const char *msx_cart_get_slot_option(int type) -{ - for (auto & elem : slot_list) - { - if (elem.pcb_id == type) - return elem.slot_option; - } - - return slot_list[0].slot_option; -} - - -void msx_slot_cartridge_device::device_resolve_objects() +void msx_slot_cartridge_base_device::device_resolve_objects() { m_irq_handler.resolve_safe(); m_cartridge = dynamic_cast(get_card_device()); @@ -102,12 +27,12 @@ void msx_slot_cartridge_device::device_resolve_objects() } -void msx_slot_cartridge_device::device_start() +void msx_slot_cartridge_base_device::device_start() { } -image_init_result msx_slot_cartridge_device::call_load() +image_init_result msx_slot_cartridge_base_device::call_load() { if (m_cartridge) { @@ -138,12 +63,6 @@ image_init_result msx_slot_cartridge_device::call_load() seterror(image_error::UNSPECIFIED, "Unable to fully read file"); return image_init_result::FAIL; } - - // Check if there's some mapper related - std::string extrainfo; - if (hashfile_extrainfo(*this, extrainfo)) - { - } } std::string message; @@ -163,7 +82,7 @@ image_init_result msx_slot_cartridge_device::call_load() } -void msx_slot_cartridge_device::call_unload() +void msx_slot_cartridge_base_device::call_unload() { if (m_cartridge && m_cartridge->cart_sram_region()) { @@ -171,174 +90,15 @@ void msx_slot_cartridge_device::call_unload() } } - -WRITE_LINE_MEMBER(msx_slot_cartridge_device::irq_out) +WRITE_LINE_MEMBER(msx_slot_cartridge_base_device::irq_out) { m_irq_handler(state); } -int msx_slot_cartridge_device::get_cart_type(const u8 *rom, u32 length) -{ - if (length < 0x2000) - { - return -1; - } - - if (length < 0x10000) - { - return NOMAPPER; - } - - if ((rom[0x10] == 'Y') && (rom[0x11] == 'Z') && (length > 0x18000)) - { - return GAMEMASTER2; - } - - int kon4 = 0, kon5 = 0, asc8 = 0, asc16 = 0; - - for (int i=0; i < length-3; i++) - { - if (rom[i] == 0x32 && rom[i+1] == 0) - { - switch (rom[i+2]) - { - case 0x60: - case 0x70: - asc16++; - asc8++; - break; - - case 0x68: - case 0x78: - asc8++; - asc16--; - break; - } - - switch (rom[i+2]) - { - case 0x60: - case 0x80: - case 0xa0: - kon4++; - break; - - case 0x50: - case 0x70: - case 0x90: - case 0xb0: - kon5++; - break; - } - } - } - - if (std::max(kon4, kon5) > std::max(asc8, asc16)) - { - return (kon5 > kon4) ? KONAMI_SCC : KONAMI; - } - else - { - return (asc8 > asc16) ? ASCII8 : ASCII16; - } -} - - -std::string msx_slot_cartridge_device::get_default_card_software(get_default_card_software_hook &hook) const -{ - if (hook.image_file()) - { - const char *slot_string = "nomapper"; - int type = NOMAPPER; - - // Check if there's some mapper related information in the hashfiles - std::string extrainfo; - if (hook.hashfile_extrainfo(extrainfo)) - { - int extrainfo_type = -1; - if (1 == sscanf(extrainfo.c_str(), "%d", &extrainfo_type)) - { - static const struct {int extrainfo; int mapper;} extrainfo_map[] = { - //{ 0, NOMAPPER }, - { 1, MSXDOS2 }, - { 2, KONAMI_SCC }, - { 3, KONAMI }, - { 4, ASCII8 }, - { 5, ASCII16 }, - { 6, GAMEMASTER2 }, - { 7, ASCII8_SRAM }, - { 8, ASCII16_SRAM }, - { 9, RTYPE }, - { 10, MAJUTSUSHI }, - { 11, FMPAC }, - { 12, SUPERLODERUNNER }, - { 13, SYNTHESIZER }, - { 14, CROSSBLAIM }, - { 15, DISK_ROM }, - { 16, KOREAN_80IN1 }, - { 17, KOREAN_126IN1 } - }; - - for (auto & elem : extrainfo_map) - { - if (elem.extrainfo == extrainfo_type) - { - type = elem.mapper; - } - } - } - } - - if (type == NOMAPPER) - { - // Not identified through hashfile, try automatic detection - u64 length; - hook.image_file()->length(length); // FIXME: check error return, guard against excessively large files - std::vector rom(length); - size_t actual; - hook.image_file()->read(&rom[0], length, actual); // FIXME: check error return or read returning short - type = get_cart_type(&rom[0], length); - } - - if (type > NOMAPPER) - { - slot_string = msx_cart_get_slot_option(type); - } - - return std::string(slot_string); - } - return software_get_default_slot("nomapper"); -} - - - - -msx_slot_yamaha_expansion_device::msx_slot_yamaha_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : msx_slot_cartridge_device(mconfig, MSX_SLOT_YAMAHA_EXPANSION, tag, owner, clock) -{ -} - -void msx_slot_yamaha_expansion_device::device_start() -{ -} - - - - -msx_slot_yamaha_minicart_device::msx_slot_yamaha_minicart_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : msx_slot_cartridge_device(mconfig, MSX_SLOT_YAMAHA_MINICART, tag, owner, clock) -{ -} - -void msx_slot_yamaha_minicart_device::device_start() -{ -} - - msx_cart_interface::msx_cart_interface(const machine_config &mconfig, device_t &device) : device_interface(device, "msxcart") - , m_exp(dynamic_cast(device.owner())) + , m_exp(dynamic_cast(device.owner())) { for (int i = 0; i < 4; i++) m_page[i] = nullptr; diff --git a/src/devices/bus/msx/slot/cartridge.h b/src/devices/bus/msx/slot/cartridge.h index b23ec5b0133..6aa4e0a7886 100644 --- a/src/devices/bus/msx/slot/cartridge.h +++ b/src/devices/bus/msx/slot/cartridge.h @@ -1,30 +1,54 @@ // license:BSD-3-Clause // copyright-holders:Wilbert Pol +/*************************************************************************** + + MSX cartridge slot + + Cartridge edge connector (double-sided): + /CS2 - 2 1 - /CS1 + /SLTSL - 4 3 - /CS12 + /RFSH - 6 5 - reserved + /INT - 8 7 - /WAIT + /BUSDIR - 10 9 - /M1 + /MREQ - 12 11 - /IORQ + /RD - 14 13 - /WR +reserved - 16 15 - /RESET + A15 - 18 17 - A9 + A10 - 20 19 - A11 + A6 - 22 21 - A7 + A8 - 24 23 - A12 + A13 - 26 25 - A14 + A0 - 28 27 - A1 + A2 - 30 29 - A3 + A4 - 32 31 - A5 + D0 - 34 33 - D1 + D2 - 36 35 - D3 + D4 - 38 37 - D5 + D6 - 40 39 - D7 + CLOCK - 42 41 - GND + SW1 - 44 43 - GND + SW2 - 46 45 - +5V + +12V - 48 47 - +5V + -12V - 50 49 - SOUNDIN + + ***************************************************************************/ #ifndef MAME_BUS_MSX_SLOT_CARTRIDGE_H #define MAME_BUS_MSX_SLOT_CARTRIDGE_H #pragma once #include "slot.h" -#include "bus/msx/cart/cartridge.h" #include "imagedev/cartrom.h" -DECLARE_DEVICE_TYPE(MSX_SLOT_CARTRIDGE, msx_slot_cartridge_device) -DECLARE_DEVICE_TYPE(MSX_SLOT_YAMAHA_EXPANSION, msx_slot_yamaha_expansion_device) -DECLARE_DEVICE_TYPE(MSX_SLOT_YAMAHA_MINICART, msx_slot_yamaha_minicart_device) - - class msx_cart_interface; -class msx_slot_cartridge_device : public device_t +class msx_slot_cartridge_base_device : public device_t , public device_cartrom_image_interface , public device_slot_interface , public msx_internal_slot_interface { public: - msx_slot_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - auto irq_handler() { return m_irq_handler.bind(); } virtual image_init_result call_load() override; @@ -33,57 +57,25 @@ public: virtual const char *image_interface() const noexcept override { return "msx_cart"; } virtual const char *file_extensions() const noexcept override { return "mx1,bin,rom"; } - virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; + virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override = 0; DECLARE_WRITE_LINE_MEMBER(irq_out); protected: - msx_slot_cartridge_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); + msx_slot_cartridge_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); virtual void device_resolve_objects() override; virtual void device_start() override; devcb_write_line m_irq_handler; msx_cart_interface *m_cartridge; - - static int get_cart_type(const u8 *rom, u32 length); -}; - - - -class msx_slot_yamaha_expansion_device : public msx_slot_cartridge_device -{ -public: - msx_slot_yamaha_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - - virtual const char *image_interface() const noexcept override { return "msx_yamaha_60pin"; } - virtual const char *image_type_name() const noexcept override { return "cartridge60pin"; } - virtual const char *image_brief_type_name() const noexcept override { return "cart60p"; } - -protected: - virtual void device_start() override; -}; - - - -class msx_slot_yamaha_minicart_device : public msx_slot_cartridge_device -{ -public: - msx_slot_yamaha_minicart_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - - virtual const char *image_interface() const noexcept override { return "msx_yamaha_minicart"; } - virtual const char *image_type_name() const noexcept override { return "yamahaminicart"; } - virtual const char *image_brief_type_name() const noexcept override { return "mini"; } - -protected: - virtual void device_start() override; }; class msx_cart_interface : public device_interface { - friend class msx_slot_cartridge_device; + friend class msx_slot_cartridge_base_device; public: // This is called after loading cartridge contents and allows the cartridge @@ -105,14 +97,14 @@ protected: const char *get_feature(std::string_view feature_name) { return m_exp ? m_exp->get_feature(feature_name) : nullptr; } bool is_loaded_through_softlist() { return m_exp ? m_exp->loaded_through_softlist() : false; } DECLARE_WRITE_LINE_MEMBER(irq_out); - msx_slot_cartridge_device *parent_slot() const { return m_exp; } + msx_slot_cartridge_base_device *parent_slot() const { return m_exp; } address_space &memory_space() const; address_space &io_space() const; cpu_device &maincpu() const; memory_view::memory_view_entry *page(int i) { return m_page[i]; } private: - msx_slot_cartridge_device *m_exp; + msx_slot_cartridge_base_device *m_exp; memory_view::memory_view_entry *m_page[4]; }; diff --git a/src/mame/msx/msx.h b/src/mame/msx/msx.h index aaecee81fee..b5bf9c6bc90 100644 --- a/src/mame/msx/msx.h +++ b/src/mame/msx/msx.h @@ -8,6 +8,9 @@ #include "bus/centronics/ctronics.h" #include "bus/msx/ctrl/ctrl.h" #include "bus/msx/slot/cartridge.h" +#include "bus/msx/cart/cartridge.h" +#include "bus/msx/minicart/minicart.h" +#include "bus/msx/module/module.h" #include "cpu/z80/z80.h" #include "imagedev/cassette.h" #include "machine/buffer.h" -- cgit v1.2.3