From 22b50ac0efdc338f1a7f6bc3b3d6158132319f90 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 15 Jan 2024 11:42:26 +0100 Subject: sw1000xg: Start adding stuff [Matt, O. Galibert] --- src/devices/bus/pci/pci_slot.cpp | 6 +-- src/devices/bus/pci/sw1000xg.cpp | 64 +++++++++++++++++++++++++++++- src/devices/bus/pci/sw1000xg.h | 12 ++++++ src/devices/bus/pci/ymp21.cpp | 86 +++++++++++++++++++++++++++++++++++++--- src/devices/bus/pci/ymp21.h | 18 ++++++++- 5 files changed, 174 insertions(+), 12 deletions(-) diff --git a/src/devices/bus/pci/pci_slot.cpp b/src/devices/bus/pci/pci_slot.cpp index b726442f426..9cfed69a979 100644 --- a/src/devices/bus/pci/pci_slot.cpp +++ b/src/devices/bus/pci/pci_slot.cpp @@ -17,9 +17,9 @@ DEFINE_DEVICE_TYPE(PCI_SLOT, pci_slot_device, "pci_slot", "PCI extension motherboard port") pci_slot_device::pci_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, PCI_SLOT, tag, owner, clock), - device_single_card_slot_interface(mconfig, *this), - m_irq_cb(*this) + device_t(mconfig, PCI_SLOT, tag, owner, clock), + device_single_card_slot_interface(mconfig, *this), + m_irq_cb(*this) { } diff --git a/src/devices/bus/pci/sw1000xg.cpp b/src/devices/bus/pci/sw1000xg.cpp index 9d426ac2a43..e1ceb098eeb 100644 --- a/src/devices/bus/pci/sw1000xg.cpp +++ b/src/devices/bus/pci/sw1000xg.cpp @@ -3,11 +3,14 @@ #include "emu.h" #include "sw1000xg.h" +#include "speaker.h" DEFINE_DEVICE_TYPE(SW1000XG, sw1000xg_device, "sw1000xg", "Yamaha SW1000XG") sw1000xg_device::sw1000xg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : ymp21_device(mconfig, SW1000XG, tag, owner, clock) + : ymp21_device(mconfig, SW1000XG, tag, owner, clock), + m_maincpu(*this, "maincpu"), + m_swp30(*this, "swp30") { set_ids(0x10731000, 0x00, 0x040100, 0x10731000); } @@ -21,3 +24,62 @@ void sw1000xg_device::device_reset() { ymp21_device::device_reset(); } + +void sw1000xg_device::h8_map(address_map &map) +{ + map(0x000000, 0x0fffff).rom().region("maincpu", 0); + map(0x200000, 0x21ffff).ram(); + map(0x400000, 0x401fff).m(m_swp30, FUNC(swp30_device::map)); +} + +void sw1000xg_device::swp30_map(address_map &map) +{ + // map(0x000000, 0x1fffff).rom().region("swp30", 0).mirror(0x200000); + // map(0x400000, 0x4fffff).rom().region("swp30", 0x800000).mirror(0x300000); + // map(0x800000, 0x9fffff).rom().region("swp30", 0x1000000).mirror(0x200000); +} + +#define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \ + ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(bios)) + +ROM_START( sw1000xg ) + ROM_REGION( 0x100000, "maincpu", 0 ) + ROM_DEFAULT_BIOS("v166") + ROM_SYSTEM_BIOS( 0, "v166", "v1.06.06" ) + ROM_LOAD16_WORD_SWAP_BIOS( 0, "1.06.06_xv561d0.ic102", 0x000000, 0x100000, CRC(6734482c) SHA1(dff42c0f0ad0f0ec9587cd2a53ba2b3836b1d587) ) + ROM_SYSTEM_BIOS( 1, "v161", "v1.06.01" ) + ROM_LOAD16_WORD_SWAP_BIOS( 1, "1.06.01_xv561d0.ic102", 0x000000, 0x100000, CRC(c788aa9e) SHA1(d0861e9604a8e92f6adfc451e97d62d49d40f033) ) + ROM_SYSTEM_BIOS( 2, "v152", "v1.05.02" ) + ROM_LOAD16_WORD_SWAP_BIOS( 2, "1.05.02_xv561d0.ic102", 0x000000, 0x100000, CRC(9152a052) SHA1(20759f4047f8dc3cb21efef538f78393d7a68521) ) + ROM_SYSTEM_BIOS( 3, "v150", "v1.05.00" ) + ROM_LOAD16_WORD_SWAP_BIOS( 3, "1.05.00_xv561d0.ic102", 0x000000, 0x100000, CRC(36e199df) SHA1(efe2d3000b49a4a93705fee5ffd5456953ef5a22) ) + ROM_SYSTEM_BIOS( 4, "v140", "v1.04.00" ) + ROM_LOAD16_WORD_SWAP_BIOS( 4, "1.04.00_xv561d0.ic102", 0x000000, 0x100000, CRC(9f5bfec8) SHA1(4ced122c8cac7a9c022d86fffe121042ad4be6a2) ) + + ROM_REGION( 0x1400000, "swp30", 0 ) + ROM_LOAD32_WORD( "xv389a0.ic122", 0x0000000, 0x800000, CRC(92e11205) SHA1(72ec39e03e4e5ddf6137faa798c0ec3c23905855) ) + ROM_LOAD32_WORD( "xv390a0.ic121", 0x0000002, 0x800000, CRC(cbc80585) SHA1(1903ed7f1292e6117a448fec19e2b712f3815964) ) + ROM_LOAD32_WORD( "xt445a0-828.ic124", 0x0800000, 0x200000, CRC(225c2280) SHA1(23b5e046fd2e2ac01af3e6dc6357c5c6547b286b) ) + ROM_LOAD32_WORD( "xt461a0-829.ic123", 0x0800002, 0x200000, CRC(a1d138a3) SHA1(46a7a7225cd7e1818ba551325d2af5ac1bf5b2bf) ) + +ROM_END + +const tiny_rom_entry *sw1000xg_device::device_rom_region() const +{ + return ROM_NAME(sw1000xg); +} + +void sw1000xg_device::device_add_mconfig(machine_config &config) +{ + H83002(config, m_maincpu, 16_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &sw1000xg_device::h8_map); + + SPEAKER(config, "lspeaker").front_left(); + SPEAKER(config, "rspeaker").front_right(); + + SWP30(config, m_swp30); + m_swp30->set_addrmap(AS_DATA, &sw1000xg_device::swp30_map); + m_swp30->add_route(0, "lspeaker", 1.0); + m_swp30->add_route(1, "rspeaker", 1.0); +} + diff --git a/src/devices/bus/pci/sw1000xg.h b/src/devices/bus/pci/sw1000xg.h index b786ebc3439..800124893f0 100644 --- a/src/devices/bus/pci/sw1000xg.h +++ b/src/devices/bus/pci/sw1000xg.h @@ -8,6 +8,9 @@ #include "ymp21.h" +#include "cpu/h8/h83002.h" +#include "sound/swp30.h" + class sw1000xg_device : public ymp21_device { public: sw1000xg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); @@ -15,6 +18,15 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; + const tiny_rom_entry *device_rom_region() const override; + virtual void device_add_mconfig(machine_config &config) override; + +private: + required_device m_maincpu; + required_device m_swp30; + + void h8_map(address_map &map); + void swp30_map(address_map &map); }; DECLARE_DEVICE_TYPE(SW1000XG, sw1000xg_device) diff --git a/src/devices/bus/pci/ymp21.cpp b/src/devices/bus/pci/ymp21.cpp index 41a20cfb35f..802ae062e04 100644 --- a/src/devices/bus/pci/ymp21.cpp +++ b/src/devices/bus/pci/ymp21.cpp @@ -5,7 +5,8 @@ #include "ymp21.h" ymp21_device::ymp21_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) - : pci_card_device(mconfig, type, tag, owner, clock) + : pci_card_device(mconfig, type, tag, owner, clock), + m_mailbox_buffer(*this, "mailbox", 0x80 * 5, ENDIANNESS_LITTLE) { } @@ -14,27 +15,100 @@ void ymp21_device::device_start() pci_card_device::device_start(); add_map(0x40000, M_MEM, FUNC(ymp21_device::map)); intr_pin = 0x01; + + save_item(NAME(m_mailbox_size)); } void ymp21_device::device_reset() { pci_card_device::device_reset(); + std::fill(m_mailbox_size.begin(), m_mailbox_size.end(), 0); } void ymp21_device::map(address_map &map) { - map(0x00000, 0x3ffff).rw(FUNC(ymp21_device::read), FUNC(ymp21_device::write)); + map(0x3e000, 0x3e003).rw(FUNC(ymp21_device::uart_r), FUNC(ymp21_device::uart_w)); + + map(0x3f000, 0x3f07f).w(FUNC(ymp21_device::mailbox_w)).select(0x00700); + map(0x3f080, 0x3f083).rw(FUNC(ymp21_device::mailbox_size_r), FUNC(ymp21_device::mailbox_size_w)).select(0x00700); + map(0x3f084, 0x3f087).w(FUNC(ymp21_device::mailbox_address_w)).select(0x00700); + + map(0x3ff00, 0x3ff03).rw(FUNC(ymp21_device::port0_r), FUNC(ymp21_device::port0_w)); + map(0x3ff04, 0x3ff07).rw(FUNC(ymp21_device::status_r), FUNC(ymp21_device::irq_w)); + map(0x3ff10, 0x3ff13).w(FUNC(ymp21_device::port0_w)); +} + +void ymp21_device::uart_w(offs_t offset, u8 data) +{ + logerror("uart_w %d, %02x\n", offset, data); +} + +u8 ymp21_device::uart_r(offs_t offset) +{ + logerror("uart_r %d\n", offset); + return 0; +} + +void ymp21_device::port0_w(u32 data) +{ + logerror("port0_w %08x\n", data); +} + +u32 ymp21_device::port0_r() +{ + logerror("port0_r\n"); + return 0; +} + +void ymp21_device::port1_w(u32 data) +{ + logerror("port1_w %08x\n", data); } -u32 ymp21_device::read(offs_t offset, u32 mem_mask) +void ymp21_device::irq_w(u32 data) { - logerror("ym read %05x %08x\n", offset*4, mem_mask); + logerror("irq_w %08x\n", data); +} + +u32 ymp21_device::status_r() +{ + logerror("status_r\n"); return 0; } -void ymp21_device::write(offs_t offset, u32 data, u32 mem_mask) +void ymp21_device::mailbox_w(offs_t offset, u32 data, u32 mem_mask) { - logerror("ym write %05x, %08x %08x\n", offset*4, data, mem_mask); + offs_t slot = offset >> 6; + if(slot >= 5) + return; + + COMBINE_DATA(&m_mailbox_buffer[(slot << 5) | offset]); } +void ymp21_device::mailbox_size_w(offs_t offset, u32 data) +{ + offs_t slot = offset >> 6; + if(slot >= 5) + return; + m_mailbox_size[slot] = data; +} + +u32 ymp21_device::mailbox_size_r(offs_t offset) +{ + offs_t slot = offset >> 6; + if(slot >= 5) + return 0; + + return m_mailbox_size[slot] | 0x200000; +} + +void ymp21_device::mailbox_address_w(offs_t offset, u32 data) +{ + offs_t slot = offset >> 6; + if(slot >= 5) + return; + + logerror("mailbox upload %d %x.%04x %02x\n", slot, (data >> 8) & 0xff, data >> 16, m_mailbox_size[slot] >> 16); + m_mailbox_size[slot] = 0; +} diff --git a/src/devices/bus/pci/ymp21.h b/src/devices/bus/pci/ymp21.h index 4bbf9a9e812..0e8eebb09f9 100644 --- a/src/devices/bus/pci/ymp21.h +++ b/src/devices/bus/pci/ymp21.h @@ -18,10 +18,24 @@ protected: virtual void device_reset() override; private: + memory_share_creator m_mailbox_buffer; + std::array m_mailbox_size; + void map(address_map &map); - u32 read(offs_t offset, u32 mem_mask); - void write(offs_t offset, u32 data, u32 mem_mask); + void uart_w(offs_t offset, u8 data); + u8 uart_r(offs_t offset); + + void port0_w(u32 data); + u32 port0_r(); + void port1_w(u32 data); + void irq_w(u32 data); + u32 status_r(); + + void mailbox_w(offs_t offset, u32 data, u32 mem_mask); + void mailbox_size_w(offs_t offset, u32 data); + u32 mailbox_size_r(offs_t offset); + void mailbox_address_w(offs_t offset, u32 data); }; #endif -- cgit v1.2.3