1 // license:BSD-3-Clause
2 // copyright-holders:Roberto Fresca
3 /****************************************************************************************
4 
5   GAME-A-TRON gambling hardware.
6   Driver by Roberto Fresca.
7 
8   Games running on this hardware:
9 
10   * Four In One Poker,  1983, Game-A-Tron.
11   * Pull Tabs,          1983, Game-A-Tron.
12   * Bingo,              1983, Game-A-Tron.
13 
14 
15 *****************************************************************************************
16 
17   Hardware Notes:
18   ---------------
19 
20   * PCB1: PULL TABS.
21 
22   Board silkscreend: "GAME-A-TRON CORP. (c)1983 PAT.PENDING"
23                      "9003"
24 
25   ROMS: - U31 - 2732 (PT-1R-V)
26         - U32 - 2732 (PT-2G-V)
27         - U33 - 2732 (PT-3B-V)
28 
29         - U00 - 2764 (PULL-TABS-1-90)
30 
31   Most chips, except for the EPROMS, are covered with a hard black plastic coat
32   so their ID's could not be read.
33 
34   U30 location was silkscreend VRAM,    24 pin.
35   U11 location was silkscreend SCP RAM, 24 pin.
36   U13 location was silkscreend CPU,     40 pin.
37   U12 location was silkscreend DECODE,  16 pin.
38 
39   1x 16MHz Crystal
40   1x Duracell PX-2 I, 4.5V battery.
41 
42 
43   * PCB2: FOUR IN ONE POKER.
44 
45   Board silkscreend: "GAME-A-TRON CORP. (c)1983 PAT.PENDING"
46                      "9003"
47 
48   ROMS: - U31 - 2732 (POKER-R)
49         - U32 - 2732 (POKER-G)
50         - U33 - 2732 (BLACK)
51 
52         - U00 - 2764 (2764-POKER)
53         - U08 - 2732 (2732-POKER-4-1)
54 
55   Most chips, except for the EPROMS, are covered with a hard black plastic coat
56   so their ID's could not be read.
57 
58   U13    CPU (also coated with black plastic).
59   U05    I/O        M5L8255AP-5
60   U11    SCP RAM    TC5516APL  (2Kx8)
61   U30    VRAM       HM6116LP-3 (2Kx8)
62 
63   1x 16MHz Crystal
64   1x Duracell PX-2 I, 4.5V battery.
65 
66 
67   Identified the unknown writes as a init sequence for 1x PSG sound device.
68   Is a SN76489/496 family device, and can't be identified accurately due to
69   almost all devices are plastic covered.
70 
71 
72   * PCB 3: BINGO.
73 
74   The PCB doesn't looks like an official Game-A-Tron board. Maybe it's a bootleg,
75   or prototype. Battery backed RAM was replaced by a Mostek MK48Z02B-20 zeropower RAM.
76 
77    PCB Layout:
78   .-----------------------------------------------------------------------------------------------.
79   |                                                                                               |
80   |    U14        U11        U12        U13        U10        U9                                  |
81   |   .--------. .--------. .--------. .--------. .--------. .--------.          REV B            |
82   |   |74LS161 | |74LS161 | |74LS161 | |74LS161 | |74LS161 | |HD74LS04|  D R                      |
83   |   '--------' '--------' '--------' '--------' '--------' '--------'                           |
84   |   .--------. .--------. .--------.                           XTAL                             |
85   |   |74LS157 | |74LS157 | |74LS157 |                      R   .-----.  C C                      |
86   |   '--------' '--------' '--------'                      R   | 16  |                           |
87   |                                                         R   | MHz |                           |
88   |                                                             '-----'                           |
89   |                                                                               .--------.      |
90   |    .-------------.   U26                                .-------------.       | 74LS32 |U28   |
91   |    |U23          |  .--------.                          |   Mostek    |U3     '--------'      |
92   |    |    2732     |  |74LS166 |                          | MK48Z02B-20 |       .--------.      |
93   |    |          ROM|  '--------'                          |zeropower RAM|       | 74LS08 |U31   |
94   |    '-------------'                U20                   '-------------'       '--------'      |
95   |    .-------------.   U25         .-------------.      .---------------.       .--------.      |
96   |    |U22          |  .--------.   |             |      |U2             |       | 74LS00 |U30   |
97   |    |    2732     |  |74LS166 |   | NEC D4016C  |      |   2764 type   |       '--------'      |
98   |    |          ROM|  '--------'   |   (32Kx8)   |      |            ROM|       .--------.      |
99   |    '-------------'               '-------------'      '---------------'       | 74LS10 |U29   |
100   |    .-------------.   U24          U18                .---------------------.  '--------'      |
101   |    |U21          |  .--------.   .-----------.       |U1                   |  .--------.      |
102   |    |    2732     |  |74LS166 |   | 74LS245N  |       |    EMPTY SOCKET     |  | NO IC  |U5    |
103   |    |          ROM|  '--------'   '-----------'       |       (Z80)         |  '--------'      |
104   |    '-------------'                                   '---------------------'  .--------.      |
105   |                      U19            U6               .---------------------.  | 74LS74 |U8    |
106   |            .-----.  .--------.     .--------.        |U4                   |  '--------'      |
107   |            | POT |  |74LS367 |     |SN76489N|        |    EMPTY SOCKET     |                  |
108   |            '-----'  '--------'     '--------'        |     (8255 PPI)      |  .--------.      |
109   |             VOLUME               .-----------.       '---------------------'  | 74LS04 |U32   |
110   |                              U27 | 74LS374B1 |                                '--------'      |
111   |                                  '-----------'    CCCCCCCC      CCCCCCCC                      |
112   |                 U7                                                                            |
113   |                .--------.          RRRRRRRR       RRRRRRRR      RRRRRRRR       RRRRRRRR       |
114   |                | LM380N |                                                                     |
115   |                '--------'          CCCCCCCC       RRRRRRRR      RRRRRRRR       CCCCCCCC       |
116   |      C    C       C                                                              D  D         |
117   |                                                                                               |
118   '----------------------------.              25x2 EDGE CONNECTOR                .----------------'
119                                | | | | | | | | | | | | | | | | | | | | | | | | | |
120   R = Resistors.               | | | | | | | | | | | | | | | | | | | | | | | | | |
121   C = Capacitors.              '-------------------------------------------------'
122   D = Diodes.
123 
124 
125 *****************************************************************************************
126 
127   *** Game Notes ***
128 
129 
130   All games:
131 
132   The first time the machine is turned on, will show the legend "DATA ERROR".
133   You must to RESET (F3) the machine to initialize the NVRAM properly.
134 
135   NOTE: These games are intended to be for amusement only.
136   There is not such a payout system, so... Don't ask about it!
137 
138 
139   * Four In One Poker:
140 
141   Pressing SERVICE 1 (key 9) you enter the Test/Settings Mode. You can test
142   inputs there, and change all the game settings. Press "DISCARD 1" (key Z)
143   to choose an option, and "DISCARD 5" (key B) to change the settings.
144   Press "SERVICE 2" (key 0) to exit.
145 
146   The settings options are:
147 
148       HIGHEST-ANTE-IS:   1-5-10-15-20-25-30-35-40-45-50.
149       JOKERS:            0-1-2.
150       BONUS DRAWS:       0-1.
151       DOUBLE-UPS:        0-1-2-3-4-5-6-7-8-9.
152       WIN-ON:            JACKS AND UP - PAIR OF ACES.
153       SKILL LEVEL:       50-55-60-65-70-75-80-85-90-95-100.
154       CREDITS-PER-COIN:  1-5-10-15-20-25-30-35-40-45-50-55-60-65-70-75-80-85-90-95-100.
155 
156   The game allow to choose one of the following card games:
157 
158   - DRAW POKER.
159   - STUD POKER.
160   - ACEY-DEUCY.
161   - BLACKJACK.
162   - HIGH-LOW.
163 
164   Press "DISCARD 1" (key Z) to switch between games.
165   Press "BET/ANTE" (key N) to bet credits and then start the game.
166 
167   The rest of buttons are self-explanatory.
168 
169 
170   * Pull Tabs:
171 
172   Pressing SERVICE 1 (key 9) you enter the Test/Settings Mode. You can test
173   inputs there, and change all the game settings. Press "SUPER STAR TICKET"
174   (key Z) to choose an option, and "BIG BAR TICKET" (key C) to change the
175   settings. Press "SERVICE 2" (key 0) to exit.
176 
177   The settings options are:
178 
179       HIGHEST-ANTE-IS:   1-5-10-15-20-25.
180       SKILL LEVEL:       50-55-60-65-70-75-80-85-90-95-100.
181       CREDITS-PER-COIN:  1-5-10-15-20-25-30-35-40-45-50-55-60-65-70-75-80-85-90-95-100.
182       MUSIC:             PLAYS - OFF
183 
184   You must bet through "ANTE" (key 1), and then choose a ticket to play.
185 
186   Press "SUPER STAR TICKET" (key Z) to play with Super Star (left) Ticket.
187   Press "LADY LUCK TICKET" (key X) to play with Lady Luck (center) Ticket.
188   Press "BIG BAR TICKET" (key C) to play with Big Bar (right) Ticket.
189 
190   A curiosity...
191 
192   The Pull Tabs flyer shows the following paytable:
193 
194   - Super Star -      - Lady Luck -         - Big Bar -
195    3x Stars  75     3x Oranges     100     3x Bars     75
196    3x Hearts  8     3x Watermelons  25     3x Cherries 10
197    3x Cups    4     3x Horseshoes   10     3x Pears     6
198    3x Clubs   3     3x Liquors       5     3x Plums     4
199    3x Crowns  1     3x Bells         2     3x Bananas   2
200 
201   ...but the game seems to have inverted objects importance:
202 
203   - Super Star -      - Lady Luck -         - Big Bar -
204    3x Crowns 75     3x Bells       100     3x Bananas  75
205    3x Clubs   8     3x Liquors      25     3x Plums    10
206    3x Cups    4     3x Horseshoes   10     3x Pears     6
207    3x Hearts  3     3x Watermelons   5     3x Cherries  4
208    3x Stars   1     3x Oranges       2     3x Bars      2
209 
210   Can't get an input or combination of them that change this logic.
211   Maybe the paytable is different in this set, or just the flyer doesn't
212   reflect the real thing.
213 
214 
215   * Bingo:
216 
217   Pressing SERVICE 1 (key 9) you enter the Test/Settings Mode. You can test
218   inputs there, and change all the game settings. Press "CHANGE CARD" (key Z)
219   to choose an option, and "CHANGE GAME" (key C) to change the settings.
220   Press "SERVICE 3" (key 8) to test audio. Press "SERVICE 2" (key 0) to exit.
221 
222   The settings options are:
223 
224       HIGHEST-ANTE-IS:             1-5-10-15-20-25-30-35-40-45-50.
225       X OR FEWER HITS WIN 1 to 1:  1-2-3-4-5-6.
226       X DOUBLE-UPS:                0-1-2-3-4-5-6-7-8-9.
227       BEEPS DURING PLAY:           YES-NO.
228       SKILL LEVEL:                 50-55-60-65-70-75-80-85-90-95-100.
229       CREDITS-PER-COIN:            1-5-10-15-20-25-30-35-40-45-50-55-60-65-70-75-80-85-90-95-100.
230       3 ON A LINE WINS:            YES-NO.
231 
232   You must bet through "ANTE" (key 1), and then...
233 
234   Press "CHANGE CARD" (key Z) to change for another card with a different set of numbers.
235   Press "START" (key X) to start the game.
236   Press "CHANGE GAME" (key C) to switch between games X-L-T-C-N-U.
237 
238   Note that letters in games X-L-T-C-N-U are just references to the shape of the special
239   numbers group inside the card, which will play.
240 
241   You must setup double-ups to something different of 0 (default), to play with these
242   features (High or Low ball)
243 
244 
245 *****************************************************************************************
246 
247   --------------------
248   ***  Memory Map  ***
249   --------------------
250 
251   0x0000 - 0x5FFF    ; ROM space.
252   0x6000 - 0x67FF    ; Video RAM (only the first 0x300 bytes are used).
253   0x8000 - 0x87FF    ; Main RAM.
254   0xA000 - 0xA000    ; Sound (PSG).
255   0xE000 - 0xE000    ; Output Port 0 (lamps).
256 
257   * Z80 I/O ports *
258 
259     0x00 - 0x03      ; PPI 8255 (ports A & B as input, port C as output).
260 
261   * 8255 I/O ports *
262 
263     Port A (input)   ; Input Port 0 (player buttons).
264     Port B (input)   ; Input Port 1 (player & service buttons).
265     Port C (output)  ; Output Port 1 (lamps & counters).
266 
267 
268 *****************************************************************************************
269 
270   DRIVER UPDATES:
271 
272   [2015-10-22]
273   - Added siren/alarm input to Pull Tabs, and beeps/alarm input
274      to Four In One Poker. All these are present in the Test Mode.
275      However, their functions aren't clear.
276   - Switched the PSG to SN76489, since it's present in the Bingo PCB.
277   - Added technical notes and more documentation.
278 
279   [2014-02-04]
280   - Added Bingo (1983). PCB seems bootleg, but the game looks legit.
281   - Worked from the scratch a whole set of inputs and button-lamps support for this game.
282   - Changed the poker41 description to Four In One Poker (as seen in the official brochure).
283   - Added game and technical notes.
284 
285   [2008-10-14]
286   - Improved the button-lamps layouts to look more realistic.
287 
288   [2008-08-21]
289   After an exhaustive analysis to the unknown writes, finally figured out the missing sound device.
290   - Added sound support to "Poker 4-1" and "Pull Tabs".
291   - Figured out the output ports. Documented each bit accessed.
292   - Added button lamps support. Created layouts for both games.
293   - Switched the 8255 port C to be used as output port.
294   - Adjusted the coin pulse timing.
295   - Updated technical notes.
296   - Split the driver to driver + video.
297   - Final clean-up.
298 
299   [2008-05-31]
300   - Renamed the games to "Poker 4-1" and "Pull Tabs" as shown in the ROMs stickers.
301   - Renamed the ROMs in each set according to their own stickers.
302   - Moved the driver into gametron.a group.
303   - Added the missing input port C to 8255 PPI I/O chip. Poker41 and pulltabs don't
304      make use of it, but is present in the Test/Settings Mode.
305   - Updated technical notes.
306 
307   [2008-05-10]
308   - Initial release.
309   - Properly decoded graphics.
310   - Proper memory map.
311   - Added NVRAM support.
312   - Proper Inputs through 8255 PPI I/O chip.
313   - Both games are working.
314   - Added technical & game notes.
315 
316 
317   TODO:
318 
319   - Nothing... :)
320 
321 *****************************************************************************************/
322 
323 
324 #include "emu.h"
325 #include "includes/gatron.h"
326 
327 #include "cpu/z80/z80.h"
328 #include "machine/i8255.h"
329 #include "machine/nvram.h"
330 #include "sound/sn76496.h"
331 #include "emupal.h"
332 #include "screen.h"
333 #include "speaker.h"
334 
335 #include "bingo.lh"
336 #include "poker41.lh"
337 #include "pulltabs.lh"
338 
339 
340 #define MASTER_CLOCK    XTAL(16'000'000)
341 #define CPU_CLOCK       MASTER_CLOCK / 24    // 666.66 kHz, guess...
342 
343 
344 /****************************
345 *    Read/Write Handlers    *
346 ****************************/
347 
output_port_0_w(uint8_t data)348 void gatron_state::output_port_0_w(uint8_t data)
349 {
350 /*---------------
351   Poker 4-1 lamps
352   ---------------
353 
354   0x00 - Default State.
355   0x01 - Hold3.
356   0x02 - Hold4.
357   0x04 - Hold5/DDown.
358   0x08 - Ante/Bet.
359   0x10 - Start.
360   0x20 - Deal/Hit.
361   0x40 - Stand/FreeBonusDraw.
362 
363   - bits -
364   7654 3210
365   ---------
366   .... ...x --> Hold3.
367   .... ..x. --> Hold4.
368   .... .x.. --> Hold5/DDown.
369   .... x... --> Ante/Bet.
370   ...x .... --> Start.
371   ..x. .... --> Deal/Hit.
372   .x.. .... --> Stand/FreeBonusDraw.
373 
374 
375   ---------------
376   Pull Tabs lamps
377   ---------------
378 
379   0x00 - Default State.
380   0x01 - Hold3.
381   0x04 - Hold5.
382   0x08 - Ante/Bet.
383 
384   - bits -
385   7654 3210
386   ---------
387   .... ...x ---> Hold3.
388   .... .x.. ---> Hold5.
389   .... x... ---> Ante/Bet.
390 
391   Tab1 = Hold1
392   Tab2 = Hold3
393   Tab3 = Hold5
394 
395 
396   ---------------
397   Bingo lamps
398   ---------------
399 
400   0x01 - unknown.
401   0x02 - unknown.
402   0x04 - unknown.
403   0x08 - Ante/Bet.
404   0x10 - Start.
405   0x20 - Change Game / D-UP / High.
406   0x40 - Change Card / Take / Low.
407 
408   - bits -
409   7654 3210
410   ---------
411   .... ...x --> Hold3.
412   .... ..x. --> Hold4.
413   .... .x.. --> Hold5/DDown.
414   .... x... --> Ante/Bet.
415   ...x .... --> Start.
416   ..x. .... --> Change Game / D-UP / High.
417   .x.. .... --> Change Card / Take / Low.
418 
419 */
420 	for (uint8_t i = 0; i < 7; i++)
421 		m_lamps[i] = BIT(data, i);
422 }
423 
424 
output_port_1_w(uint8_t data)425 void gatron_state::output_port_1_w(uint8_t data)
426 {
427 /*----------------
428   Lamps & Counters
429   ----------------
430 
431   - bits -
432   7654 3210
433   ---------
434   .... ...x --> Hold2 lamp.
435   .... ..x. --> Hold1 lamp.
436   .x.. .... --> Coin counter (inverted).
437   x... .... --> Inverted pulse. Related to counters.
438 
439 */
440 	for (uint8_t i = 0; i < 2; i++)
441 		m_lamps[i + 7] = BIT(data, i);
442 }
443 
444 /*************************
445 * Memory Map Information *
446 *************************/
447 
gat_map(address_map & map)448 void gatron_state::gat_map(address_map &map)
449 {
450 	map(0x0000, 0x5fff).rom();
451 	map(0x6000, 0x63ff).ram().w(FUNC(gatron_state::videoram_w)).share("videoram");
452 	map(0x8000, 0x87ff).ram().share("nvram");                          /* battery backed RAM */
453 	map(0xa000, 0xa000).w("snsnd", FUNC(sn76489_device::write));       /* PSG */
454 	map(0xe000, 0xe000).w(FUNC(gatron_state::output_port_0_w));  /* lamps */
455 }
456 
gat_portmap(address_map & map)457 void gatron_state::gat_portmap(address_map &map)
458 {
459 	map.global_mask(0xff);
460 	map(0x00, 0x03).rw("ppi8255", FUNC(i8255_device::read), FUNC(i8255_device::write));
461 }
462 
463 
464 /*************************
465 *      Input Ports       *
466 *************************/
467 
468 static INPUT_PORTS_START( poker41 )
469 	PORT_START("IN0")
470 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD4 )  PORT_NAME("Discard 4")
471 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BET )   PORT_NAME("Bet / Ante")
472 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL )  PORT_NAME("Deal / Hit")
473 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )        PORT_IMPULSE(2)
474 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_STAND ) PORT_NAME("Free Bonus Draw / Stand")
475 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )       PORT_NAME("Start")
476 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_HOLD5 )  PORT_NAME("Discard 5 / High / Double Down")
477 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_HOLD3 )  PORT_NAME("Discard 3")
478 
479 	PORT_START("IN1")
480 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3 )     PORT_NAME("Service 3 (Trigger bips/alarm in Test Mode)") PORT_CODE(KEYCODE_8)
481 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD2 )  PORT_NAME("Discard 2")
482 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK )  PORT_NAME("Service 2 (Test Mode Out / Coin Stuck)")
483 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* Payout? */
484 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
485 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Service 1 (Test/Settings)")
486 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
487 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_HOLD1 )  PORT_NAME("Discard 1 / Low")
488 INPUT_PORTS_END
489 
490 static INPUT_PORTS_START( pulltabs )
491 	PORT_START("IN0")
492 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
493 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )  PORT_NAME("Ante") PORT_CODE(KEYCODE_1)
494 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
495 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )    PORT_IMPULSE(2) /* Coin A */
496 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
497 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
498 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 )  PORT_NAME("Big Bar Ticket") PORT_CODE(KEYCODE_C)
499 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )  PORT_NAME("Lady Luck Ticket") PORT_CODE(KEYCODE_X)
500 
501 	PORT_START("IN1")
502 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_NAME("Service 3 (Trigger siren/alarm in Test Mode)") PORT_CODE(KEYCODE_8)
503 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
504 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Service 2 (Test Mode Out / Coin Stuck)") PORT_CODE(KEYCODE_0)
505 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
506 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
507 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service 1 (Test/Settings)") PORT_CODE(KEYCODE_9)
508 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
509 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )  PORT_NAME("Super Star Ticket") PORT_CODE(KEYCODE_Z)
510 INPUT_PORTS_END
511 
512 static INPUT_PORTS_START( bingo )
513 	PORT_START("IN0")
514 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
515 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Ante") PORT_CODE(KEYCODE_1)                // bet/ante
516 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Change Game / High") PORT_CODE(KEYCODE_C)  // change game (lucky game X-L-T-C-N-U) / change values in settings.
517 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(2)                                       // coin in
518 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Change Card / Low")  PORT_CODE(KEYCODE_Z)  // change card / move down in settings
519 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Start") PORT_CODE(KEYCODE_X)               // start
520 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
521 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
522 
523 	PORT_START("IN1")
524 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_NAME("Service 3 (Trigger beeps/alarm in Test Mode)") PORT_CODE(KEYCODE_8)
525 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
526 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Service 2 (Test Mode Out / Coin Stuck)") PORT_CODE(KEYCODE_0) // exit test-settings mode
527 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
528 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
529 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service 1 (Test/Settings Mode)") PORT_CODE(KEYCODE_9)
530 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
531 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
532 INPUT_PORTS_END
533 
534 
535 /*************************
536 *    Graphics Layouts    *
537 *************************/
538 
539 static const gfx_layout charlayout =
540 {
541 	8, 16,
542 	RGN_FRAC(1,3),  /* 256 tiles */
543 	3,
544 	{ 0, RGN_FRAC(1,3), RGN_FRAC(2,3) },    /* bitplanes are separated */
545 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
546 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
547 		8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
548 	16*8    /* every char takes 16 consecutive bytes */
549 
550 };
551 
552 
553 /******************************
554 * Graphics Decode Information *
555 ******************************/
556 
557 static GFXDECODE_START( gfx_gat )
558 	GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 )
559 GFXDECODE_END
560 
561 
562 /*************************
563 *    Machine Drivers     *
564 *************************/
565 
gat(machine_config & config)566 void gatron_state::gat(machine_config &config)
567 {
568 	/* basic machine hardware */
569 	Z80(config, m_maincpu, CPU_CLOCK);
570 	m_maincpu->set_addrmap(AS_PROGRAM, &gatron_state::gat_map);
571 	m_maincpu->set_addrmap(AS_IO, &gatron_state::gat_portmap);
572 
573 	NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
574 
575 	i8255_device &ppi(I8255A(config, "ppi8255"));
576 	ppi.in_pa_callback().set_ioport("IN0");
577 	ppi.in_pb_callback().set_ioport("IN1");
578 	ppi.out_pc_callback().set(FUNC(gatron_state::output_port_1_w));
579 
580 	/* video hardware */
581 	screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
582 	screen.set_refresh_hz(60);
583 	screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
584 	screen.set_size(48*8, 16*16);
585 	screen.set_visarea(0*8, 48*8-1, 0*8, 16*16-1);
586 	screen.set_screen_update(FUNC(gatron_state::screen_update));
587 	screen.set_palette("palette");
588 	screen.screen_vblank().set_inputline(m_maincpu, INPUT_LINE_NMI);
589 
590 	GFXDECODE(config, m_gfxdecode, "palette", gfx_gat);
591 	PALETTE(config, "palette").set_entries(8);
592 
593 	/* sound hardware */
594 	SPEAKER(config, "mono").front_center();
595 	SN76489(config, "snsnd", MASTER_CLOCK/8).add_route(ALL_OUTPUTS, "mono", 2.00);   // Present in Bingo PCB. Clock need to be verified.
596 }
597 
598 
599 /*************************
600 *        Rom Load        *
601 *************************/
602 
603 ROM_START( poker41 )
604 	ROM_REGION( 0x10000, "maincpu", 0 )
605 	ROM_LOAD( "poker.u00",      0x0000, 0x2000, CRC(8361fccd) SHA1(4faae6bb3104c1f4a0939d613966085d7e34c1df))
606 	ROM_LOAD( "poker-4-1.u08",  0x2000, 0x1000, CRC(61e71f31) SHA1(b8d162a47752cff7412b3920ec9dd7a469e81e62) )
607 
608 	ROM_REGION( 0x3000, "gfx1", 0 )
609 	ROM_LOAD( "black.u33",      0x0000, 0x1000, CRC(3f8a2d59) SHA1(d61dce33aa8637105905830e2f37c1052c441194) )
610 	ROM_LOAD( "poker-g.u32",    0x1000, 0x1000, CRC(3e7772b2) SHA1(c7499ff148e5a9cbf0958820c41ea09a843ab355) )
611 	ROM_LOAD( "poker-r.u31",    0x2000, 0x1000, CRC(18d090ec) SHA1(3504f18b3984d16545dbe61a03fbf6b8e2027150) )
612 ROM_END
613 
614 ROM_START( pulltabs )
615 	ROM_REGION( 0x10000, "maincpu", 0 )
616 	ROM_LOAD( "pull-tabs-1-90.u00", 0x0000, 0x2000, CRC(7cfd490d) SHA1(8eb360f8f4806a4281dae12236d30aa86d00993d) )
617 
618 	ROM_REGION( 0x3000, "gfx1", 0 )
619 	ROM_LOAD( "pt-3b-v.u33",    0x0000, 0x1000, CRC(3505cec1) SHA1(98ab0383c4be382aea81ab93433f2f29a075f65d) )
620 	ROM_LOAD( "pt-2g-v.u32",    0x1000, 0x1000, CRC(4a3f4f36) SHA1(3dc29f78b7df1a433d0b39bfeaa227615e70ceed) )
621 	ROM_LOAD( "pt-1r-v.u31",    0x2000, 0x1000, CRC(6d1b80f4) SHA1(f2da4b4ae1eb05f9ea02e7495ee8110698cc5d1b) )
622 ROM_END
623 
624 ROM_START( bingo )
625 	ROM_REGION( 0x10000, "maincpu", 0 )
626 	ROM_LOAD( "revb.u2", 0x0000, 0x2000, CRC(0322e2b5) SHA1(e191ad00de56e448a41350e32fb6a4828050a2d4) )
627 
628 	ROM_REGION( 0x3000, "gfx1", 0 )
629 	ROM_LOAD( "revb.u23",    0x0000, 0x1000, CRC(8d15fc35) SHA1(e66abaead70e6c024efbf177f1a4616449f2d231) )
630 	ROM_LOAD( "revb.u22",    0x1000, 0x1000, CRC(60254c3b) SHA1(4b9e57a8ac9e6e2c6349d6847bbf3f46232721ad) )
631 	ROM_LOAD( "revb.u21",    0x2000, 0x1000, CRC(b8cc348b) SHA1(34a4690f6464db17ee363bba8709d0ad63aa7cf1) )
632 ROM_END
633 
634 
635 /*************************
636 *      Game Drivers      *
637 *************************/
638 
639 /*     YEAR  NAME      PARENT  MACHINE  INPUT     CLASS         INIT        ROT   COMPANY         FULLNAME              FLAGS  LAYOUT   */
640 GAMEL( 1983, poker41,  0,      gat,     poker41,  gatron_state, empty_init, ROT0, "Game-A-Tron",  "Four In One Poker",  MACHINE_SUPPORTS_SAVE,     layout_poker41  )
641 GAMEL( 1983, pulltabs, 0,      gat,     pulltabs, gatron_state, empty_init, ROT0, "Game-A-Tron",  "Pull Tabs",          MACHINE_SUPPORTS_SAVE,     layout_pulltabs )
642 GAMEL( 1983, bingo,    0,      gat,     bingo,    gatron_state, empty_init, ROT0, "Game-A-Tron",  "Bingo",              MACHINE_SUPPORTS_SAVE,     layout_bingo  )
643