mirror of
https://github.com/holub/mame
synced 2025-05-30 17:41:47 +03:00
Fix recent coco3 regressions, nw
This commit is contained in:
parent
34b3107c92
commit
abef4f38dd
@ -460,7 +460,7 @@ MACHINE_CONFIG_START(coco12_state::coco)
|
||||
MCFG_PIA_IRQA_HANDLER(WRITELINE(*this, coco_state, pia1_firq_a))
|
||||
MCFG_PIA_IRQB_HANDLER(WRITELINE(*this, coco_state, pia1_firq_b))
|
||||
|
||||
MCFG_SAM6883_ADD(SAM_TAG, XTAL(14'318'181), MAINCPU_TAG, AS_PROGRAM)
|
||||
MCFG_DEVICE_ADD(SAM_TAG, SAM6883, XTAL(14'318'181), MAINCPU_TAG)
|
||||
MCFG_SAM6883_RES_CALLBACK(READ8(*this, coco12_state, sam_read))
|
||||
|
||||
// Becker Port device
|
||||
|
@ -74,8 +74,6 @@ DEFINE_DEVICE_TYPE(SAM6883, sam6883_device, "sam6883", "MC6883 SAM")
|
||||
sam6883_device::sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, SAM6883, tag, owner, clock)
|
||||
, sam6883_friend_device_interface(mconfig, *this, 4)
|
||||
, m_cpu_tag(nullptr)
|
||||
, m_cpu_space_ref(AS_PROGRAM)
|
||||
, m_cpu_space(nullptr)
|
||||
, m_read_res(*this)
|
||||
, m_space_0000(*this)
|
||||
@ -92,7 +90,7 @@ sam6883_device::sam6883_device(const machine_config &mconfig, const char *tag, d
|
||||
|
||||
sam6883_friend_device_interface::sam6883_friend_device_interface(const machine_config &mconfig, device_t &device, int divider)
|
||||
: device_interface(device, "sam6883")
|
||||
, m_cpu(nullptr)
|
||||
, m_cpu(device, finder_base::DUMMY_TAG)
|
||||
, m_sam_state(0x0000)
|
||||
, m_divider(divider)
|
||||
{
|
||||
@ -105,9 +103,7 @@ sam6883_friend_device_interface::sam6883_friend_device_interface(const machine_c
|
||||
|
||||
void sam6883_device::device_start()
|
||||
{
|
||||
// find the CPU
|
||||
m_cpu = machine().device<cpu_device>(m_cpu_tag);
|
||||
m_cpu_space = &m_cpu->space(m_cpu_space_ref);
|
||||
m_cpu_space = &m_cpu->space(AS_PROGRAM);
|
||||
|
||||
// resolve callbacks
|
||||
m_read_res.resolve_safe(0);
|
||||
|
@ -14,10 +14,6 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#define MCFG_SAM6883_ADD(_tag, _clock, _cputag, _cpuspace) \
|
||||
MCFG_DEVICE_ADD(_tag, SAM6883, _clock) \
|
||||
downcast<sam6883_device &>(*device).configure_cpu(_cputag, _cpuspace);
|
||||
|
||||
#define MCFG_SAM6883_RES_CALLBACK(_read) \
|
||||
devcb = &downcast<sam6883_device &>(*device).set_res_rd_callback(DEVCB_##_read);
|
||||
|
||||
@ -52,10 +48,10 @@ protected:
|
||||
static const uint16_t SAM_STATE_V0 = 0x0001;
|
||||
|
||||
// incidentals
|
||||
cpu_device * m_cpu;
|
||||
required_device<cpu_device> m_cpu;
|
||||
|
||||
// device state
|
||||
uint16_t m_sam_state;
|
||||
uint16_t m_sam_state;
|
||||
|
||||
// base clock divider (/4 for MC6883, /8 for GIME)
|
||||
int m_divider;
|
||||
@ -89,16 +85,17 @@ protected:
|
||||
class sam6883_device : public device_t, public sam6883_friend_device_interface
|
||||
{
|
||||
public:
|
||||
sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
template <typename T>
|
||||
sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag)
|
||||
: sam6883_device(mconfig, tag, owner, clock)
|
||||
{
|
||||
m_cpu.set_tag(std::forward<T>(cpu_tag));
|
||||
}
|
||||
|
||||
sam6883_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
template <class Object> devcb_base &set_res_rd_callback(Object &&cb) { return m_read_res.set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
void configure_cpu(const char *tag, int space)
|
||||
{
|
||||
m_cpu_tag = tag;
|
||||
m_cpu_space_ref = space;
|
||||
}
|
||||
|
||||
// called to configure banks
|
||||
void configure_bank(int bank, uint8_t *memory, uint32_t memory_size, bool is_read_only);
|
||||
void configure_bank(int bank, read8_delegate rhandler, write8_delegate whandler);
|
||||
@ -170,9 +167,6 @@ private:
|
||||
void point_specific_bank(const sam_bank &bank, uint32_t offset, uint32_t mask, memory_bank *&memory_bank, uint32_t addrstart, uint32_t addrend, bool is_write);
|
||||
};
|
||||
|
||||
const char * m_cpu_tag;
|
||||
int m_cpu_space_ref;
|
||||
|
||||
// incidentals
|
||||
address_space * m_cpu_space;
|
||||
devcb_read8 m_read_res;
|
||||
|
@ -117,7 +117,8 @@ gime_device::gime_device(const machine_config &mconfig, device_type type, const
|
||||
, m_maincpu(*this, finder_base::DUMMY_TAG)
|
||||
, m_ram(*this, finder_base::DUMMY_TAG)
|
||||
, m_cart_device(*this, finder_base::DUMMY_TAG)
|
||||
, m_rom(*this, finder_base::DUMMY_TAG)
|
||||
, m_rom(nullptr)
|
||||
, m_rom_region(*this, finder_base::DUMMY_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
@ -129,7 +130,16 @@ gime_device::gime_device(const machine_config &mconfig, device_type type, const
|
||||
|
||||
void gime_device::device_start(void)
|
||||
{
|
||||
// inherited device_start - need to do this after checking dependencies
|
||||
if (!m_ram->started())
|
||||
throw device_missing_dependencies();
|
||||
|
||||
if (!m_cart_device->started())
|
||||
throw device_missing_dependencies();
|
||||
|
||||
if (!m_cpu->started())
|
||||
throw device_missing_dependencies();
|
||||
|
||||
// inherited device_start - need to do this after checking dependencies
|
||||
super::device_start();
|
||||
|
||||
// initialize variables
|
||||
@ -158,7 +168,8 @@ void gime_device::device_start(void)
|
||||
m_read_floating_bus.resolve_safe(0);
|
||||
|
||||
// set up ROM/RAM pointers
|
||||
m_cart_rom = m_cart_device->get_cart_base();
|
||||
m_rom = m_rom_region->base();
|
||||
m_cart_rom = m_cart_device->get_cart_base();
|
||||
m_cart_size = m_cart_device->get_cart_size();
|
||||
|
||||
// populate palettes
|
||||
@ -558,7 +569,7 @@ void gime_device::update_memory(int bank)
|
||||
}
|
||||
else
|
||||
{
|
||||
memory = &m_rom->base()[(block & 3) * 0x2000];
|
||||
memory = &m_rom[(block & 3) * 0x2000];
|
||||
}
|
||||
is_read_only = true;
|
||||
}
|
||||
|
@ -185,7 +185,8 @@ protected:
|
||||
required_device<cococart_slot_device> m_cart_device;
|
||||
memory_bank * m_read_banks[9];
|
||||
memory_bank * m_write_banks[9];
|
||||
required_memory_region m_rom;
|
||||
uint8_t * m_rom;
|
||||
required_memory_region m_rom_region;
|
||||
uint8_t * m_cart_rom;
|
||||
uint32_t m_cart_size;
|
||||
pixel_t m_composite_palette[64];
|
||||
@ -289,9 +290,10 @@ public:
|
||||
: gime_ntsc_device(mconfig, tag, owner, clock)
|
||||
{
|
||||
m_maincpu.set_tag(std::forward<T>(cpu_tag));
|
||||
m_ram.set_tag(std::forward<U>(ram_tag));
|
||||
m_cpu.set_tag(std::forward<T>(cpu_tag));
|
||||
m_ram.set_tag(std::forward<U>(ram_tag));
|
||||
m_cart_device.set_tag(std::forward<V>(ext_tag));
|
||||
m_rom.set_tag(std::forward<W>(region_tag));
|
||||
m_rom_region.set_tag(std::forward<W>(region_tag));
|
||||
}
|
||||
|
||||
gime_ntsc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
@ -305,9 +307,10 @@ public:
|
||||
: gime_pal_device(mconfig, tag, owner, clock)
|
||||
{
|
||||
m_maincpu.set_tag(std::forward<T>(cpu_tag));
|
||||
m_ram.set_tag(std::forward<U>(ram_tag));
|
||||
m_cpu.set_tag(std::forward<T>(cpu_tag));
|
||||
m_ram.set_tag(std::forward<U>(ram_tag));
|
||||
m_cart_device.set_tag(std::forward<V>(ext_tag));
|
||||
m_rom.set_tag(std::forward<W>(region_tag));
|
||||
m_rom_region.set_tag(std::forward<W>(region_tag));
|
||||
}
|
||||
|
||||
gime_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
Loading…
Reference in New Issue
Block a user