diff options
author | David Haywood <28625134+DavidHaywood@users.noreply.github.com> | 2019-11-12 16:44:24 +0000 |
---|---|---|
committer | R. Belmont <rb6502@users.noreply.github.com> | 2019-11-12 11:44:24 -0500 |
commit | d093c549295c721fd0c6f507b9d17804f24fafe1 (patch) | |
tree | eab0f639d4e5cd8cb55ae391b5c98fac1e318269 /src/mame/machine | |
parent | 1e02669173965f37d144f9db982e497b37f24f3a (diff) |
continued elan refactoring (nw) (#5892)
* cointinued elan refactoring (nw)
* fake a timer interrupt to force Air Blaster Joystick 3D stages forward (nw)
* notes on bugs present on Air Blaster original hw (nw)
* lower frequency (nw)
* improve split scroll mode for air blaster joystick 3d stage bosses (nw)
* change wording (nw)
Diffstat (limited to 'src/mame/machine')
-rw-r--r-- | src/mame/machine/elan_eu3a05commonsys.cpp | 74 | ||||
-rw-r--r-- | src/mame/machine/elan_eu3a05commonsys.h | 30 | ||||
-rw-r--r-- | src/mame/machine/elan_eu3a05sys.cpp | 18 | ||||
-rw-r--r-- | src/mame/machine/elan_eu3a05sys.h | 6 | ||||
-rw-r--r-- | src/mame/machine/elan_eu3a14sys.cpp | 20 | ||||
-rw-r--r-- | src/mame/machine/elan_eu3a14sys.h | 6 |
6 files changed, 144 insertions, 10 deletions
diff --git a/src/mame/machine/elan_eu3a05commonsys.cpp b/src/mame/machine/elan_eu3a05commonsys.cpp index 7b1b5f09e5f..a655ae2be1e 100644 --- a/src/mame/machine/elan_eu3a05commonsys.cpp +++ b/src/mame/machine/elan_eu3a05commonsys.cpp @@ -172,7 +172,8 @@ DEFINE_DEVICE_TYPE(ELAN_EU3A05_COMMONSYS, elan_eu3a05commonsys_device, "elan_eu3 elan_eu3a05commonsys_device::elan_eu3a05commonsys_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock), m_cpu(*this, finder_base::DUMMY_TAG), - m_bank(*this, finder_base::DUMMY_TAG) + m_bank(*this, finder_base::DUMMY_TAG), + m_is_pal(false) { } @@ -181,6 +182,38 @@ elan_eu3a05commonsys_device::elan_eu3a05commonsys_device(const machine_config &m { } + +void elan_eu3a05commonsys_device::map(address_map &map) +{ + map(0x00, 0x00).ram(); + map(0x01, 0x01).ram(); + // 5002 + map(0x03, 0x03).r(FUNC(elan_eu3a05commonsys_device::elan_eu3a05_5003_r)); + map(0x04, 0x04).ram(); + // 5005 + map(0x06, 0x06).ram(); + map(0x07, 0x08).rw(FUNC(elan_eu3a05commonsys_device::intmask_r), FUNC(elan_eu3a05commonsys_device::intmask_w)); + map(0x09, 0x09).r(FUNC(elan_eu3a05commonsys_device::radica_5009_unk_r)); // rad_hnt3 polls this on startup + map(0x0a, 0x0a).ram(); + map(0x0b, 0x0b).rw(FUNC(elan_eu3a05commonsys_device::elan_eu3a05_pal_ntsc_r), FUNC(elan_eu3a05commonsys_device::elan_eu3a05_500b_unk_w)); // PAL / NTSC flag at least + map(0x0c, 0x0d).rw(FUNC(elan_eu3a05commonsys_device::elan_eu3a05_rombank_r), FUNC(elan_eu3a05commonsys_device::elan_eu3a05_rombank_w)); + // 0e +} + + +void elan_eu3a05commonsys_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TIMER_UNK: + { + generate_custom_interrupt(0); + break; + } + } +} + + void elan_eu3a05commonsys_device::device_start() { save_item(NAME(m_rombank_lo)); @@ -190,6 +223,9 @@ void elan_eu3a05commonsys_device::device_start() save_item(NAME(m_custom_nmi)); save_item(NAME(m_custom_irq_vector)); save_item(NAME(m_custom_nmi_vector)); + + m_unk_timer = timer_alloc(TIMER_UNK); + m_unk_timer->adjust(attotime::never); } void elan_eu3a05commonsys_device::device_reset() @@ -208,6 +244,8 @@ void elan_eu3a05commonsys_device::device_reset() m_rombank_hi = 0x00; m_bank->set_bank(0x7f); + // generate at a fixed frequency for now, but can probably be configured. drives 3D stages in Air Blaster Joystick + m_unk_timer->adjust(attotime::from_hz(4096), 0, attotime::from_hz(2048)); } READ8_MEMBER(elan_eu3a05commonsys_device::intmask_r) @@ -305,3 +343,37 @@ READ8_MEMBER(elan_eu3a05commonsys_device::elan_eu3a05_rombank_r) return m_rombank_lo; } } + + +READ8_MEMBER(elan_eu3a05commonsys_device::elan_eu3a05_pal_ntsc_r) +{ + // the text under the radica logo differs between regions, sometimes the titles too + logerror("%s: elan_eu3a05_pal_ntsc_r (region + more?)\n", machine().describe_context()); + if (!m_is_pal) return 0xff; // NTSC + else return 0x00; // PAL +} + +READ8_MEMBER(elan_eu3a05commonsys_device::elan_eu3a05_5003_r) +{ + /* masked with 0x0f, 0x01 or 0x03 depending on situation.. + + I think it might just be an RNG because if you return 0x00 + your shots can never hit the stage 3 enemies in Phoenix and + if you return 0xff they always hit. On the real hardware it + seems to be random. Could also just be a crude frame counter + used for the same purpose. + + */ + + logerror("%s: elan_eu3a05_5003_r (RNG?)\n", machine().describe_context()); + + return machine().rand(); +} + + + +WRITE8_MEMBER(elan_eu3a05commonsys_device::elan_eu3a05_500b_unk_w) +{ + // this is the PAL / NTSC flag when read, so what are writes? + logerror("%s: elan_eu3a05_500b_unk_w %02x\n", machine().describe_context(), data); +} diff --git a/src/mame/machine/elan_eu3a05commonsys.h b/src/mame/machine/elan_eu3a05commonsys.h index ec7f7cd482e..c7a1fec12dd 100644 --- a/src/mame/machine/elan_eu3a05commonsys.h +++ b/src/mame/machine/elan_eu3a05commonsys.h @@ -15,25 +15,24 @@ public: template <typename T> void set_cpu(T &&tag) { m_cpu.set_tag(std::forward<T>(tag)); } template <typename T> void set_addrbank(T &&tag) { m_bank.set_tag(std::forward<T>(tag)); } + void set_pal(void) { m_is_pal = true; } void generate_custom_interrupt(int level); - DECLARE_READ8_MEMBER(intmask_r); - DECLARE_WRITE8_MEMBER(intmask_w); + virtual void map(address_map& map); DECLARE_READ8_MEMBER(nmi_vector_r); DECLARE_READ8_MEMBER(irq_vector_r); - DECLARE_WRITE8_MEMBER(elan_eu3a05_rombank_w); - DECLARE_READ8_MEMBER(elan_eu3a05_rombank_r); - protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; required_device<m6502_device> m_cpu; required_device<address_map_bank_device> m_bank; + uint8_t m_intmask[2]; int m_custom_irq; @@ -43,6 +42,27 @@ protected: uint8_t m_rombank_hi; uint8_t m_rombank_lo; + + bool m_is_pal; // this is usually a jumper connected to the chip that the software can read (clocks also differ on PAL units) + +private: + DECLARE_READ8_MEMBER(intmask_r); + DECLARE_WRITE8_MEMBER(intmask_w); + + + DECLARE_WRITE8_MEMBER(elan_eu3a05_rombank_w); + DECLARE_READ8_MEMBER(elan_eu3a05_rombank_r); + + DECLARE_READ8_MEMBER(elan_eu3a05_5003_r); + DECLARE_READ8_MEMBER(elan_eu3a05_pal_ntsc_r); + DECLARE_WRITE8_MEMBER(elan_eu3a05_500b_unk_w); + + DECLARE_READ8_MEMBER(radica_5009_unk_r) { return machine().rand(); }; + + emu_timer *m_unk_timer; + static const device_timer_id TIMER_UNK = 0; + + }; DECLARE_DEVICE_TYPE(ELAN_EU3A05_COMMONSYS, elan_eu3a05commonsys_device) diff --git a/src/mame/machine/elan_eu3a05sys.cpp b/src/mame/machine/elan_eu3a05sys.cpp index 462457010fb..94c214ff903 100644 --- a/src/mame/machine/elan_eu3a05sys.cpp +++ b/src/mame/machine/elan_eu3a05sys.cpp @@ -9,10 +9,26 @@ DEFINE_DEVICE_TYPE(ELAN_EU3A05_SYS, elan_eu3a05sys_device, "elan_eu3a05sys", "Elan EU3A05 System") elan_eu3a05sys_device::elan_eu3a05sys_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - elan_eu3a05commonsys_device(mconfig, ELAN_EU3A05_SYS, tag, owner, clock) + elan_eu3a05commonsys_device(mconfig, ELAN_EU3A05_SYS, tag, owner, clock), + device_memory_interface(mconfig, *this), + m_space_config("regs", ENDIANNESS_NATIVE, 8, 5, 0, address_map_constructor(FUNC(elan_eu3a05sys_device::map), this)) { } +device_memory_interface::space_config_vector elan_eu3a05sys_device::memory_space_config() const +{ + return space_config_vector { + std::make_pair(0, &m_space_config) + }; +} + +void elan_eu3a05sys_device::map(address_map& map) +{ + elan_eu3a05commonsys_device::map(map); // 00 - 0e + map(0x0f, 0x15).rw(FUNC(elan_eu3a05sys_device::dma_param_r), FUNC(elan_eu3a05sys_device::dma_param_w)); + map(0x16, 0x16).rw(FUNC(elan_eu3a05sys_device::elan_eu3a05_dmatrg_r), FUNC(elan_eu3a05sys_device::elan_eu3a05_dmatrg_w)); +} + void elan_eu3a05sys_device::device_start() { elan_eu3a05commonsys_device::device_start(); diff --git a/src/mame/machine/elan_eu3a05sys.h b/src/mame/machine/elan_eu3a05sys.h index 72e971a7556..8905eb570e2 100644 --- a/src/mame/machine/elan_eu3a05sys.h +++ b/src/mame/machine/elan_eu3a05sys.h @@ -6,7 +6,7 @@ #include "elan_eu3a05commonsys.h" -class elan_eu3a05sys_device : public elan_eu3a05commonsys_device +class elan_eu3a05sys_device : public elan_eu3a05commonsys_device, public device_memory_interface { public: elan_eu3a05sys_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -17,12 +17,16 @@ public: DECLARE_READ8_MEMBER(dma_param_r); DECLARE_WRITE8_MEMBER(dma_param_w); + virtual void map(address_map& map) override; + protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; + virtual space_config_vector memory_space_config() const override; private: + const address_space_config m_space_config; uint8_t m_dmaparams[7]; }; diff --git a/src/mame/machine/elan_eu3a14sys.cpp b/src/mame/machine/elan_eu3a14sys.cpp index 2c9871fc5f1..ea0c955fba8 100644 --- a/src/mame/machine/elan_eu3a14sys.cpp +++ b/src/mame/machine/elan_eu3a14sys.cpp @@ -9,10 +9,28 @@ DEFINE_DEVICE_TYPE(ELAN_EU3A14_SYS, elan_eu3a14sys_device, "elan_eu3a14sys", "Elan EU3A14 System") elan_eu3a14sys_device::elan_eu3a14sys_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - elan_eu3a05commonsys_device(mconfig, ELAN_EU3A14_SYS, tag, owner, clock) + elan_eu3a05commonsys_device(mconfig, ELAN_EU3A14_SYS, tag, owner, clock), + device_memory_interface(mconfig, *this), + m_space_config("regs", ENDIANNESS_NATIVE, 8, 5, 0, address_map_constructor(FUNC(elan_eu3a14sys_device::map), this)) { } +device_memory_interface::space_config_vector elan_eu3a14sys_device::memory_space_config() const +{ + return space_config_vector { + std::make_pair(0, &m_space_config) + }; +} + +void elan_eu3a14sys_device::map(address_map& map) +{ + elan_eu3a05commonsys_device::map(map); // 00 - 0e + map(0x0f, 0x17).rw(FUNC(elan_eu3a14sys_device::dma_param_r), FUNC(elan_eu3a14sys_device::dma_param_w)); + map(0x18, 0x18).rw(FUNC(elan_eu3a14sys_device::dma_trigger_r), FUNC(elan_eu3a14sys_device::dma_trigger_w)); + // 5019 - 46 on startup (hnt3) 22 (bb3, foot) na (gtg) 09 (rsg) + // 501a - 01 on startup (hnt3) 03 (bb3, foot) na (gtg) 02,01 (rsg) +} + void elan_eu3a14sys_device::device_start() { elan_eu3a05commonsys_device::device_start(); diff --git a/src/mame/machine/elan_eu3a14sys.h b/src/mame/machine/elan_eu3a14sys.h index 02162af7541..47eed32e8f3 100644 --- a/src/mame/machine/elan_eu3a14sys.h +++ b/src/mame/machine/elan_eu3a14sys.h @@ -6,7 +6,7 @@ #include "elan_eu3a05commonsys.h" -class elan_eu3a14sys_device : public elan_eu3a05commonsys_device +class elan_eu3a14sys_device : public elan_eu3a05commonsys_device, public device_memory_interface { public: elan_eu3a14sys_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -17,12 +17,16 @@ public: DECLARE_READ8_MEMBER(dma_param_r); DECLARE_WRITE8_MEMBER(dma_param_w); + virtual void map(address_map& map) override; + protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; + virtual space_config_vector memory_space_config() const override; private: + const address_space_config m_space_config; uint8_t m_dmaparams[9]; }; |