diff options
author | 2019-03-25 23:13:40 +0100 | |
---|---|---|
committer | 2019-03-25 23:13:40 +0100 | |
commit | b380514764cf857469bae61c11143a19f79a74c5 (patch) | |
tree | 63c8012e262618f08a332da31dd714281aa2c5ed /src/devices/machine/tmp68301.cpp | |
parent | c24473ddff715ecec2e258a6eb38960cf8c8e98e (diff) |
Revert "conflict resolution (nw)"
This reverts commit c24473ddff715ecec2e258a6eb38960cf8c8e98e, reversing
changes made to 009cba4fb8102102168ef32870892438327f3705.
Diffstat (limited to 'src/devices/machine/tmp68301.cpp')
-rw-r--r-- | src/devices/machine/tmp68301.cpp | 62 |
1 files changed, 45 insertions, 17 deletions
diff --git a/src/devices/machine/tmp68301.cpp b/src/devices/machine/tmp68301.cpp index 1eea072c64a..2add964e4e5 100644 --- a/src/devices/machine/tmp68301.cpp +++ b/src/devices/machine/tmp68301.cpp @@ -23,8 +23,7 @@ DEFINE_DEVICE_TYPE(TMP68301, tmp68301_device, "tmp68301", "Toshiba TMP68301") void tmp68301_device::tmp68301_regs(address_map &map) { - map(0x000, 0x3ff).rw(FUNC(tmp68301_device::regs_r), FUNC(tmp68301_device::regs_w)); - +// AM_RANGE(0x000,0x3ff) AM_RAM map(0x080, 0x093).rw(FUNC(tmp68301_device::icr_r), FUNC(tmp68301_device::icr_w)).umask16(0x00ff); map(0x094, 0x095).rw(FUNC(tmp68301_device::imr_r), FUNC(tmp68301_device::imr_w)); @@ -135,7 +134,9 @@ WRITE8_MEMBER(tmp68301_device::icr_w) } tmp68301_device::tmp68301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : m68000_device(mconfig, TMP68301, tag, owner, clock), + : device_t(mconfig, TMP68301, tag, owner, clock), + device_memory_interface(mconfig, *this), + m_cpu(*this, finder_base::DUMMY_TAG), m_in_parallel_cb(*this), m_out_parallel_cb(*this), m_ipl(0), @@ -144,7 +145,8 @@ tmp68301_device::tmp68301_device(const machine_config &mconfig, const char *tag, m_iisr(0), m_scr(0), m_pdir(0), - m_pdr(0) + m_pdr(0), + m_space_config("regs", ENDIANNESS_LITTLE, 16, 10, 0, address_map_constructor(), address_map_constructor(FUNC(tmp68301_device::tmp68301_regs), this)) { memset(m_regs, 0, sizeof(m_regs)); memset(m_icr, 0, sizeof(m_icr)); @@ -157,17 +159,13 @@ tmp68301_device::tmp68301_device(const machine_config &mconfig, const char *tag, void tmp68301_device::device_start() { - m68000_device::device_start(); - - for (int i = 0; i < 3; i++) + int i; + for (i = 0; i < 3; i++) m_tmp68301_timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tmp68301_device::timer_callback), this)); m_in_parallel_cb.resolve_safe(0); m_out_parallel_cb.resolve_safe(); - m_program->install_device(0xfffc00, 0xffffff, *this, &tmp68301_device::tmp68301_regs); - m_int_ack_callback = device_irq_acknowledge_delegate(FUNC(tmp68301_device::irq_callback), this); - save_item(NAME(m_regs)); save_item(NAME(m_icr)); save_item(NAME(m_ipl)); @@ -185,8 +183,6 @@ void tmp68301_device::device_start() void tmp68301_device::device_reset() { - m68000_device::device_reset(); - m_ipr = 0; m_iisr = 0; m_imr = 0x7f7; // mask all irqs @@ -194,10 +190,40 @@ void tmp68301_device::device_reset() update_ipl(); } +//------------------------------------------------- +// memory_space_config - return a description of +// any address spaces owned by this device +//------------------------------------------------- + +device_memory_interface::space_config_vector tmp68301_device::memory_space_config() const +{ + return space_config_vector { + std::make_pair(0, &m_space_config) + }; +} + //************************************************************************** // INLINE HELPERS //************************************************************************** +//------------------------------------------------- +// read_byte - read a byte at the given address +//------------------------------------------------- + +inline uint16_t tmp68301_device::read_word(offs_t address) +{ + return space(0).read_word(address << 1); +} + +//------------------------------------------------- +// write_byte - write a byte at the given address +//------------------------------------------------- + +inline void tmp68301_device::write_word(offs_t address, uint16_t data) +{ + space(0).write_word(address << 1, data); +} + IRQ_CALLBACK_MEMBER(tmp68301_device::irq_callback) { uint8_t IVNR = m_regs[0x9a/2] & 0xe0; // Interrupt Vector Number Register (IVNR) @@ -286,7 +312,7 @@ void tmp68301_device::update_timer(int i) { int scale = (TCR & 0x3c00)>>10; // P4..1 if (scale > 8) scale = 8; - duration = attotime::from_hz(unscaled_clock()) * ((1 << scale) * max); + duration = attotime::from_hz(m_cpu->unscaled_clock()) * ((1 << scale) * max); } break; } @@ -317,9 +343,9 @@ void tmp68301_device::update_ipl() if (new_ipl != m_ipl) { if (m_ipl != 0) - set_input_line(m_ipl, CLEAR_LINE); + m_cpu->set_input_line(m_ipl, CLEAR_LINE); if (new_ipl != 0) - set_input_line(new_ipl, ASSERT_LINE); + m_cpu->set_input_line(new_ipl, ASSERT_LINE); m_ipl = new_ipl; } @@ -340,16 +366,18 @@ uint8_t tmp68301_device::serial_interrupt_cause(int channel) READ16_MEMBER( tmp68301_device::regs_r ) { - return m_regs[offset]; + return read_word(offset); } WRITE16_MEMBER( tmp68301_device::regs_w ) { COMBINE_DATA(&m_regs[offset]); + write_word(offset,m_regs[offset]); + if (!ACCESSING_BITS_0_7) return; -// logerror("CPU #0 PC %06X: TMP68301 Reg %04X<-%04X & %04X\n", >pc(),offset*2,data,mem_mask^0xffff); +// logerror("CPU #0 PC %06X: TMP68301 Reg %04X<-%04X & %04X\n", m_cpu->pc(),offset*2,data,mem_mask^0xffff); switch( offset * 2 ) { |