trunk/src/mame/drivers/zac_1.c
r17497 | r17498 | |
9 | 9 | - Display |
10 | 10 | - Sound |
11 | 11 | - Artwork |
12 | | - Int generator |
13 | 12 | |
14 | 13 | **************************************************************************************/ |
15 | 14 | |
r17497 | r17498 | |
30 | 29 | DECLARE_WRITE8_MEMBER(ctrl_w); |
31 | 30 | DECLARE_READ8_MEMBER(serial_r); |
32 | 31 | 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; |
33 | 36 | protected: |
34 | 37 | |
35 | 38 | // devices |
36 | | required_device<cpu_device> m_maincpu; |
37 | 39 | required_shared_ptr<UINT8> m_p_ram; |
38 | 40 | |
39 | 41 | // driver_device overrides |
40 | 42 | virtual void machine_reset(); |
| 43 | private: |
| 44 | UINT8 m_input_line; |
41 | 45 | public: |
42 | 46 | DECLARE_DRIVER_INIT(zac_1); |
43 | 47 | }; |
r17497 | r17498 | |
46 | 50 | static ADDRESS_MAP_START( zac_1_map, AS_PROGRAM, 8, zac_1_state ) |
47 | 51 | ADDRESS_MAP_GLOBAL_MASK(0x1fff) |
48 | 52 | AM_RANGE(0x0000, 0x13ff) AM_ROM |
| 53 | AM_RANGE(0x1400, 0x17ff) AM_WRITE(reset_int_w) |
49 | 54 | AM_RANGE(0x1800, 0x1bff) AM_RAM AM_SHARE("ram") |
50 | 55 | AM_RANGE(0x1c00, 0x1fff) AM_ROM |
51 | 56 | ADDRESS_MAP_END |
r17497 | r17498 | |
57 | 62 | ADDRESS_MAP_END |
58 | 63 | |
59 | 64 | static 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 ) |
60 | 81 | INPUT_PORTS_END |
61 | 82 | |
62 | 83 | READ8_MEMBER( zac_1_state::ctrl_r ) |
63 | 84 | { |
64 | 85 | // 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 |
66 | 93 | } |
67 | 94 | |
68 | 95 | WRITE8_MEMBER( zac_1_state::ctrl_w ) |
69 | 96 | { |
| 97 | m_input_line = data; |
70 | 98 | } |
71 | 99 | |
| 100 | WRITE8_MEMBER( zac_1_state::reset_int_w ) |
| 101 | { |
| 102 | device_set_input_line(m_maincpu, INPUT_LINE_IRQ0, CLEAR_LINE); |
| 103 | } |
| 104 | |
72 | 105 | READ8_MEMBER( zac_1_state::serial_r ) |
73 | 106 | { |
74 | 107 | // from printer |
r17497 | r17498 | |
82 | 115 | |
83 | 116 | void zac_1_state::machine_reset() |
84 | 117 | { |
| 118 | m_t_c = 0; |
85 | 119 | } |
86 | 120 | |
| 121 | static 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 | |
| 133 | static 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 | |
87 | 143 | DRIVER_INIT_MEMBER(zac_1_state,zac_1) |
88 | 144 | { |
89 | 145 | } |
r17497 | r17498 | |
93 | 149 | MCFG_CPU_ADD("maincpu", S2650, 6000000/2) |
94 | 150 | MCFG_CPU_PROGRAM_MAP(zac_1_map) |
95 | 151 | 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)) |
96 | 154 | MACHINE_CONFIG_END |
97 | 155 | |
98 | 156 | |