diff options
Diffstat (limited to 'src/mame/machine/amstrad.cpp')
-rw-r--r-- | src/mame/machine/amstrad.cpp | 57 |
1 files changed, 25 insertions, 32 deletions
diff --git a/src/mame/machine/amstrad.cpp b/src/mame/machine/amstrad.cpp index 07c3eb31352..0910624225e 100644 --- a/src/mame/machine/amstrad.cpp +++ b/src/mame/machine/amstrad.cpp @@ -221,25 +221,6 @@ TIMER_CALLBACK_MEMBER(amstrad_state::amstrad_pc2_low) } -void amstrad_state::device_timer(emu_timer &timer, device_timer_id id, int param) -{ - switch (id) - { - case TIMER_PC2_LOW: - amstrad_pc2_low(param); - break; - case TIMER_VIDEO_UPDATE: - amstrad_video_update_timer(param); - break; - case TIMER_SET_RESOLUTION: - cb_set_resolution(param); - break; - default: - throw emu_fatalerror("Unknown id in amstrad_state::device_timer"); - } -} - - /*************************************************************************/ /* KC Compact @@ -589,7 +570,7 @@ void amstrad_state::amstrad_vh_update_colour(int PenIndex, uint16_t hw_colour_in { int val; - timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 1); + m_video_update_timer->adjust(attotime::from_usec(0), 1); /* CPC+/GX4000 - normal palette changes through the Gate Array also makes the corresponding change in the ASIC palette */ val = (amstrad_palette[hw_colour_index] & 0xf00000) >> 16; /* red */ @@ -600,7 +581,7 @@ void amstrad_state::amstrad_vh_update_colour(int PenIndex, uint16_t hw_colour_in } else { - timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0); + m_video_update_timer->adjust(attotime::from_usec(0), 0); } m_GateArray_render_colours[PenIndex] = hw_colour_index; } @@ -608,7 +589,7 @@ void amstrad_state::amstrad_vh_update_colour(int PenIndex, uint16_t hw_colour_in void amstrad_state::aleste_vh_update_colour(int PenIndex, uint16_t hw_colour_index) { - timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0); + m_video_update_timer->adjust(attotime::from_usec(0), 0); m_GateArray_render_colours[PenIndex] = hw_colour_index+32; } @@ -975,7 +956,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_vsync_changed) m_gate_array.vsync = state ? 1 : 0; /* Schedule a write to PC2 */ - timer_set(attotime::zero, TIMER_PC2_LOW); + m_pc2_low_timer->adjust(attotime::zero); } @@ -996,7 +977,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_vsync_changed) m_gate_array.vsync = state ? 1 : 0; /* Schedule a write to PC2 */ - timer_set(attotime::zero, TIMER_PC2_LOW); + m_pc2_low_timer->adjust(attotime::zero); } @@ -1075,6 +1056,8 @@ void amstrad_state::video_start() m_gate_array.bitmap = std::make_unique<bitmap_ind16>(m_screen->width(), m_screen->height() ); m_gate_array.hsync_after_vsync_counter = 3; std::fill(std::begin(m_GateArray_render_colours), std::end(m_GateArray_render_colours), 0); + + m_video_update_timer = timer_alloc(FUNC(amstrad_state::amstrad_video_update_timer), this); } @@ -2056,9 +2039,9 @@ void amstrad_state::amstrad_cpc_io_w(offs_t offset, uint8_t data) break; case 0x01: /* Write to selected internal 6845 register Write Only */ if ( m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000 ) - timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 1); + m_video_update_timer->adjust(attotime::from_usec(0), 1); else - timer_set(attotime::from_usec(0), TIMER_VIDEO_UPDATE, 0); + m_video_update_timer->adjust(attotime::from_usec(0), 0); m_crtc->register_w(data); /* printer port bit 8 */ @@ -2609,7 +2592,7 @@ uint8_t amstrad_state::amstrad_ppi_portb_r() //logerror("amstrad_ppi_portb_r\n"); /* Schedule a write to PC2 */ - timer_set(attotime::zero, TIMER_PC2_LOW); + m_pc2_low_timer->adjust(attotime::zero); return data; } @@ -3099,9 +3082,15 @@ TIMER_CALLBACK_MEMBER(amstrad_state::cb_set_resolution) m_screen->configure( 1024, height, visarea, refresh ); } +void amstrad_state::alloc_timers() +{ + m_pc2_low_timer = timer_alloc(FUNC(amstrad_state::amstrad_pc2_low), this); + m_set_resolution_timer = timer_alloc(FUNC(amstrad_state::cb_set_resolution), this); +} MACHINE_START_MEMBER(amstrad_state,amstrad) { + alloc_timers(); m_system_type = SYSTEM_CPC; m_centronics->write_data7(0); } @@ -3118,12 +3107,13 @@ MACHINE_RESET_MEMBER(amstrad_state,amstrad) m_gate_array.hsync = 0; m_gate_array.vsync = 0; - timer_set(attotime::zero, TIMER_SET_RESOLUTION); + m_set_resolution_timer->adjust(attotime::zero); } MACHINE_START_MEMBER(amstrad_state,plus) { + alloc_timers(); m_asic.ram = m_region_user1->base(); // 16kB RAM for ASIC, memory-mapped registers. m_system_type = SYSTEM_PLUS; m_centronics->write_data7(0); @@ -3166,11 +3156,12 @@ MACHINE_RESET_MEMBER(amstrad_state,plus) space.install_write_handler(0x6000, 0x7fff, write8sm_delegate(*this, FUNC(amstrad_state::amstrad_plus_asic_6000_w))); // multiface_init(); - timer_set(attotime::zero, TIMER_SET_RESOLUTION); + m_set_resolution_timer->adjust(attotime::zero); } MACHINE_START_MEMBER(amstrad_state,gx4000) { + alloc_timers(); m_asic.ram = m_region_user1->base(); // 16kB RAM for ASIC, memory-mapped registers. m_system_type = SYSTEM_GX4000; @@ -3208,11 +3199,12 @@ MACHINE_RESET_MEMBER(amstrad_state,gx4000) space.install_write_handler(0x4000, 0x5fff, write8sm_delegate(*this, FUNC(amstrad_state::amstrad_plus_asic_4000_w))); space.install_write_handler(0x6000, 0x7fff, write8sm_delegate(*this, FUNC(amstrad_state::amstrad_plus_asic_6000_w))); - timer_set(attotime::zero, TIMER_SET_RESOLUTION); + m_set_resolution_timer->adjust(attotime::zero); } MACHINE_START_MEMBER(amstrad_state,kccomp) { + alloc_timers(); m_system_type = SYSTEM_CPC; m_centronics->write_data7(0); @@ -3221,7 +3213,7 @@ MACHINE_START_MEMBER(amstrad_state,kccomp) m_gate_array.hsync = 0; m_gate_array.vsync = 0; - timer_set(attotime::zero, TIMER_SET_RESOLUTION); + m_set_resolution_timer->adjust(attotime::zero); } @@ -3242,6 +3234,7 @@ MACHINE_RESET_MEMBER(amstrad_state,kccomp) MACHINE_START_MEMBER(amstrad_state,aleste) { + alloc_timers(); m_system_type = SYSTEM_ALESTE; m_centronics->write_data7(0); } @@ -3251,7 +3244,7 @@ MACHINE_RESET_MEMBER(amstrad_state,aleste) amstrad_common_init(); amstrad_reset_machine(); - timer_set(attotime::zero, TIMER_SET_RESOLUTION); + m_set_resolution_timer->adjust(attotime::zero); } |