trunk/src/mame/drivers/spectra.c
r18186 | r18187 | |
61 | 61 | |
62 | 62 | static INPUT_PORTS_START( spectra ) |
63 | 63 | PORT_START("X0") |
64 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) |
65 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) |
66 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) |
67 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) |
68 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) |
69 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) |
70 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) |
71 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) |
| 64 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Outhole") PORT_CODE(KEYCODE_X) |
| 65 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Outlane 1") PORT_CODE(KEYCODE_W) |
| 66 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("CR Hole") PORT_CODE(KEYCODE_E) |
| 67 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TR Hole") PORT_CODE(KEYCODE_R) |
| 68 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Bumper") PORT_CODE(KEYCODE_Y) |
| 69 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C Bumper") PORT_CODE(KEYCODE_U) |
| 70 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Bumper") PORT_CODE(KEYCODE_I) |
| 71 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Triangle") PORT_CODE(KEYCODE_O) |
72 | 72 | PORT_START("X1") |
73 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) |
74 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) |
75 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) |
76 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) |
77 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) |
78 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) |
79 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) |
80 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) |
| 73 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Triangle") PORT_CODE(KEYCODE_A) |
| 74 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Outlane") PORT_CODE(KEYCODE_S) |
| 75 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Rollover") PORT_CODE(KEYCODE_D) |
| 76 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Rollover") PORT_CODE(KEYCODE_F) |
| 77 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Inside Target") PORT_CODE(KEYCODE_G) |
| 78 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C Inside Target") PORT_CODE(KEYCODE_H) |
| 79 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Inside Target") PORT_CODE(KEYCODE_J) |
| 80 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("CL Target") PORT_CODE(KEYCODE_K) |
81 | 81 | PORT_START("X2") |
82 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) |
83 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) |
84 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) |
85 | | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) |
86 | | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) |
87 | | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) |
88 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) |
89 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) |
| 82 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("CL Button") PORT_CODE(KEYCODE_Z) |
| 83 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL Button") PORT_CODE(KEYCODE_Q) |
| 84 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL Target") PORT_CODE(KEYCODE_C) |
| 85 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Outlane 2") PORT_CODE(KEYCODE_V) |
| 86 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Outlane 3") PORT_CODE(KEYCODE_B) |
| 87 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Pentagon") PORT_CODE(KEYCODE_N) |
| 88 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Pentagon") PORT_CODE(KEYCODE_M) |
| 89 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL Area") PORT_CODE(KEYCODE_COMMA) |
90 | 90 | PORT_START("X3") |
91 | | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) |
92 | | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) |
93 | | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) |
| 91 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Area") PORT_CODE(KEYCODE_STOP) |
| 92 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Area") PORT_CODE(KEYCODE_SLASH) |
| 93 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Inlane Button") PORT_CODE(KEYCODE_L) |
94 | 94 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_COIN1) |
95 | 95 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1) |
96 | 96 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_TILT) |
r18186 | r18187 | |
108 | 108 | READ8_MEMBER( spectra_state::porta_r ) |
109 | 109 | { |
110 | 110 | char kbdrow[6]; |
| 111 | UINT8 key=0, old=0, ret=0; |
111 | 112 | sprintf(kbdrow,"X%X",(m_porta & 0x18) >> 3); |
112 | | UINT8 data = ioport(kbdrow)->read(); |
113 | | return ((BIT(data, m_porta & 7)) ? 0x40 : 0) | (m_porta & 0xbf); |
| 113 | key = ioport(kbdrow)->read(); |
| 114 | ret = ((BIT(key, m_porta & 7)) ? 0x40 : 0) | (m_porta & 0xbf); |
| 115 | |
| 116 | if (ret == 0x1b && old != ret && m_p_ram[0x7b] < 0x1E) |
| 117 | m_samples->start(2, 4); // coin |
| 118 | old = ret; |
| 119 | |
| 120 | return ret; |
114 | 121 | } |
115 | 122 | |
116 | 123 | READ8_MEMBER( spectra_state::portb_r ) |
r18186 | r18187 | |
144 | 151 | |
145 | 152 | TIMER_DEVICE_CALLBACK_MEMBER( spectra_state::nmitimer) |
146 | 153 | { |
147 | | if (m_t_c > 0x80) |
| 154 | if (m_t_c > 0x10) |
148 | 155 | m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
149 | 156 | else |
150 | 157 | m_t_c++; |
r18186 | r18187 | |
165 | 172 | output_set_digit_value(m_out_offs, segments); |
166 | 173 | } |
167 | 174 | else |
| 175 | if (m_out_offs < 0x6f) |
| 176 | m_out_offs = 0x6f; |
| 177 | else |
| 178 | if (m_out_offs < 0x74) |
| 179 | { |
| 180 | if (m_p_ram[m_out_offs]) |
| 181 | m_samples->start(0, 5); // holes |
| 182 | } |
| 183 | else |
| 184 | if (m_out_offs < 0x77) |
| 185 | { |
| 186 | if (m_p_ram[m_out_offs]) |
| 187 | m_samples->start(1, 0); // bumpers |
| 188 | } |
| 189 | else |
168 | 190 | m_out_offs = 0xff; |
169 | 191 | } |
170 | 192 | |