Previous 15994 Revisions Next

r11341 Tuesday 26th April, 2011 at 18:10:13 UTC by Curt Coder
[AMICO2K] Fixed LED flickering. [Curt Coder]
[src/mess/drivers]amico2k.c

src/mess/drivers/amico2k.c
r11340r11341
3030   amico2k_state(running_machine &machine, const driver_device_config_base &config)
3131      : driver_device(machine, config) { }
3232
33   void machine_start();
34
3335   DECLARE_READ8_MEMBER( ppi_pa_r );
3436   DECLARE_WRITE8_MEMBER( ppi_pa_w );
3537   DECLARE_READ8_MEMBER( ppi_pb_r );
3638   DECLARE_WRITE8_MEMBER( ppi_pb_w );
3739
38   int m_ls145;
40   int m_ls145_p;
41   UINT8 m_segment;
42
43   // timers
44   emu_timer *m_led_refresh_timer;
3945};
4046
4147
r11340r11341
8187   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
8288INPUT_PORTS_END
8389
90static TIMER_CALLBACK( led_refresh )
91{
92   amico2k_state *state = machine.driver_data<amico2k_state>();
93
94   if (state->m_ls145_p > 3)
95   {
96      output_set_digit_value(state->m_ls145_p - 4, state->m_segment);
97   }
98}
99
84100READ8_MEMBER( amico2k_state::ppi_pa_r )
85101{
86102   /*
r11340r11341
98114
99115   */
100116
101   switch (m_ls145)
117   switch (m_ls145_p)
102118   {
103119   case 0:      return input_port_read(machine(), "Q0");
104120   case 1:      return input_port_read(machine(), "Q1");
r11340r11341
123139      PA7     
124140
125141   */
126
127   if (m_ls145 > 3)
128   {
129      output_set_digit_value(m_ls145 - 4, data);
130   }
142   
143   m_segment = data;
144   m_led_refresh_timer->adjust(attotime::from_usec(70));
131145}
132146
133147READ8_MEMBER( amico2k_state::ppi_pb_r )
r11340r11341
167181
168182   */
169183
170   m_ls145 = (data >> 1) & 0x0f;
184   m_ls145_p = (data >> 1) & 0x0f;
171185}
172186
173187static I8255_INTERFACE( ppi_intf )
r11340r11341
180194   DEVCB_NULL                     // Port C write
181195};
182196
197void amico2k_state::machine_start()
198{
199   m_led_refresh_timer = machine().scheduler().timer_alloc(FUNC(led_refresh));
200
201   // state saving
202   save_item(NAME(m_ls145_p));
203   save_item(NAME(m_segment));
204}
205
183206static MACHINE_CONFIG_START( amico2k, amico2k_state )
184207   /* basic machine hardware */
185208   MCFG_CPU_ADD("maincpu", M6502, 1000000)   /* 1MHz */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team