trunk/src/mame/drivers/g627.c
r18083 | r18084 | |
14 | 14 | to start. |
15 | 15 | |
16 | 16 | Schematic and PinMAME used as references |
| 17 | System made working in Sept 2012 [Robbbert] |
17 | 18 | |
18 | 19 | Machine Operation: |
19 | | 1. Press num-enter then END then .(period key) (the displays will flash 400000) |
20 | | 2. Press num-enter |
21 | | 3. Insert a coin, credit will be registered |
22 | | 4. Hold X and start game. When 00 is flashing, release X |
23 | | 5. Press any of QWERYUIOASDFGHJKLZ-='; to simulate scoring shots (T will tilt) |
24 | | 6. Press and hold X to simulate losing the ball |
25 | | 7. When score starts flashing, release X and go to step 5 to play next ball |
| 20 | 1. Press .(period key) (this sets up nvram and the displays will flash 400000) |
| 21 | 2. Insert a coin, credit will be registered |
| 22 | 3. Hold X and start game. When 00 is flashing, release X |
| 23 | 4. Press any of QWERYUIOASDFGHJKLZ-='; to simulate scoring shots (T will tilt) |
| 24 | 5. Press and hold X to simulate losing the ball |
| 25 | 6. When score starts flashing, release X and go to step 5 to play next ball |
26 | 26 | |
27 | 27 | Notes: Do not play more than one player because the machine will try to |
28 | 28 | rotate the table, and the motor circuits are not emulated due to lack of info. |
r18083 | r18084 | |
32 | 32 | high score, etc., with the diagnostic keyboard. |
33 | 33 | |
34 | 34 | ToDo: |
35 | | - Battery backup |
36 | | - Outputs |
37 | | - Simulate motor circuitry and sensor feedback |
38 | | - Verify labels of East, West and South on the display panel |
| 35 | - Lamp outputs |
39 | 36 | - Possibility of a rom missing (most likely it is optional) |
40 | 37 | |
41 | 38 | *******************************************************************************/ |
42 | 39 | |
43 | 40 | |
44 | | #include "emu.h" |
| 41 | #include "machine/genpin.h" |
45 | 42 | #include "cpu/z80/z80.h" |
46 | 43 | #include "machine/i8155.h" |
| 44 | #include "machine/nvram.h" |
47 | 45 | #include "sound/astrocde.h" |
48 | 46 | #include "g627.lh" |
49 | 47 | |
r18083 | r18084 | |
53 | 51 | public: |
54 | 52 | g627_state(const machine_config &mconfig, device_type type, const char *tag) |
55 | 53 | : driver_device(mconfig, type, tag), |
56 | | m_maincpu(*this, "maincpu") |
| 54 | m_maincpu(*this, "maincpu"), |
| 55 | m_samples(*this, "samples") |
57 | 56 | { } |
58 | 57 | |
59 | 58 | DECLARE_READ8_MEMBER(porta_r); |
r18083 | r18084 | |
66 | 65 | |
67 | 66 | // devices |
68 | 67 | required_device<cpu_device> m_maincpu; |
| 68 | required_device<samples_device> m_samples; |
69 | 69 | |
70 | | // driver_device overrides |
71 | | virtual void machine_reset(); |
72 | 70 | private: |
73 | 71 | UINT8 m_seg[6]; |
74 | 72 | UINT8 m_portc; |
| 73 | UINT8 m_motor; |
75 | 74 | }; |
76 | 75 | |
77 | 76 | |
78 | 77 | static ADDRESS_MAP_START( g627_map, AS_PROGRAM, 8, g627_state ) |
79 | 78 | AM_RANGE(0x0000, 0x1fff) AM_ROM |
80 | 79 | AM_RANGE(0xc000, 0xc0ff) AM_DEVREADWRITE("i8156", i8155_device, memory_r, memory_w) |
81 | | AM_RANGE(0xe000, 0xe0ff) AM_RAM // battery backed |
| 80 | AM_RANGE(0xe000, 0xe0ff) AM_RAM AM_SHARE("nvram") // battery backed |
82 | 81 | ADDRESS_MAP_END |
83 | 82 | |
84 | 83 | static ADDRESS_MAP_START( g627_io, AS_IO, 8, g627_state ) |
r18083 | r18084 | |
90 | 89 | ADDRESS_MAP_END |
91 | 90 | |
92 | 91 | static INPUT_PORTS_START( g627 ) |
93 | | PORT_START("X0") |
94 | | PORT_BIT(0x03, IP_ACTIVE_LOW, IPT_UNUSED) // force 3 here so game can start |
| 92 | //PORT_START("X0") |
95 | 93 | //bits 0,1 : optical encoder for precise table alignment. Correct position = 3. |
96 | 94 | //bit2-7 : position of table as it turns, using Gray code. |
97 | | // code to convert a number to a Gray Code: { return (input >> 1)^input; } |
98 | 95 | PORT_START("X1") |
99 | 96 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Centre TB") PORT_CODE(KEYCODE_Q) |
100 | 97 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bank Shot Outlane") PORT_CODE(KEYCODE_W) |
r18083 | r18084 | |
172 | 169 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Test 8") PORT_CODE(KEYCODE_STOP) |
173 | 170 | INPUT_PORTS_END |
174 | 171 | |
175 | | void g627_state::machine_reset() |
176 | | { |
177 | 172 | |
178 | | } |
179 | | |
180 | 173 | // inputs |
181 | 174 | READ8_MEMBER( g627_state::porta_r ) |
182 | 175 | { |
| 176 | if (!m_portc) |
| 177 | return ((m_motor >> 1)^m_motor) | 3; // convert to Gray Code |
| 178 | else |
183 | 179 | if (m_portc < 7) |
184 | 180 | { |
185 | 181 | char kbdrow[6]; |
r18083 | r18084 | |
201 | 197 | return 0; |
202 | 198 | } |
203 | 199 | |
204 | | // write 6 digits |
| 200 | // display digits |
205 | 201 | WRITE8_MEMBER( g627_state::portc_w ) |
206 | 202 | { |
207 | 203 | m_portc = data; |
r18083 | r18084 | |
227 | 223 | // lamps and solenoids |
228 | 224 | WRITE8_MEMBER( g627_state::lamp_w ) |
229 | 225 | { |
| 226 | /* offset 0 together with m_portc activates the lamps. |
| 227 | offset 1 and 2 are solenoids. |
| 228 | offset 1: |
| 229 | d0 = Outhole |
| 230 | d1 = Bank shot |
| 231 | d2-4 = Bumper : centre, Bottom, Top |
| 232 | d5-7 = Sling Shot : Top, Right, Left |
| 233 | offset 2: |
| 234 | d0 = Break Shot |
| 235 | d1 = Motor clockwise* |
| 236 | d2 = Motor anti-clockwise* |
| 237 | d3 = 3 flippers |
| 238 | d4 = unknown* |
| 239 | |
| 240 | * = undocumented |
| 241 | |
| 242 | */ |
| 243 | |
| 244 | UINT16 solenoid = (offset << 8) | data; |
| 245 | switch (solenoid) |
| 246 | { |
| 247 | case 0x0101: |
| 248 | case 0x0120: |
| 249 | case 0x0140: |
| 250 | case 0x0180: |
| 251 | case 0x0201: |
| 252 | m_samples->start(0, 5); |
| 253 | break; |
| 254 | case 0x0104: |
| 255 | case 0x0108: |
| 256 | case 0x0110: |
| 257 | m_samples->start(1, 0); |
| 258 | break; |
| 259 | case 0x0202: |
| 260 | case 0x0212: |
| 261 | m_motor++; |
| 262 | break; |
| 263 | case 0x0204: |
| 264 | case 0x0214: |
| 265 | m_motor--; |
| 266 | break; |
| 267 | default: |
| 268 | break; |
| 269 | } |
230 | 270 | } |
231 | 271 | |
232 | 272 | static I8156_INTERFACE(i8156_intf) |
r18083 | r18084 | |
246 | 286 | MCFG_CPU_PROGRAM_MAP(g627_map) |
247 | 287 | MCFG_CPU_IO_MAP(g627_io) |
248 | 288 | MCFG_I8156_ADD("i8156", 14138000/8, i8156_intf) |
249 | | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 289 | MCFG_NVRAM_ADD_0FILL("nvram") |
| 290 | |
| 291 | /* Sound */ |
| 292 | MCFG_FRAGMENT_ADD( genpin_audio ) |
250 | 293 | MCFG_SOUND_ADD("astrocade", ASTROCADE, 14138000/8) // 0066-117XX audio chip |
251 | 294 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
252 | 295 | |