Previous 199869 Revisions Next

r17498 Monday 27th August, 2012 at 12:59:12 UTC by Robbbert
zac_1: added timers, interrupt handler and some inputs (nw)
[src/mame/drivers]zac_1.c

trunk/src/mame/drivers/zac_1.c
r17497r17498
99- Display
1010- Sound
1111- Artwork
12- Int generator
1312
1413**************************************************************************************/
1514
r17497r17498
3029   DECLARE_WRITE8_MEMBER(ctrl_w);
3130   DECLARE_READ8_MEMBER(serial_r);
3231   DECLARE_WRITE8_MEMBER(serial_w);
32   DECLARE_WRITE8_MEMBER(reset_int_w);
33   UINT8 m_t_c;
34   UINT8 m_out_offs;
35   required_device<cpu_device> m_maincpu;
3336protected:
3437
3538   // devices
36   required_device<cpu_device> m_maincpu;
3739   required_shared_ptr<UINT8> m_p_ram;
3840
3941   // driver_device overrides
4042   virtual void machine_reset();
43private:
44   UINT8 m_input_line;
4145public:
4246   DECLARE_DRIVER_INIT(zac_1);
4347};
r17497r17498
4650static ADDRESS_MAP_START( zac_1_map, AS_PROGRAM, 8, zac_1_state )
4751   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
4852   AM_RANGE(0x0000, 0x13ff) AM_ROM
53   AM_RANGE(0x1400, 0x17ff) AM_WRITE(reset_int_w)
4954   AM_RANGE(0x1800, 0x1bff) AM_RAM AM_SHARE("ram")
5055   AM_RANGE(0x1c00, 0x1fff) AM_ROM
5156ADDRESS_MAP_END
r17497r17498
5762ADDRESS_MAP_END
5863
5964static INPUT_PORTS_START( zac_1 )
65   PORT_START("TEST")
66   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Test") PORT_CODE(KEYCODE_0)
67
68   PORT_START("ROW0")
69   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE )
70   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT )
71   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Slam")
72   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START )
73   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
74   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
75   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
76   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Printer")
77
78   PORT_START("ROW1")
79   PORT_BIT( 0xBF, IP_ACTIVE_LOW, IPT_UNUSED )
80   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT )
6081INPUT_PORTS_END
6182
6283READ8_MEMBER( zac_1_state::ctrl_r )
6384{
6485// reads inputs
65   return 0xff;
86   if (m_input_line == 0xfe)
87      return ioport("ROW0")->read();
88   else
89   if (m_input_line == 0xfd)
90      return ioport("ROW1")->read();
91   else
92      return 0xff; // playboard contactors
6693}
6794
6895WRITE8_MEMBER( zac_1_state::ctrl_w )
6996{
97   m_input_line = data;
7098}
7199
100WRITE8_MEMBER( zac_1_state::reset_int_w )
101{
102   device_set_input_line(m_maincpu, INPUT_LINE_IRQ0, CLEAR_LINE);
103}
104
72105READ8_MEMBER( zac_1_state::serial_r )
73106{
74107// from printer
r17497r17498
82115
83116void zac_1_state::machine_reset()
84117{
118   m_t_c = 0;
85119}
86120
121static TIMER_DEVICE_CALLBACK( zac_1_inttimer )
122{
123   zac_1_state *state = timer.machine().driver_data<zac_1_state>();
124   if (state->m_t_c > 0x40)
125   {
126      UINT8 vector = (state->ioport("TEST")->read() ) ? 0x10 : 0x18;
127      device_set_input_line_and_vector(state->m_maincpu, INPUT_LINE_IRQ0, ASSERT_LINE, vector);
128   }
129   else
130      state->m_t_c++;
131}
132
133static TIMER_DEVICE_CALLBACK( zac_1_outtimer )
134{
135   zac_1_state *state = timer.machine().driver_data<zac_1_state>();
136   state->m_out_offs++;
137// displays, solenoids, lamps
138// not sure yet but seems scores = 1800-182D; solenoids = 1840-187F;
139// lamps = 1880-18BF; credits &balls=18C0-18FF.
140// 182E-183F is a storage area for inputs.
141}
142
87143DRIVER_INIT_MEMBER(zac_1_state,zac_1)
88144{
89145}
r17497r17498
93149   MCFG_CPU_ADD("maincpu", S2650, 6000000/2)
94150   MCFG_CPU_PROGRAM_MAP(zac_1_map)
95151   MCFG_CPU_IO_MAP(zac_1_io)
152   MCFG_TIMER_ADD_PERIODIC("zac_1_inttimer", zac_1_inttimer, attotime::from_hz(200))
153   MCFG_TIMER_ADD_PERIODIC("zac_1_outtimer", zac_1_outtimer, attotime::from_hz(187500))
96154MACHINE_CONFIG_END
97155
98156

Previous 199869 Revisions Next


© 1997-2024 The MAME Team