diff options
author | MooglyGuy <therealmogminer@gmail.com> | 2020-03-01 10:44:05 +0100 |
---|---|---|
committer | MooglyGuy <therealmogminer@gmail.com> | 2020-03-01 10:44:23 +0100 |
commit | 9e6901f0e59de5a6b7a4dc5ae7b36145c4635995 (patch) | |
tree | de218f9ea5bf89c15905fcb569367ebede4038ad | |
parent | c8d49702f0a74ec8921c304b5164754476560512 (diff) |
-avr8: Removed hacky get_elapsed_cycles accessor. [Ryan Holtz]
-rw-r--r-- | src/devices/cpu/avr8/avr8.cpp | 4 | ||||
-rw-r--r-- | src/devices/cpu/avr8/avr8.h | 2 | ||||
-rw-r--r-- | src/mame/drivers/craft.cpp | 15 | ||||
-rw-r--r-- | src/mame/drivers/uzebox.cpp | 6 |
4 files changed, 12 insertions, 15 deletions
diff --git a/src/devices/cpu/avr8/avr8.cpp b/src/devices/cpu/avr8/avr8.cpp index 6da6bf00f2a..d62c05bb613 100644 --- a/src/devices/cpu/avr8/avr8.cpp +++ b/src/devices/cpu/avr8/avr8.cpp @@ -683,7 +683,6 @@ avr8_device::avr8_device(const machine_config &mconfig, const char *tag, device_ , m_spi_prescale_count(0) , m_addr_mask(addr_mask) , m_interrupt_pending(false) - , m_elapsed_cycles(0) { } @@ -841,7 +840,6 @@ void avr8_device::device_start() // Misc. save_item(NAME(m_addr_mask)); save_item(NAME(m_interrupt_pending)); - save_item(NAME(m_elapsed_cycles)); // set our instruction counter set_icountptr(m_icount); @@ -895,7 +893,6 @@ void avr8_device::device_reset() m_ocr2_not_reached_yet = true; m_interrupt_pending = false; - m_elapsed_cycles = 0; } //------------------------------------------------- @@ -1104,7 +1101,6 @@ void avr8_device::timer_tick(int cycles) { for (int count = 0; count < cycles; count++) { - m_elapsed_cycles++; if (m_spi_active && m_spi_prescale > 0 && m_spi_prescale_countdown >= 0) { m_spi_prescale_count++; diff --git a/src/devices/cpu/avr8/avr8.h b/src/devices/cpu/avr8/avr8.h index 02911f77a38..49b061c86c7 100644 --- a/src/devices/cpu/avr8/avr8.h +++ b/src/devices/cpu/avr8/avr8.h @@ -66,7 +66,6 @@ public: // public interfaces virtual void update_interrupt(int source); - uint64_t get_elapsed_cycles() const { return m_elapsed_cycles; } // register handling DECLARE_WRITE8_MEMBER(regs_w); @@ -142,7 +141,6 @@ protected: // other internal states int m_icount; - uint64_t m_elapsed_cycles; // memory access inline void push(uint8_t val); diff --git a/src/mame/drivers/craft.cpp b/src/mame/drivers/craft.cpp index c438c498243..bdfb4cc1873 100644 --- a/src/mame/drivers/craft.cpp +++ b/src/mame/drivers/craft.cpp @@ -30,6 +30,7 @@ public: craft_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") + , m_screen(*this, "screen") , m_dac(*this, "dac") { } @@ -51,6 +52,7 @@ private: uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); required_device<avr8_device> m_maincpu; + required_device<screen_device> m_screen; required_device<dac_byte_interface> m_dac; uint32_t m_last_cycles; @@ -102,11 +104,12 @@ WRITE8_MEMBER(craft_state::port_w) video_update(); if (BIT(pins, 1)) { - m_frame_start_cycle = m_maincpu->get_elapsed_cycles(); + m_frame_start_cycle = machine().time().as_ticks(MASTER_CLOCK); } } if (BIT(changed, 3)) { + printf("%d, %d\n", m_screen->hpos(), m_screen->vpos()); video_update(); m_latched_color = (pins & 0x08) ? (m_port_c & 0x3f) : 0x3f; } @@ -115,9 +118,9 @@ WRITE8_MEMBER(craft_state::port_w) } case AVR8_IO_PORTC: - video_update(); m_port_c = data; m_latched_color = m_port_c; + video_update(); break; case AVR8_IO_PORTD: @@ -152,7 +155,7 @@ void craft_state::craft_io_map(address_map &map) void craft_state::video_update() { - uint64_t cycles = m_maincpu->get_elapsed_cycles(); + uint64_t cycles = machine().time().as_ticks(MASTER_CLOCK); uint32_t frame_cycles = (uint32_t)(cycles - m_frame_start_cycle); if (m_last_cycles < frame_cycles) @@ -243,9 +246,9 @@ void craft_state::craft(machine_config &config) m_maincpu->set_eeprom_tag("eeprom"); /* video hardware */ - screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_raw(MASTER_CLOCK, 635, 47, 527, 525, 36, 516); - screen.set_screen_update(FUNC(craft_state::screen_update)); + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_raw(MASTER_CLOCK, 635, 47, 527, 525, 36, 516); + m_screen->set_screen_update(FUNC(craft_state::screen_update)); /* sound hardware */ SPEAKER(config, "avr8").front_center(); diff --git a/src/mame/drivers/uzebox.cpp b/src/mame/drivers/uzebox.cpp index ea0fd72226c..27357530321 100644 --- a/src/mame/drivers/uzebox.cpp +++ b/src/mame/drivers/uzebox.cpp @@ -143,13 +143,13 @@ WRITE8_MEMBER(uzebox_state::port_b_w) { line_update(); - uint32_t cycles = (uint32_t)(m_maincpu->get_elapsed_cycles() - m_line_start_cycles); + uint32_t cycles = (uint32_t)(machine().time().as_ticks(MASTER_CLOCK) - m_line_start_cycles); if (cycles < 1000 && m_vpos >= 448) m_vpos = INTERLACED ? ((m_vpos ^ 0x01) & 0x01) : 0; else if (cycles > 1000) m_vpos += 2; - m_line_start_cycles = m_maincpu->get_elapsed_cycles(); + m_line_start_cycles = machine().time().as_ticks(MASTER_CLOCK); m_line_pos_cycles = 0; } @@ -236,7 +236,7 @@ INPUT_PORTS_END void uzebox_state::line_update() { - uint32_t cycles = (uint32_t)(m_maincpu->get_elapsed_cycles() - m_line_start_cycles) / 2; + uint32_t cycles = (uint32_t)(machine().time().as_ticks(MASTER_CLOCK) - m_line_start_cycles) / 2; rgb_t color = rgb_t(pal3bit(m_port_c >> 0), pal3bit(m_port_c >> 3), pal2bit(m_port_c >> 6)); for (uint32_t x = m_line_pos_cycles; x < cycles; x++) |