diff options
author | Vas Crabb <cuavas@users.noreply.github.com> | 2022-06-05 23:37:21 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-05 23:37:21 +1000 |
commit | 62c35fe3cec10c706792c28796a5d7d96c5164ea (patch) | |
tree | 43cbde47a9c0702a2af88c09dd1ecc1800da72ab /src/mame/machine | |
parent | c1ef4e0e24c7df1ebc79c8016d69510dff2f041b (diff) |
8080bw.cpp, mw8080bw.cpp: Some cleanup/untangling: (#9884)
Updated Space Invaders C.V. and Space Invaders Part II input definitions
based on schematics and manuals.
Got Space Invaders specific stuff out of the Midway 8080 B/W base class.
Got some of the game-specific stuff out of the _8080bw_state class.
It's still a bit of a mess because sound hardware is implemented in the
driver classes so some games pull in a more derived class than they
really should just for sound handlers.
Got rid of the duplicate joystick inputs in rollingc.
Fixed cocktail mode input and DIP switches in a few games.
Diffstat (limited to 'src/mame/machine')
-rw-r--r-- | src/mame/machine/mw8080bw.cpp | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/src/mame/machine/mw8080bw.cpp b/src/mame/machine/mw8080bw.cpp deleted file mode 100644 index 482b7f1bb9a..00000000000 --- a/src/mame/machine/mw8080bw.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Tormod Tjaberg, Mirko Buffoni,Lee Taylor, Valerio Verrando, Zsolt Vasvari -// thanks-to:Michael Strutts, Marco Cassili -/*************************************************************************** - - Midway 8080-based black and white hardware - -****************************************************************************/ - -#include "emu.h" -#include "includes/mw8080bw.h" - -/************************************* - * - * Interrupt generation - * - *************************************/ - -uint8_t mw8080bw_state::vpos_to_vysnc_chain_counter( int vpos ) -{ - /* convert from a vertical position to the actual values on the vertical sync counters */ - uint8_t counter; - int vblank = (vpos >= MW8080BW_VBSTART); - - if (vblank) - counter = vpos - MW8080BW_VBSTART + MW8080BW_VCOUNTER_START_VBLANK; - else - counter = vpos + MW8080BW_VCOUNTER_START_NO_VBLANK; - - return counter; -} - - -int mw8080bw_state::vysnc_chain_counter_to_vpos( uint8_t counter, int vblank ) -{ - /* convert from the vertical sync counters to an actual vertical position */ - int vpos; - - if (vblank) - vpos = counter - MW8080BW_VCOUNTER_START_VBLANK + MW8080BW_VBSTART; - else - vpos = counter - MW8080BW_VCOUNTER_START_NO_VBLANK; - - return vpos; -} - - -TIMER_CALLBACK_MEMBER(mw8080bw_state::interrupt_trigger) -{ - int vpos = m_screen->vpos(); - uint8_t counter = vpos_to_vysnc_chain_counter(vpos); - - if (m_int_enable) - { - m_maincpu->set_input_line(0, ASSERT_LINE); - m_interrupt_time = machine().time(); - } - else - m_maincpu->set_input_line(0, CLEAR_LINE); - - /* set up for next interrupt */ - uint8_t next_counter; - int next_vblank; - if (counter == MW8080BW_INT_TRIGGER_COUNT_1) - { - next_counter = MW8080BW_INT_TRIGGER_COUNT_2; - next_vblank = MW8080BW_INT_TRIGGER_VBLANK_2; - } - else - { - next_counter = MW8080BW_INT_TRIGGER_COUNT_1; - next_vblank = MW8080BW_INT_TRIGGER_VBLANK_1; - } - - int next_vpos = vysnc_chain_counter_to_vpos(next_counter, next_vblank); - m_interrupt_timer->adjust(m_screen->time_until_pos(next_vpos)); -} - - -WRITE_LINE_MEMBER(mw8080bw_state::int_enable_w) -{ - m_int_enable = state; -} - - -IRQ_CALLBACK_MEMBER(mw8080bw_state::interrupt_vector) -{ - int vpos = m_screen->vpos(); - // MAME scheduling quirks cause this to happen more often than you might think, in fact far too often - if (machine().time() < m_interrupt_time) - vpos++; - uint8_t counter = vpos_to_vysnc_chain_counter(vpos); - uint8_t vector = 0xc7 | ((counter & 0x40) >> 2) | ((~counter & 0x40) >> 3); - - m_maincpu->set_input_line(0, CLEAR_LINE); - return vector; -} - - -void mw8080bw_state::mw8080bw_create_interrupt_timer( ) -{ - m_interrupt_timer = timer_alloc(FUNC(mw8080bw_state::interrupt_trigger), this); -} - - -void mw8080bw_state::mw8080bw_start_interrupt_timer( ) -{ - int vpos = vysnc_chain_counter_to_vpos(MW8080BW_INT_TRIGGER_COUNT_1, MW8080BW_INT_TRIGGER_VBLANK_1); - m_interrupt_timer->adjust(m_screen->time_until_pos(vpos)); - - m_interrupt_time = attotime::zero; -} - - - -/************************************* - * - * Machine setup - * - *************************************/ - -void mw8080bw_state::machine_start() -{ - mw8080bw_create_interrupt_timer(); -} - - -/************************************* - * - * Machine reset - * - *************************************/ - -MACHINE_RESET_MEMBER(mw8080bw_state,mw8080bw) -{ - mw8080bw_start_interrupt_timer(); -} |