Previous 15994 Revisions Next

r11049 Sunday 3rd April, 2011 at 02:28:50 UTC by Robbbert
[EACC] Added notes.
[src/mess/drivers]eacc.c

src/mess/drivers/eacc.c
r11048r11049
1717*    8000-BFFF 6821
1818*    C000-FFFF ROM (mirror)
1919*
20*    The ROM was typed in from the dump in the magazine article, therefore
21*    it is marked as BAD_DUMP.
20*    The ROM was typed in twice from the dump in the magazine article, and the
21*    results compared. Only one byte was different, so I can be confident that
22*    it has been typed in properly.
2223*
2324*    ToDo:
2425*    - Proper artwork
25*    - There are various problems probably due to typos when making the rom.
26*    - There are various problems, seems to be another victim of inadequate
27*      6821 emulation.
2628*
2729******************************************************************************/
2830#define ADDRESS_MAP_MODERN
r11048r11049
3335#include "eacc.lh"
3436#include "machine/6821pia.h"
3537
38#define MACHINE_RESET_MEMBER(name) void name::machine_reset()
3639
3740class eacc_state : public driver_device
3841{
r11048r11049
5053   DECLARE_READ_LINE_MEMBER( eacc_fuel_sensor_r );
5154   DECLARE_READ8_MEMBER( eacc_keyboard_r );
5255   DECLARE_WRITE_LINE_MEMBER( eacc_cb2_w );
53   DECLARE_WRITE8_MEMBER( eacc_multiplex_w );
56   DECLARE_WRITE8_MEMBER( eacc_digit_w );
5457   DECLARE_WRITE8_MEMBER( eacc_segment_w );
55   UINT8 m_cb1;
56   UINT8 m_cb2;
57   UINT8 m_multiplex;
58   bool m_cb1;
59   bool m_cb2;
60   UINT8 m_digit;
5861   UINT8 m_segment;
5962   void eacc_display();
6063   virtual void machine_reset();
r11048r11049
106109   PORT_BIT( 0xf8, 0, IPT_UNUSED )
107110INPUT_PORTS_END
108111
109void eacc_state::machine_reset()
112MACHINE_RESET_MEMBER(eacc_state)
110113{
111114   m_cb2 = 0;
112115}
r11048r11049
120123static TIMER_DEVICE_CALLBACK( eacc_nmi )
121124{
122125   eacc_state *state = timer.machine().driver_data<eacc_state>();
126
123127   if (state->m_cb2)
124128      device_set_input_line(timer.machine().device("maincpu"), INPUT_LINE_NMI, ASSERT_LINE);
125129}
r11048r11049
146150
147151READ8_MEMBER( eacc_state::eacc_keyboard_r )
148152{
149   UINT8 data = m_multiplex;
153   UINT8 data = m_digit;
150154
151   if (BIT(m_multiplex, 3))
155   if (BIT(m_digit, 3))
152156      data |= input_port_read(m_machine, "X0");
153   if (BIT(m_multiplex, 4))
157   if (BIT(m_digit, 4))
154158      data |= input_port_read(m_machine, "X1");
155   if (BIT(m_multiplex, 5))
159   if (BIT(m_digit, 5))
156160      data |= input_port_read(m_machine, "X2");
157   if (BIT(m_multiplex, 6))
161   if (BIT(m_digit, 6))
158162      data |= input_port_read(m_machine, "X3");
159163
160164   return data;
r11048r11049
166170   char lednum[6];
167171
168172   for (i = 3; i < 7; i++)
169      if (BIT(m_multiplex, i))
173      if (BIT(m_digit, i))
170174         output_set_digit_value(i, m_segment);
171175
172   if (BIT(m_multiplex, 7))
176   if (BIT(m_digit, 7))
173177      for (i = 0; i < 8; i++)
174178      {
175179         sprintf(lednum,"led%d",i);
r11048r11049
192196   eacc_display();
193197}
194198
195WRITE8_MEMBER( eacc_state::eacc_multiplex_w )
199WRITE8_MEMBER( eacc_state::eacc_digit_w )
196200{
197201   device_set_input_line(m_machine.device("maincpu"), INPUT_LINE_NMI, CLEAR_LINE);
198   m_multiplex = data & 0xf8;
202   m_digit = data & 0xf8;
199203   eacc_display();
200204}
201205
r11048r11049
208212   DEVCB_DRIVER_LINE_MEMBER(eacc_state, eacc_fuel_sensor_r),   /* CA2 input - pulses as fuel consumed */
209213   DEVCB_NULL,                  /* CB2 input */
210214   DEVCB_DRIVER_MEMBER(eacc_state, eacc_segment_w),   /* port A output */
211   DEVCB_DRIVER_MEMBER(eacc_state, eacc_multiplex_w),   /* port B output */
215   DEVCB_DRIVER_MEMBER(eacc_state, eacc_digit_w),      /* port B output */
212216   DEVCB_NULL,                  /* CA2 output */
213217   DEVCB_DRIVER_LINE_MEMBER(eacc_state, eacc_cb2_w),   /* CB2 output - high after boot complete */
214218   DEVCB_CPU_INPUT_LINE("maincpu", M6800_IRQ_LINE),   /* IRQA output */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team