diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2019-02-08 10:56:48 -0500 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2019-02-08 10:56:48 -0500 |
commit | 17cd12e89620152835a0be986822900e4570d43b (patch) | |
tree | 9dc928f3bccef89d715f968648c29aaad096e457 | |
parent | 4a14085bae2c2cbbb73c16ceac208ed1a01bebbc (diff) |
bus/ti99x: Add address space finders; remove machine().device (nw)
-rw-r--r-- | src/devices/bus/ti99x/990_hd.cpp | 12 | ||||
-rw-r--r-- | src/devices/bus/ti99x/990_hd.h | 3 | ||||
-rw-r--r-- | src/devices/bus/ti99x/990_tap.cpp | 6 | ||||
-rw-r--r-- | src/devices/bus/ti99x/990_tap.h | 3 | ||||
-rw-r--r-- | src/mame/drivers/ti990_10.cpp | 13 |
5 files changed, 26 insertions, 11 deletions
diff --git a/src/devices/bus/ti99x/990_hd.cpp b/src/devices/bus/ti99x/990_hd.cpp index 9bfef6e075b..c17f63b807e 100644 --- a/src/devices/bus/ti99x/990_hd.cpp +++ b/src/devices/bus/ti99x/990_hd.cpp @@ -463,7 +463,7 @@ void ti990_hdc_device::store_registers() if (! (m_w[1] & w1_transfer_inhibit)) for (i=0; i<real_word_count; i++) { - machine().device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, buffer[i]); + m_memory_space->write_word(dma_address, buffer[i]); dma_address = (dma_address + 2) & 0x1ffffe; } @@ -618,7 +618,7 @@ void ti990_hdc_device::read_data() if (! (m_w[1] & w1_transfer_inhibit)) for (i=0; i<bytes_read; i+=2) { - machine().device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]); + m_memory_space->write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]); dma_address = (dma_address + 2) & 0x1ffffe; } @@ -714,7 +714,7 @@ void ti990_hdc_device::write_data() /* DMA */ for (i=0; (i<byte_count) && (i<m_d[dsk_sel].bytes_per_sector); i+=2) { - word = machine().device("maincpu")->memory().space(AS_PROGRAM).read_word(dma_address); + word = m_memory_space->read_word(dma_address); buffer[i] = word >> 8; buffer[i+1] = word & 0xff; @@ -821,7 +821,7 @@ void ti990_hdc_device::unformatted_read() if (! (m_w[1] & w1_transfer_inhibit)) for (i=0; i<real_word_count; i++) { - machine().device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, buffer[i]); + m_memory_space->write_word(dma_address, buffer[i]); dma_address = (dma_address + 2) & 0x1ffffe; } @@ -962,7 +962,9 @@ WRITE16_MEMBER(ti990_hdc_device::write) DEFINE_DEVICE_TYPE(TI990_HDC, ti990_hdc_device, "ti990_hdc", "Generic TI-990 Hard Disk Controller") ti990_hdc_device::ti990_hdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, TI990_HDC, tag, owner, clock), m_interrupt_callback(*this) + : device_t(mconfig, TI990_HDC, tag, owner, clock) + , m_memory_space(*this, finder_base::DUMMY_TAG, -1) + , m_interrupt_callback(*this) { } diff --git a/src/devices/bus/ti99x/990_hd.h b/src/devices/bus/ti99x/990_hd.h index 47fe5d947f6..803e9ca7c79 100644 --- a/src/devices/bus/ti99x/990_hd.h +++ b/src/devices/bus/ti99x/990_hd.h @@ -23,6 +23,7 @@ public: DECLARE_DEVICE_IMAGE_LOAD_MEMBER( ti990_hd ); DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( ti990_hd ); + template <typename T> void set_memory_space(T &&tag, int spacenum) { m_memory_space.set_tag(std::forward<T>(tag), spacenum); } auto int_cb() { return m_interrupt_callback.bind(); } protected: @@ -72,6 +73,8 @@ private: uint16_t m_w[8]; + required_address_space m_memory_space; + devcb_write_line m_interrupt_callback; hd_unit_t m_d[MAX_DISK_UNIT]; diff --git a/src/devices/bus/ti99x/990_tap.cpp b/src/devices/bus/ti99x/990_tap.cpp index db41dc94c2b..2d945cb7cd4 100644 --- a/src/devices/bus/ti99x/990_tap.cpp +++ b/src/devices/bus/ti99x/990_tap.cpp @@ -257,7 +257,7 @@ void tap_990_device::cmd_read_binary_forward() /* DMA */ for (i=0; i<bytes_read; i+=2) { - machine().device("maincpu")->memory().space(AS_PROGRAM).write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]); + m_memory_space->write_word(dma_address, (((int) buffer[i]) << 8) | buffer[i+1]); dma_address = (dma_address + 2) & 0x1ffffe; } @@ -963,7 +963,9 @@ void ti990_tape_image_device::call_unload() DEFINE_DEVICE_TYPE(TI990_TAPE_CTRL, tap_990_device, "ti990_tap", "Generic TI-900 Tape Controller") tap_990_device::tap_990_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, TI990_TAPE_CTRL, tag, owner, clock), m_int_line(*this) + : device_t(mconfig, TI990_TAPE_CTRL, tag, owner, clock) + , m_memory_space(*this, finder_base::DUMMY_TAG, -1) + , m_int_line(*this) { } diff --git a/src/devices/bus/ti99x/990_tap.h b/src/devices/bus/ti99x/990_tap.h index a35a09b26a4..3be370a9f5a 100644 --- a/src/devices/bus/ti99x/990_tap.h +++ b/src/devices/bus/ti99x/990_tap.h @@ -26,6 +26,7 @@ public: m_tape[id].wp = wp; } + template <typename T> void set_memory_space(T &&tag, int spacenum) { m_memory_space.set_tag(std::forward<T>(tag), spacenum); } auto int_cb() { return m_int_line.bind(); } protected: @@ -54,6 +55,8 @@ private: void read_transport_status(); void execute_command(); + required_address_space m_memory_space; + devcb_write_line m_int_line; uint16_t m_w[8]; diff --git a/src/mame/drivers/ti990_10.cpp b/src/mame/drivers/ti990_10.cpp index 8ebe64d4728..baa8a791bab 100644 --- a/src/mame/drivers/ti990_10.cpp +++ b/src/mame/drivers/ti990_10.cpp @@ -317,7 +317,8 @@ WRITE_LINE_MEMBER(ti990_10_state::tape_interrupt) // set_int9(state); } -MACHINE_CONFIG_START(ti990_10_state::ti990_10) +void ti990_10_state::ti990_10(machine_config &config) +{ /* basic machine hardware */ /* TI990/10 CPU @ 4.0(???) MHz */ TI990_10(config, m_maincpu, 4000000); @@ -330,11 +331,15 @@ MACHINE_CONFIG_START(ti990_10_state::ti990_10) m_terminal->lineint_cb().set(FUNC(ti990_10_state::line_interrupt)); // Hard disk - TI990_HDC(config, "hdc", 0).int_cb().set(FUNC(ti990_10_state::ti990_set_int13)); + ti990_hdc_device &hdc(TI990_HDC(config, "hdc", 0)); + hdc.set_memory_space(m_maincpu, AS_PROGRAM); + hdc.int_cb().set(FUNC(ti990_10_state::ti990_set_int13)); // Tape controller - TI990_TAPE_CTRL(config, "tpc", 0).int_cb().set(FUNC(ti990_10_state::tape_interrupt)); -MACHINE_CONFIG_END + tap_990_device &tpc(TI990_TAPE_CTRL(config, "tpc", 0)); + tpc.set_memory_space(m_maincpu, AS_PROGRAM); + tpc.int_cb().set(FUNC(ti990_10_state::tape_interrupt)); +} /* |