diff options
Diffstat (limited to 'src/devices/bus/msx_cart/konami.cpp')
-rw-r--r-- | src/devices/bus/msx_cart/konami.cpp | 142 |
1 files changed, 80 insertions, 62 deletions
diff --git a/src/devices/bus/msx_cart/konami.cpp b/src/devices/bus/msx_cart/konami.cpp index e1d4e35321f..f5ac42be362 100644 --- a/src/devices/bus/msx_cart/konami.cpp +++ b/src/devices/bus/msx_cart/konami.cpp @@ -35,8 +35,12 @@ msx_cart_konami_device::msx_cart_konami_device(const machine_config &mconfig, co void msx_cart_konami_device::device_start() { save_item(NAME(m_selected_bank)); +} + - machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_konami_device::restore_banks), this)); +void msx_cart_konami_device::device_post_load() +{ + restore_banks(); } @@ -84,13 +88,13 @@ void msx_cart_konami_device::initialize_cartridge() } -READ8_MEMBER(msx_cart_konami_device::read_cart) +uint8_t msx_cart_konami_device::read_cart(offs_t offset) { return m_bank_base[offset >> 13][offset & 0x1fff]; } -WRITE8_MEMBER(msx_cart_konami_device::write_cart) +void msx_cart_konami_device::write_cart(offs_t offset, uint8_t data) { switch (offset & 0xe000) { @@ -141,20 +145,24 @@ msx_cart_konami_scc_device::msx_cart_konami_scc_device(const machine_config &mco } -MACHINE_CONFIG_START(msx_cart_konami_scc_device::device_add_mconfig) +void msx_cart_konami_scc_device::device_add_mconfig(machine_config &config) +{ // This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'. SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("k051649", K051649, XTAL(10'738'635)/3/2) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) -MACHINE_CONFIG_END + K051649(config, m_k051649, XTAL(10'738'635)/3/2).add_route(ALL_OUTPUTS, "mono", 0.15); +} void msx_cart_konami_scc_device::device_start() { save_item(NAME(m_selected_bank)); save_item(NAME(m_scc_active)); +} + - machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_konami_scc_device::restore_banks), this)); +void msx_cart_konami_scc_device::device_post_load() +{ + restore_banks(); } @@ -203,7 +211,7 @@ void msx_cart_konami_scc_device::initialize_cartridge() } -READ8_MEMBER(msx_cart_konami_scc_device::read_cart) +uint8_t msx_cart_konami_scc_device::read_cart(offs_t offset) { if ( m_scc_active && offset >= 0x9800 && offset < 0xa000 ) { @@ -211,13 +219,13 @@ READ8_MEMBER(msx_cart_konami_scc_device::read_cart) { if ((offset & 0xff) >= 0xe0) { - return m_k051649->k051649_test_r(space, offset & 0xff); + return m_k051649->k051649_test_r(); } return 0xff; } else { - return m_k051649->k051649_waveform_r(space, offset & 0x7f); + return m_k051649->k051649_waveform_r(offset & 0x7f); } } @@ -225,7 +233,7 @@ READ8_MEMBER(msx_cart_konami_scc_device::read_cart) } -WRITE8_MEMBER(msx_cart_konami_scc_device::write_cart) +void msx_cart_konami_scc_device::write_cart(offs_t offset, uint8_t data) { switch (offset & 0xf800) { @@ -255,27 +263,27 @@ WRITE8_MEMBER(msx_cart_konami_scc_device::write_cart) if (offset < 0x80) { - m_k051649->k051649_waveform_w(space, offset, data); + m_k051649->k051649_waveform_w(offset, data); } else if (offset < 0xa0) { offset &= 0x0f; if (offset < 0x0a) { - m_k051649->k051649_frequency_w(space, offset, data); + m_k051649->k051649_frequency_w(offset, data); } else if (offset < 0x0f) { - m_k051649->k051649_volume_w(space, offset - 0xa, data); + m_k051649->k051649_volume_w(offset - 0xa, data); } else { - m_k051649->k051649_keyonoff_w(space, 0, data); + m_k051649->k051649_keyonoff_w(data); } } else if (offset >= 0xe0) { - m_k051649->k051649_test_w(space, offset, data); + m_k051649->k051649_test_w(data); } } break; @@ -311,8 +319,12 @@ msx_cart_gamemaster2_device::msx_cart_gamemaster2_device(const machine_config &m void msx_cart_gamemaster2_device::device_start() { save_item(NAME(m_selected_bank)); +} + - machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_gamemaster2_device::restore_banks), this)); +void msx_cart_gamemaster2_device::device_post_load() +{ + restore_banks(); } @@ -397,7 +409,7 @@ void msx_cart_gamemaster2_device::initialize_cartridge() } -READ8_MEMBER(msx_cart_gamemaster2_device::read_cart) +uint8_t msx_cart_gamemaster2_device::read_cart(offs_t offset) { uint8_t bank = offset >> 13; @@ -431,7 +443,7 @@ READ8_MEMBER(msx_cart_gamemaster2_device::read_cart) } -WRITE8_MEMBER(msx_cart_gamemaster2_device::write_cart) +void msx_cart_gamemaster2_device::write_cart(offs_t offset, uint8_t data) { switch (offset & 0xf000) { @@ -472,13 +484,15 @@ msx_cart_synthesizer_device::msx_cart_synthesizer_device(const machine_config &m } -MACHINE_CONFIG_START(msx_cart_synthesizer_device::device_add_mconfig) +void msx_cart_synthesizer_device::device_add_mconfig(machine_config &config) +{ // This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'. SPEAKER(config, "speaker").front_center(); - MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.1) // unknown DAC - MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) - MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT) -MACHINE_CONFIG_END + DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.1); // unknown DAC + voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref")); + vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT); + vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT); +} void msx_cart_synthesizer_device::device_start() @@ -497,7 +511,7 @@ void msx_cart_synthesizer_device::initialize_cartridge() } -READ8_MEMBER(msx_cart_synthesizer_device::read_cart) +uint8_t msx_cart_synthesizer_device::read_cart(offs_t offset) { if (offset >= 0x4000 && offset < 0xc000 ) { @@ -507,7 +521,7 @@ READ8_MEMBER(msx_cart_synthesizer_device::read_cart) } -WRITE8_MEMBER(msx_cart_synthesizer_device::write_cart) +void msx_cart_synthesizer_device::write_cart(offs_t offset, uint8_t data) { if ((offset & 0xc010) == 0x4000) { @@ -545,12 +559,12 @@ msx_cart_konami_sound_device::msx_cart_konami_sound_device(const machine_config } -MACHINE_CONFIG_START(msx_cart_konami_sound_device::device_add_mconfig) +void msx_cart_konami_sound_device::device_add_mconfig(machine_config &config) +{ // This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'. SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("k052539", K051649, XTAL(10'738'635)/3/2) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) -MACHINE_CONFIG_END + K051649(config, m_k052539, XTAL(10'738'635)/3/2).add_route(ALL_OUTPUTS, "mono", 0.15); +} void msx_cart_konami_sound_device::device_start() @@ -559,8 +573,12 @@ void msx_cart_konami_sound_device::device_start() save_item(NAME(m_scc_active)); save_item(NAME(m_sccplus_active)); save_item(NAME(m_ram_enabled)); +} + - machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_konami_sound_device::restore_banks), this)); +void msx_cart_konami_sound_device::device_post_load() +{ + restore_banks(); } @@ -618,14 +636,14 @@ void msx_cart_konami_sound_device::initialize_cartridge() } -READ8_MEMBER(msx_cart_konami_sound_device::read_cart) +uint8_t msx_cart_konami_sound_device::read_cart(offs_t offset) { if ( m_scc_active && offset >= 0x9800 && offset < 0x9fe0 ) { offset &= 0xff; if (offset < 0x80) { - return m_k052539->k051649_waveform_r(space, offset); + return m_k052539->k051649_waveform_r(offset); } if (offset < 0xa0) { @@ -633,11 +651,11 @@ READ8_MEMBER(msx_cart_konami_sound_device::read_cart) } if (offset < 0xc0) { - return m_k052539->k051649_waveform_r(space, offset & 0x9f); + return m_k052539->k051649_waveform_r(offset & 0x9f); } if (offset < 0xe0) { - return m_k052539->k051649_test_r(space, offset & 0xff); + return m_k052539->k051649_test_r(); } return 0xff; } @@ -647,11 +665,11 @@ READ8_MEMBER(msx_cart_konami_sound_device::read_cart) if (offset < 0xa0) { - return m_k052539->k052539_waveform_r(space, offset); + return m_k052539->k052539_waveform_r(offset); } if (offset >= 0xc0 && offset < 0xe0) { - return m_k052539->k051649_test_r(space, offset); + return m_k052539->k051649_test_r(); } return 0xff; } @@ -666,7 +684,7 @@ READ8_MEMBER(msx_cart_konami_sound_device::read_cart) } -WRITE8_MEMBER(msx_cart_konami_sound_device::write_cart) +void msx_cart_konami_sound_device::write_cart(offs_t offset, uint8_t data) { switch (offset & 0xe000) { @@ -714,27 +732,27 @@ WRITE8_MEMBER(msx_cart_konami_sound_device::write_cart) if (offset < 0x80) { - m_k052539->k051649_waveform_w(space, offset, data); + m_k052539->k051649_waveform_w(offset, data); } else if (offset < 0xa0) { offset &= 0x0f; if (offset < 0x0a) { - m_k052539->k051649_frequency_w(space, offset, data); + m_k052539->k051649_frequency_w(offset, data); } else if (offset < 0x0f) { - m_k052539->k051649_volume_w(space, offset - 0xa, data); + m_k052539->k051649_volume_w(offset - 0xa, data); } else { - m_k052539->k051649_keyonoff_w(space, 0, data); + m_k052539->k051649_keyonoff_w(data); } } else if (offset >= 0xe0) { - m_k052539->k051649_test_w(space, offset, data); + m_k052539->k051649_test_w(data); } } break; @@ -777,27 +795,27 @@ WRITE8_MEMBER(msx_cart_konami_sound_device::write_cart) offset &= 0xff; if (offset < 0xa0) { - m_k052539->k052539_waveform_w(space, offset, data); + m_k052539->k052539_waveform_w(offset, data); } else if (offset < 0xc0) { offset &= 0x0f; if (offset < 0x0a) { - m_k052539->k051649_frequency_w(space, offset, data); + m_k052539->k051649_frequency_w(offset, data); } else if (offset < 0x0f) { - m_k052539->k051649_volume_w(space, offset - 0x0a, data); + m_k052539->k051649_volume_w(offset - 0x0a, data); } else if (offset == 0x0f) { - m_k052539->k051649_keyonoff_w(space, 0, data); + m_k052539->k051649_keyonoff_w(data); } } else if (offset < 0xe0) { - m_k052539->k051649_test_w(space, offset, data); + m_k052539->k051649_test_w(data); } } } @@ -872,22 +890,22 @@ void msx_cart_keyboard_master_device::vlm_map(address_map &map) } -MACHINE_CONFIG_START(msx_cart_keyboard_master_device::device_add_mconfig) +void msx_cart_keyboard_master_device::device_add_mconfig(machine_config &config) +{ // This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'. SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("vlm5030", VLM5030, XTAL(3'579'545)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) - MCFG_DEVICE_ADDRESS_MAP(0, vlm_map) -MACHINE_CONFIG_END + VLM5030(config, m_vlm5030, XTAL(3'579'545)); + m_vlm5030->add_route(ALL_OUTPUTS, "mono", 0.40); + m_vlm5030->set_addrmap(0, &msx_cart_keyboard_master_device::vlm_map); +} void msx_cart_keyboard_master_device::device_start() { // Install IO read/write handlers - address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO); - space.install_write_handler(0x00, 0x00, write8_delegate(FUNC(vlm5030_device::data_w), m_vlm5030.target())); - space.install_write_handler(0x20, 0x20, write8_delegate(FUNC(msx_cart_keyboard_master_device::io_20_w), this)); - space.install_read_handler(0x00, 0x00, read8_delegate(FUNC(msx_cart_keyboard_master_device::io_00_r), this)); + io_space().install_write_handler(0x00, 0x00, write8smo_delegate(FUNC(vlm5030_device::data_w), m_vlm5030.target())); + io_space().install_write_handler(0x20, 0x20, write8smo_delegate(FUNC(msx_cart_keyboard_master_device::io_20_w), this)); + io_space().install_read_handler(0x00, 0x00, read8smo_delegate(FUNC(msx_cart_keyboard_master_device::io_00_r), this)); } @@ -900,7 +918,7 @@ void msx_cart_keyboard_master_device::initialize_cartridge() } -READ8_MEMBER(msx_cart_keyboard_master_device::read_cart) +uint8_t msx_cart_keyboard_master_device::read_cart(offs_t offset) { if (offset >= 0x4000 && offset < 0x8000) { @@ -910,13 +928,13 @@ READ8_MEMBER(msx_cart_keyboard_master_device::read_cart) } -READ8_MEMBER(msx_cart_keyboard_master_device::read_vlm) +uint8_t msx_cart_keyboard_master_device::read_vlm(offs_t offset) { return m_rom_vlm5030[offset]; } -WRITE8_MEMBER(msx_cart_keyboard_master_device::io_20_w) +void msx_cart_keyboard_master_device::io_20_w(uint8_t data) { m_vlm5030->rst((data & 0x01) ? 1 : 0); m_vlm5030->vcu((data & 0x04) ? 1 : 0); @@ -924,7 +942,7 @@ WRITE8_MEMBER(msx_cart_keyboard_master_device::io_20_w) } -READ8_MEMBER(msx_cart_keyboard_master_device::io_00_r) +uint8_t msx_cart_keyboard_master_device::io_00_r() { return m_vlm5030->bsy() ? 0x10 : 0x00; } |