From 4cdf369921fe6fd32c14cffc91bbfbd4b8fb29fe Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Sat, 25 May 2019 18:15:12 +0100 Subject: coco2: Converted all coco/dragon extension devices to use cts handlers. --- src/devices/bus/coco/coco_dcmodem.cpp | 16 +++++++- src/devices/bus/coco/coco_fdc.cpp | 13 ++++++- src/devices/bus/coco/coco_multi.cpp | 27 ++++++++++--- src/devices/bus/coco/coco_orch90.cpp | 19 ++++++++-- src/devices/bus/coco/coco_pak.cpp | 33 ++++++++++++---- src/devices/bus/coco/coco_pak.h | 4 +- src/devices/bus/coco/coco_rs232.cpp | 17 ++++++++- src/devices/bus/coco/coco_t4426.cpp | 50 +++++++++++++++--------- src/devices/bus/coco/cococart.cpp | 8 +--- src/devices/bus/coco/dragon_fdc.cpp | 18 +++++++++ src/devices/bus/coco/dragon_jcbsnd.cpp | 14 ++++++- src/devices/bus/coco/dragon_jcbsnd.h | 25 ++++++------ src/mame/includes/coco.h | 2 +- src/mame/includes/coco12.h | 1 - src/mame/machine/6883sam.cpp | 69 +++++++++++++++++----------------- src/mame/machine/6883sam.h | 3 +- src/mame/machine/coco12.cpp | 11 ------ 17 files changed, 222 insertions(+), 108 deletions(-) diff --git a/src/devices/bus/coco/coco_dcmodem.cpp b/src/devices/bus/coco/coco_dcmodem.cpp index bebd6c275d5..ab6ba20a622 100644 --- a/src/devices/bus/coco/coco_dcmodem.cpp +++ b/src/devices/bus/coco/coco_dcmodem.cpp @@ -41,6 +41,7 @@ namespace : device_t(mconfig, COCO_DCMODEM, tag, owner, clock) , device_cococart_interface(mconfig, *this) , m_uart(*this, UART_TAG) + , m_eprom(*this, "eprom") { } @@ -67,17 +68,20 @@ namespace // CoCo cartridge level overrides virtual uint8_t *get_cart_base() override { - return memregion("eprom")->base(); + return m_eprom->base(); } virtual memory_region* get_cart_memregion() override { - return memregion("eprom"); + return m_eprom; } + virtual DECLARE_READ8_MEMBER(cts_read) override; + private: // internal state required_device m_uart; + required_memory_region m_eprom; }; }; @@ -118,4 +122,12 @@ const tiny_rom_entry *coco_dc_modem_device::device_rom_region() const return ROM_NAME(coco_dcmodem); } +//------------------------------------------------- +// cts_read +//------------------------------------------------- + +READ8_MEMBER(coco_dc_modem_device::cts_read) +{ + return m_eprom->base()[offset & 0x1fff]; +} diff --git a/src/devices/bus/coco/coco_fdc.cpp b/src/devices/bus/coco/coco_fdc.cpp index c7bd40d8952..eded4ed4306 100644 --- a/src/devices/bus/coco/coco_fdc.cpp +++ b/src/devices/bus/coco/coco_fdc.cpp @@ -11,7 +11,7 @@ which mostly uses the same command set with some subtle differences, most notably the 2797 handles disk side select internally. The Dragon Alpha also uses the WD2797, however as this is a built in interface and not an external - cartrige, it is dealt with in the main coco.cpp file. + cartridge, it is dealt with in the main coco.cpp file. The wd's variables are mapped to $FF48-$FF4B on the CoCo and on $FF40-$FF43 on the Dragon. In addition, there is another register @@ -89,6 +89,7 @@ protected: }; // device-level overrides + virtual DECLARE_READ8_MEMBER(cts_read) override; virtual DECLARE_READ8_MEMBER(scs_read) override; virtual DECLARE_WRITE8_MEMBER(scs_write) override; virtual void device_add_mconfig(machine_config &config) override; @@ -311,6 +312,16 @@ void coco_fdc_device_base::dskreg_w(uint8_t data) } +//------------------------------------------------- +// cts_read +//------------------------------------------------- + +READ8_MEMBER(coco_fdc_device_base::cts_read) +{ + return memregion("eprom")->base()[offset]; +} + + //------------------------------------------------- // scs_read //------------------------------------------------- diff --git a/src/devices/bus/coco/coco_multi.cpp b/src/devices/bus/coco/coco_multi.cpp index 628a550fe07..2b9f890e421 100644 --- a/src/devices/bus/coco/coco_multi.cpp +++ b/src/devices/bus/coco/coco_multi.cpp @@ -102,6 +102,8 @@ namespace // device-level overrides virtual void device_start() override; virtual void device_reset() override; + virtual READ8_MEMBER(cts_read) override; + virtual WRITE8_MEMBER(cts_write) override; virtual READ8_MEMBER(scs_read) override; virtual WRITE8_MEMBER(scs_write) override; virtual void set_sound_enable(bool sound_enable) override; @@ -355,13 +357,8 @@ void coco_multipak_device::set_select(uint8_t new_select) cococart_slot_device::line_value old_cart = active_cts_slot().get_line_value(line::CART); // change value - uint8_t xorval = m_select ^ new_select; m_select = new_select; - // did the cartridge base change? - if (xorval & 0x03) - cart_base_changed(); - // did the CART line change? line_value new_cart = active_cts_slot().get_line_value(line::CART); if (new_cart != old_cart) @@ -454,6 +451,26 @@ uint32_t coco_multipak_device::get_cart_size() } +//------------------------------------------------- +// cts_read +//------------------------------------------------- + +READ8_MEMBER(coco_multipak_device::cts_read) +{ + return active_cts_slot().cts_read(space, offset); +} + + +//------------------------------------------------- +// cts_write +//------------------------------------------------- + +WRITE8_MEMBER(coco_multipak_device::cts_write) +{ + active_cts_slot().cts_write(space, offset, data); +} + + //------------------------------------------------- // scs_read //------------------------------------------------- diff --git a/src/devices/bus/coco/coco_orch90.cpp b/src/devices/bus/coco/coco_orch90.cpp index 2ad8afdaae1..e7506be7c2b 100644 --- a/src/devices/bus/coco/coco_orch90.cpp +++ b/src/devices/bus/coco/coco_orch90.cpp @@ -21,7 +21,7 @@ addressing CPU registers to run the 6809 at 2x speed. "P" + "ENTER" will play at regular CPU speed. The difference should be - very noticable. + very noticeable. ***************************************************************************/ @@ -61,6 +61,7 @@ namespace coco_orch90_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, COCO_ORCH90, tag, owner, clock) , device_cococart_interface(mconfig, *this) + , m_eprom(*this, "eprom") , m_ldac(*this, "ldac") , m_rdac(*this, "rdac") { @@ -89,19 +90,22 @@ namespace // CoCo cartridge level overrides virtual uint8_t *get_cart_base() override { - return memregion("eprom")->base(); + return m_eprom->base(); } virtual memory_region* get_cart_memregion() override { - return memregion("eprom"); + return m_eprom; } + virtual DECLARE_READ8_MEMBER(cts_read) override; + private: WRITE8_MEMBER(write_left) { m_ldac->write(data); } WRITE8_MEMBER(write_right) { m_rdac->write(data); } // internal state + required_memory_region m_eprom; required_device m_ldac; required_device m_rdac; }; @@ -123,6 +127,15 @@ void coco_orch90_device::device_add_mconfig(machine_config &config) vref.add_route(0, "rdac", 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, "rdac", -1.0, DAC_VREF_NEG_INPUT); } +//------------------------------------------------- +// cts_read +//------------------------------------------------- + +READ8_MEMBER(coco_orch90_device::cts_read) +{ + return m_eprom->base()[offset & 0x1fff]; +} + //************************************************************************** // DEVICE DECLARATION diff --git a/src/devices/bus/coco/coco_pak.cpp b/src/devices/bus/coco/coco_pak.cpp index 16f17441ed4..dea7632e7dc 100644 --- a/src/devices/bus/coco/coco_pak.cpp +++ b/src/devices/bus/coco/coco_pak.cpp @@ -58,7 +58,7 @@ DEFINE_DEVICE_TYPE(COCO_PAK, coco_pak_device, "cocopak", "CoCo Program PAK") coco_pak_device::coco_pak_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) , device_cococart_interface(mconfig, *this) - , m_cart(nullptr), m_autostart(*this, CART_AUTOSTART_TAG) + , m_cart(nullptr), m_eprom(*this, CARTSLOT_TAG), m_autostart(*this, CART_AUTOSTART_TAG) { } @@ -127,7 +127,7 @@ void coco_pak_device::device_reset() uint8_t* coco_pak_device::get_cart_base() { - return memregion(CARTSLOT_TAG)->base(); + return m_eprom->base(); } /*------------------------------------------------- @@ -136,7 +136,19 @@ uint8_t* coco_pak_device::get_cart_base() memory_region* coco_pak_device::get_cart_memregion() { - return memregion(CARTSLOT_TAG); + return m_eprom; +} + +//------------------------------------------------- +// cts_read +//------------------------------------------------- + +READ8_MEMBER(coco_pak_device::cts_read) +{ + if (offset < m_eprom->bytes()) + return m_eprom->base()[offset]; + else + return 0x00; } @@ -198,7 +210,6 @@ void coco_pak_banked_device::device_reset() coco_pak_device::device_reset(); m_pos = 0; - cart_base_changed(); } //------------------------------------------------- @@ -207,10 +218,7 @@ void coco_pak_banked_device::device_reset() uint8_t *coco_pak_banked_device::get_cart_base() { - uint8_t *rom = memregion(CARTSLOT_TAG)->base(); - uint32_t rom_length = memregion(CARTSLOT_TAG)->bytes(); - - return &rom[(m_pos * 0x4000) % rom_length]; + return m_eprom->base() + (m_pos * 0x4000) % m_eprom->bytes(); } //------------------------------------------------- @@ -222,6 +230,15 @@ uint32_t coco_pak_banked_device::get_cart_size() return 0x4000; } +//------------------------------------------------- +// cts_read +//------------------------------------------------- + +READ8_MEMBER(coco_pak_banked_device::cts_read) +{ + return m_eprom->base()[(m_pos * 0x4000) % m_eprom->bytes() | offset]; +} + //------------------------------------------------- // scs_write //------------------------------------------------- diff --git a/src/devices/bus/coco/coco_pak.h b/src/devices/bus/coco/coco_pak.h index 43168e5e32c..105ca7d319b 100644 --- a/src/devices/bus/coco/coco_pak.h +++ b/src/devices/bus/coco/coco_pak.h @@ -35,10 +35,11 @@ protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; + virtual DECLARE_READ8_MEMBER(cts_read) override; // internal state device_image_interface *m_cart; - + required_memory_region m_eprom; optional_ioport m_autostart; }; @@ -60,6 +61,7 @@ protected: virtual void device_reset() override; virtual uint8_t *get_cart_base() override; virtual uint32_t get_cart_size() override; + virtual DECLARE_READ8_MEMBER(cts_read) override; virtual DECLARE_WRITE8_MEMBER(scs_write) override; private: diff --git a/src/devices/bus/coco/coco_rs232.cpp b/src/devices/bus/coco/coco_rs232.cpp index 5a124986792..5668034b80d 100644 --- a/src/devices/bus/coco/coco_rs232.cpp +++ b/src/devices/bus/coco/coco_rs232.cpp @@ -39,6 +39,7 @@ namespace coco_rs232_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, COCO_RS232, tag, owner, clock) , device_cococart_interface(mconfig, *this) + , m_eprom(*this, "eprom") , m_uart(*this, UART_TAG) { } @@ -65,16 +66,19 @@ namespace // CoCo cartridge level overrides virtual uint8_t *get_cart_base() override { - return memregion("eprom")->base(); + return m_eprom->base(); } virtual memory_region* get_cart_memregion() override { - return memregion("eprom"); + return m_eprom; } + virtual DECLARE_READ8_MEMBER(cts_read) override; + private: // internal state + required_memory_region m_eprom; required_device m_uart; }; }; @@ -112,6 +116,15 @@ const tiny_rom_entry *coco_rs232_device::device_rom_region() const return ROM_NAME(coco_rs232_device); } +//------------------------------------------------- +// cts_read +//------------------------------------------------- + +READ8_MEMBER(coco_rs232_device::cts_read) +{ + return m_eprom->base()[offset & 0x0fff]; +} + //************************************************************************** // DEVICE DECLARATION //************************************************************************** diff --git a/src/devices/bus/coco/coco_t4426.cpp b/src/devices/bus/coco/coco_t4426.cpp index 11c4499990a..4bb44e5949a 100644 --- a/src/devices/bus/coco/coco_t4426.cpp +++ b/src/devices/bus/coco/coco_t4426.cpp @@ -129,17 +129,18 @@ namespace optional_ioport m_autostart; + virtual DECLARE_READ8_MEMBER(cts_read) override; virtual DECLARE_READ8_MEMBER(scs_read) override; virtual DECLARE_WRITE8_MEMBER(scs_write) override; private: // internal state + required_memory_region m_eprom; + required_memory_region m_eprom_banked; required_device m_uart; required_device m_pia; required_device m_brg; required_ioport m_serial_baud; - - void set_bank(); }; }; @@ -241,6 +242,8 @@ coco_t4426_device::coco_t4426_device(const machine_config &mconfig, device_type , m_cart(nullptr) , m_select(0) , m_autostart(*this, CART_AUTOSTART_TAG) + , m_eprom(*this, CARTSLOT_TAG) + , m_eprom_banked(*this, CARTBANK_TAG) , m_uart(*this, UART_TAG) , m_pia(*this, PIA_TAG) , m_brg(*this, BRG_TAG) @@ -293,7 +296,7 @@ void coco_t4426_device::device_reset() LOG("%s()\n", FUNCNAME ); auto cart_line = line_value::Q; set_line_value(line::CART, cart_line); - set_bank(); + m_select = 0x00; // Set up the BRG divider statically to X1 m_brg->rsa_w( ASSERT_LINE ); @@ -398,26 +401,39 @@ WRITE8_MEMBER( coco_t4426_device::pia_A_w ) { LOGPIA("%s(%02x)\n", FUNCNAME, data); m_select = data; - set_bank(); } -void coco_t4426_device::set_bank() +/*------------------------------------------------- + cts_read +-------------------------------------------------*/ + +READ8_MEMBER(coco_t4426_device::cts_read) { - uint8_t *cartbase = memregion(CARTSLOT_TAG)->base(); - uint8_t *bankbase = memregion(CARTBANK_TAG)->base(); + uint8_t result = 0x00; - switch (m_select) + switch (offset & 0x2000) { - case 0: - case ROM0:memcpy(cartbase, bankbase + 0x0000, 0x2000); break; - case ROM1:memcpy(cartbase, bankbase + 0x2000, 0x2000); break; - case ROM2:memcpy(cartbase, bankbase + 0x4000, 0x2000); break; - case ROM3:memcpy(cartbase, bankbase + 0x6000, 0x2000); break; - case ROM4:memcpy(cartbase, bankbase + 0x8000, 0x2000); break; - case ROM5:memcpy(cartbase, bankbase + 0xa000, 0x2000); break; - case ROM6:memcpy(cartbase, bankbase + 0xc000, 0x2000); break; - case ROM7:memcpy(cartbase, bankbase + 0xe000, 0x2000); break; + case 0x0000: + switch (m_select) + { + case 0: + case ROM0:result = m_eprom_banked->base()[0x0000 | offset]; break; + case ROM1:result = m_eprom_banked->base()[0x2000 | offset]; break; + case ROM2:result = m_eprom_banked->base()[0x4000 | offset]; break; + case ROM3:result = m_eprom_banked->base()[0x6000 | offset]; break; + case ROM4:result = m_eprom_banked->base()[0x8000 | offset]; break; + case ROM5:result = m_eprom_banked->base()[0xa000 | offset]; break; + case ROM6:result = m_eprom_banked->base()[0xc000 | offset]; break; + case ROM7:result = m_eprom_banked->base()[0xe000 | offset]; break; + } + break; + + case 0x2000: + result = m_eprom->base()[offset]; + break; } + + return result; } /*------------------------------------------------- diff --git a/src/devices/bus/coco/cococart.cpp b/src/devices/bus/coco/cococart.cpp index 6932629e746..990cbde61c4 100644 --- a/src/devices/bus/coco/cococart.cpp +++ b/src/devices/bus/coco/cococart.cpp @@ -532,13 +532,7 @@ void device_cococart_interface::interface_pre_start() READ8_MEMBER(device_cococart_interface::cts_read) { - memory_region *cart_mem = get_cart_memregion(); - offs_t cart_length = cart_mem->bytes(); - - if (cart_mem) - return cart_mem->base()[offset & (cart_length - 1)]; - else - return 0x00; + return 0x00; } diff --git a/src/devices/bus/coco/dragon_fdc.cpp b/src/devices/bus/coco/dragon_fdc.cpp index caa5780ff87..48ab81501a5 100644 --- a/src/devices/bus/coco/dragon_fdc.cpp +++ b/src/devices/bus/coco/dragon_fdc.cpp @@ -99,6 +99,7 @@ namespace dragon_fdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); // device-level overrides + virtual DECLARE_READ8_MEMBER(cts_read) override; virtual DECLARE_READ8_MEMBER(scs_read) override; virtual DECLARE_WRITE8_MEMBER(scs_write) override; virtual void device_add_mconfig(machine_config &config) override; @@ -120,6 +121,7 @@ namespace premier_fdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); // device-level overrides + virtual DECLARE_READ8_MEMBER(cts_read) override; virtual DECLARE_READ8_MEMBER(scs_read) override; virtual DECLARE_WRITE8_MEMBER(scs_write) override; virtual void device_add_mconfig(machine_config &config) override; @@ -287,6 +289,22 @@ void premier_fdc_device_base::dskreg_w(uint8_t data) } +//------------------------------------------------- +// cts_read +//------------------------------------------------- + +READ8_MEMBER(dragon_fdc_device_base::cts_read) +{ + return memregion("eprom")->base()[offset]; +} + + +READ8_MEMBER(premier_fdc_device_base::cts_read) +{ + return memregion("eprom")->base()[offset]; +} + + //------------------------------------------------- // scs_read //------------------------------------------------- diff --git a/src/devices/bus/coco/dragon_jcbsnd.cpp b/src/devices/bus/coco/dragon_jcbsnd.cpp index efb2bc42a62..29f664a9a77 100644 --- a/src/devices/bus/coco/dragon_jcbsnd.cpp +++ b/src/devices/bus/coco/dragon_jcbsnd.cpp @@ -43,6 +43,7 @@ DEFINE_DEVICE_TYPE(DRAGON_JCBSND, dragon_jcbsnd_device, "dragon_jcbsnd", "Dragon dragon_jcbsnd_device::dragon_jcbsnd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, DRAGON_JCBSND, tag, owner, clock) , device_cococart_interface(mconfig, *this ) + , m_eprom(*this, "eprom") , m_ay8910(*this, "ay8910") { } @@ -65,7 +66,7 @@ void dragon_jcbsnd_device::device_start() uint8_t* dragon_jcbsnd_device::get_cart_base() { - return memregion("eprom")->base(); + return m_eprom->base(); } //------------------------------------------------- @@ -74,7 +75,7 @@ uint8_t* dragon_jcbsnd_device::get_cart_base() memory_region* dragon_jcbsnd_device::get_cart_memregion() { - return memregion("eprom"); + return m_eprom; } //------------------------------------------------- @@ -96,3 +97,12 @@ const tiny_rom_entry *dragon_jcbsnd_device::device_rom_region() const { return ROM_NAME( dragon_jcbsnd ); } + +//------------------------------------------------- +// cts_read +//------------------------------------------------- + +READ8_MEMBER(dragon_jcbsnd_device::cts_read) +{ + return m_eprom->base()[offset & 0x1fff]; +} diff --git a/src/devices/bus/coco/dragon_jcbsnd.h b/src/devices/bus/coco/dragon_jcbsnd.h index 2ed76628075..e26e7ac429f 100644 --- a/src/devices/bus/coco/dragon_jcbsnd.h +++ b/src/devices/bus/coco/dragon_jcbsnd.h @@ -19,22 +19,25 @@ class dragon_jcbsnd_device : public device_cococart_interface { public: - // construction/destruction + // construction/destruction dragon_jcbsnd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // optional information overrides - virtual void device_add_mconfig(machine_config &config) override; - virtual const tiny_rom_entry *device_rom_region() const override; + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; protected: - // device-level overrides - virtual void device_start() override; - virtual uint8_t* get_cart_base() override; - virtual memory_region* get_cart_memregion() override; + // device-level overrides + virtual void device_start() override; + virtual uint8_t* get_cart_base() override; + virtual memory_region* get_cart_memregion() override; - // internal state - device_image_interface *m_cart; + virtual DECLARE_READ8_MEMBER(cts_read) override; + + // internal state + device_image_interface *m_cart; private: - required_device m_ay8910; + required_memory_region m_eprom; + required_device m_ay8910; }; diff --git a/src/mame/includes/coco.h b/src/mame/includes/coco.h index 2a028e6bda5..be0192b0f82 100644 --- a/src/mame/includes/coco.h +++ b/src/mame/includes/coco.h @@ -161,7 +161,7 @@ protected: // miscellaneous virtual void update_keyboard_input(uint8_t value, uint8_t z); virtual void cart_w(bool state); - virtual void update_cart_base(uint8_t *cart_base) = 0; + virtual void update_cart_base(uint8_t *cart_base) { }; protected: // timer constants diff --git a/src/mame/includes/coco12.h b/src/mame/includes/coco12.h index 267c5c5807a..26a98d022ce 100644 --- a/src/mame/includes/coco12.h +++ b/src/mame/includes/coco12.h @@ -61,7 +61,6 @@ public: void coco(machine_config &config); protected: virtual void device_start() override; - virtual void update_cart_base(uint8_t *cart_base) override; // PIA1 virtual void pia1_pb_changed(uint8_t data) override; diff --git a/src/mame/machine/6883sam.cpp b/src/mame/machine/6883sam.cpp index 6c525eaea72..26b08accfa4 100644 --- a/src/mame/machine/6883sam.cpp +++ b/src/mame/machine/6883sam.cpp @@ -68,7 +68,7 @@ DEFINE_DEVICE_TYPE(SAM6883, sam6883_device, "sam6883", "MC6883 SAM") //************************************************************************** //------------------------------------------------- -// ctor +// constructor //------------------------------------------------- sam6883_device::sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) @@ -85,6 +85,7 @@ sam6883_device::sam6883_device(const machine_config &mconfig, const char *tag, d , m_space_FF40(*this) , m_space_FF60(*this) , m_space_FFE0(*this) + , m_space_FFF2(*this) { } @@ -157,7 +158,7 @@ void sam6883_device::configure_bank(int bank, uint8_t *memory, uint32_t memory_s switch(bank) { case 3: - m_space_C000.point(m_banks[3], m_banks[3].m_memory_offset); + m_space_C000.point(m_banks[3], 0x0000); break; case 4: m_space_FF00.point(m_banks[4], 0x0000); @@ -173,6 +174,7 @@ void sam6883_device::configure_bank(int bank, uint8_t *memory, uint32_t memory_s break; case 2: m_space_FFE0.point(m_banks[2], 0x1FE0); + m_space_FFF2.point(m_banks[2], 0x1FF2); break; } } @@ -264,8 +266,9 @@ void sam6883_device::update_memory(void) break; case SAM_STATE_M1: + // 64k mode (dynamic) case SAM_STATE_M1|SAM_STATE_M0: - // 64k mode + // 64k mode (static) if (m_sam_state & SAM_STATE_TY) { // full 64k RAM @@ -293,8 +296,8 @@ void sam6883_device::update_memory(void) m_space_C000.point(m_banks[3], m_banks[3].m_memory_offset); } - // update $FFE0-$FFFF - m_space_FFE0.point(m_banks[2], m_banks[2].m_memory_offset + 0x1FE0); + // update $FFF2-$FFFF + m_space_FFF2.point(m_banks[2], m_banks[2].m_memory_offset + 0x1FF2); } @@ -442,7 +445,7 @@ WRITE_LINE_MEMBER( sam6883_device::hs_w ) //------------------------------------------------- -// sam_space::ctor +// sam_space::constructor //------------------------------------------------- template @@ -506,38 +509,34 @@ void sam6883_device::sam_space<_addrstart, _addrend>::point_specific_bank(const if (length != ~0) length -= std::min(offset, length); - // do we even have a bank? and if so, have legit changes occured? - if (!memory_bank || !memory_bank->matches_exactly(addrstart, addrend) || (length != m_length)) - { - // name the bank - auto tag = string_format("bank%04X_%c", addrstart, is_write ? 'w' : 'r'); + // name the bank + auto tag = string_format("bank%04X_%c", addrstart, is_write ? 'w' : 'r'); - // determine "nop_addrstart" - where the bank ends, and above which is AM_NOP - uint32_t nop_addrstart = (length != ~0) - ? std::min(addrend + 1, addrstart + length) - : addrend + 1; + // determine "nop_addrstart" - where the bank ends, and above which is AM_NOP + uint32_t nop_addrstart = (length != ~0) + ? std::min(addrend + 1, addrstart + length) + : addrend + 1; - // install the bank - if (is_write) - { - if (addrstart < nop_addrstart) - cpu_space().install_write_bank(addrstart, nop_addrstart - 1, 0, tag.c_str()); - if (nop_addrstart <= addrend) - cpu_space().nop_write(nop_addrstart, addrend); - } - else - { - if (addrstart < nop_addrstart) - cpu_space().install_read_bank(addrstart, nop_addrstart - 1, 0, tag.c_str()); - if (nop_addrstart <= addrend) - cpu_space().nop_read(nop_addrstart, addrend); - } + // install the bank + if (is_write) + { + if (addrstart < nop_addrstart) + cpu_space().install_write_bank(addrstart, nop_addrstart - 1, 0, tag.c_str()); + if (nop_addrstart <= addrend) + cpu_space().nop_write(nop_addrstart, addrend); + } + else + { + if (addrstart < nop_addrstart) + cpu_space().install_read_bank(addrstart, nop_addrstart - 1, 0, tag.c_str()); + if (nop_addrstart <= addrend) + cpu_space().nop_read(nop_addrstart, addrend); + } - m_length = length; + m_length = length; - // and get it - memory_bank = cpu_space().device().owner()->membank(tag.c_str()); - } + // and get it + memory_bank = cpu_space().device().owner()->membank(tag.c_str()); // point the bank if (memory_bank != nullptr) @@ -551,7 +550,7 @@ void sam6883_device::sam_space<_addrstart, _addrend>::point_specific_bank(const else { // this bank uses handlers - first thing's first, assert that we are not doing - // any weird stuff with offfsets and lengths - that isn't supported in this path + // any weird stuff with offsets and lengths - that isn't supported in this path assert((offset == 0) && (length == (uint32_t)~0)); if (is_write) diff --git a/src/mame/machine/6883sam.h b/src/mame/machine/6883sam.h index 0ca43fed538..c973bb22f65 100644 --- a/src/mame/machine/6883sam.h +++ b/src/mame/machine/6883sam.h @@ -175,7 +175,8 @@ private: sam_space<0xFF20, 0xFF3F> m_space_FF20; sam_space<0xFF40, 0xFF5F> m_space_FF40; sam_space<0xFF60, 0xFFBF> m_space_FF60; - sam_space<0xFFE0, 0xFFFF> m_space_FFE0; + sam_space<0xFFE0, 0xFFF1> m_space_FFE0; + sam_space<0xFFF2, 0xFFFF> m_space_FFF2; uint16_t m_counter_mask; // SAM state diff --git a/src/mame/machine/coco12.cpp b/src/mame/machine/coco12.cpp index c6d858efbaf..1096a5d8ee6 100644 --- a/src/mame/machine/coco12.cpp +++ b/src/mame/machine/coco12.cpp @@ -105,14 +105,3 @@ void coco12_state::pia1_pb_changed(uint8_t data) m_vdg->gm2_w(data & 0x40); m_vdg->ag_w(data & 0x80); } - - - -//------------------------------------------------- -// update_cart_base -//------------------------------------------------- - -void coco12_state::update_cart_base(uint8_t *cart_base) -{ - m_sam->configure_bank(3, cart_base, 0x4000, true); // $C000-$FEFF -} -- cgit v1.2.3