summaryrefslogtreecommitdiffstats
path: root/src/mame/drivers/videopkr.cpp
blob: e01d639e4414693d8e12bc1f9b8748d6aa20c332 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
// license:BSD-3-Clause
// copyright-holders:Roberto Fresca, Grull Osgo
/*************************************************************************

  VIDEO POKER - IGT/INTERFLIP
  ---------------------------

  Original driver by Grull Osgo.
  Rewrite and additional work by Roberto Fresca.
  Fortune I (IGT) added by Jim Stolis.


  Games running on this hardware:

  * Draw Poker,          1984, IGT - International Game Technology

  * Video Poker,         1984, InterFlip.
  * Black Jack,          1984, InterFlip.
  * Video Dado,          1987, InterFlip.
  * Video Cordoba,       1987, InterFlip.

  * Baby Poker,          1989, Recreativos Franco.
  * Baby Dado,           1989, Recreativos Franco.

  * Video Poker (v1403), 198?, Recreativos Franco?.


***************************************************************************

  History:
  ========

  In 1975, Si Redd founded A1-Supply.  This was renamed to Sircoma in 1978,
  and eventually IGT (International Game Technology) in 1981.

  Along the way, in 1978, Fortune Coin Company was acquired and contained
  the basis to their Fortune I game machines.

  The Fortune I hardware consisted of the following games:
    Regular Draw Poker
    Progressive Draw Poker
    Joker Wild Poker
    Double Up Draw Poker
    Credit Draw Poker
    Lucky 7 Poker (Seven Card Stud Poker)
    Twenty One
    Live 21
    Count Down 21
    Two Hand 21
    In Between
    Regular Slot
    Credit Slot

  InterFlip (Spain), is a subsidiary of Recreativos Franco.
  This company was created mainly with the purpose of manufacture
  and distribute export-class games.

  These machines were build in upright wood style cabinets, and compliment
  with class "C" (for casinos) spanish gaming regulations.


***************************************************************************

  Hardware Info
  =============

  This is a two board system: Main & Sound board.

  * Main board:

  1x Intel 8039 CPU               Clocked @ 6/8 MHz.
  2x 2716 EPROM                   Program ROM.
  2x 2716 EPROM                   Character/graphics ROM.
  1x 5101 (256 x 4) SRAM          Data Memory (Battery Backed RAM).
  2x 2114 (1024 x 4) SRAM         8-Bit Char. RAM.
  1x 2114 (1024 x 4) SRAM         4-Bit Color RAM.
  1x 74s287 (256 x 4) TTL PROM    Color PROM.

  1x 6 MHz.(or 8 MHz.) Crystal    CPU clock.
  1x 7.8643 MHz. Crystal          Video System.

  1x 3.6 Ni-Cd Battery            Data Memory.

  TTL type Raster video           Configurable HIGH-LOW resolution through hardware jumper.
                                  Configurable 50Hz-60Hz V-Sync through hardware jumper.

  I/O System                      Buffered, latched & optocoupled.


  * Sound board:

  1x Intel 8039 CPU               Clocked @ 8 MHz.
  2x 2716 EPROM                   Program ROM.
  1x 1408 DAC
  1x 8.0000 MHz. Crystal


********************************************************************************

  Main CPU Memory Map
  ===================

  0x0000 - 0x0FFF         Program ROM.

  Data & Video RAM are mapped through I/O hardware implementations due to
  I8039 memory addressing restrictions.


  Main CPU I/0 Map
  ================

  P1.0          ; Used at bit level, Aux_0 signal.
  P1.1          ; Used at bit level, Aux_1 signal.
  P1.2          ; Used at bit level, Aux_2 signal.
  P1.3          ; Used at bit level, Aux_3 signal.
  P1.4          ; Used at bit level, Aux_4 signal & Sound Latch bit 3
  P1.5          ; Used at bit level, Aux_5 signal & Sound Latch bit 0
  P1.6          ; Expands address bus for video and color RAM access (V.A8)
  P1.7          ; Expands address bus for video and color RAM access (V.A9)

  P2.0 - P2.3:  ; I8039 as address bus expansion (Program memory - High address nibble).

  P2.4:         ; Reads 8 bits from data buffer input port (interface for switch encoder).
                      Bit 0: Lamp_1.
                      Bit 1: Lamp_2.
                      Bit 2: Lamp_3.
                      Bit 3: Lamp_4.
                      Bit 4: Coin Acceptor.
                      Bit 5: Hopper 1 & Sound Latch bit 1.
                      Bit 6: Hopper 2 & Sound Latch bit 2.
                      Bit 7: Diverter.

                ; Writes 8 bits to data latch out port (lamps, relays and coils).
                      Bit 0: SW_encoder_0.
                      Bit 1: SW_encoder_1.
                      Bit 2: SW_encoder_2.
                      Bit 3: SW_encoder_3.
                      Bit 4: Coin Out.
                      Bit 5: Undocumented jumper.
                      Bit 6: N/U (pulled up).
                      Bit 7: N/U (pulled up).

  P2.5:         ; Enable access to data RAM.
  P2.6:         ; Enable access to video RAM (write mode) - no read mode.
  P2.7:         ; Enable access to color RAM (write Mode) - no read mode.


********************************************************************************

  Game Info
  =========

  Pay Tables:

  These machines had their pay tables out of screen, in a backlighted upper front panel.


                      Video Poker (Spanish text only)
  ----------------------------------------------------------------------------
  Fichas Jugadas       1 Ficha    2 Fichas    3 Fichas    4 Fichas    5 Fichas
  ----------------------------------------------------------------------------
  Escalera Maxima         250        500         750        1000        4000
  de color

  Escalera de Color       100        200         300         400         500

  Poker                    50        100         150         200         250

  Full                     11         22          33          44          55

  Color                     7         14          21          28          35

  Escalera                  5         10          15          20          25

  Trio                      3          6           9          12          15

  Doble Pareja              2          4           6           8          10
  ----------------------------------------------------------------------------


                      Black Jack (Spanish text only)
  ----------------------------------------------------------------------------
  Fichas Jugadas       1 Ficha    2 Fichas    3 Fichas    4 Fichas    5 Fichas
  ----------------------------------------------------------------------------
  Empate                   1          2           3           4            5

  La Banca se pasa         2          4           6           8           10

  Jugador tiene mas        2          4           6           8           10
  que la banca

  Jugador tiene menos      2          4           6           8           10
  de 22 con 6 cartas

  Jugador tiene blackjack  2          5           7          10           12
  y la Banca no
  ----------------------------------------------------------------------------


                              Video Cordoba
  ----------------------------------------------------------------------------
  Fichas Jugadas       1 Ficha    2 Fichas    3 Fichas    4 Fichas    5 Fichas
  ----------------------------------------------------------------------------
  TRIPLE BAR             250         250         250         250        2000
  ............................................................................
  3 x Doble Bar        - 100            |    Olive-Olive-Any Bar        - 18
  3 x Single Bar       -  50            |    3 x Orange                 - 14
  3 x Any Bar          -  20            |    Orange-Orange-Any Bar      - 14
  3 x Bell             -  20            |    3 x Cherry                 - 10
  Bell-Bell-Any Bar    -  20            |    2 x Cherry                 -  5
  3 x Olive            -  10            |    1 x Cherry                 -  2
  ............................................................................
  All combinations are valid only from left to rigth
  ----------------------------------------------------------------------------


                   Video Dado
  ---------------------------------------------
  Twelve      (12)                    33 x 1
  Eleven      (11)                    16 x 1
  Crap        (2,3,12)                 8 x 1
  Seven       (7)                      5 x 1
  Field       (2,12)                   3 x 1
  8 or More   (8,9,10,11,12)           2 x 1
  6 or Less   (2,3,4,5,6)              2 x 1

  Winnings less or equal to 25 can be re-played
  ---------------------------------------------


  All payments with less than 400 coins are done through hopper.
  (you need to press "Coin Out" button once per coin due to the lack of hopper emulation)

  Payments over 400 coins are manual.


**************************************************************************

  [2008-10-08]

  - Added Baby Poker Game.
  - Added Baby Dado Game.
  - Mapped "Hand Pay" button for Baby Games.
  - Added decoder to Jackpot mechanical counter.
  - Added sound support to Baby Poker Game.
  - Added tower lamps to Baby Games layouts.
  - Reworked layouts for Baby Games.
  - Reworked the color routines.
  - Added new color routines for Baby Games.
  - Redumped the videocba color PROM.
  - Added color switch. (It changes background color in some games).
  - Added "hopper full" switch support (for diverter function).
  - Added diverter function decoder.
  - Added Button-lamps layout.
  - Added full functional mechanical counters decoding.
  - Added 7 Segment decoder and 7 Digit Counter functions.
  - Added button-lamps layout & mechanical counters simulation on layout.
     Mechanical counters to layout: Coin-In, Coin-Out and Coin to Drop.
  - Added NVRAM support to mechanical counters.


  TO DO
  =====

  * Add Tech. Notes for Baby board, a reworked and improved version on Video Poker hardware.
  * Fix some missing pulses on mechanical counters.
  * Fix the bug on bookeeping mode (videodad & videocba).
  * Figure out the undocumented jumper.
  * Hopper simulation.
  * Switch to resnet system.


**************************************************************************/


#include "emu.h"

#include "cpu/mcs48/mcs48.h"
#include "cpu/mcs51/mcs51.h"
#include "machine/i8255.h"
#include "machine/nvram.h"
#include "machine/timer.h"
#include "sound/ay8910.h"
#include "sound/dac.h"
#include "sound/volt_reg.h"

#include "screen.h"
#include "speaker.h"

#include "babydad.lh"
#include "babypkr.lh"
#include "blckjack.lh"
#include "videocba.lh"
#include "videodad.lh"
#include "videopkr.lh"


#define CPU_CLOCK       (XTAL(6'000'000))         /* main cpu clock */
#define CPU_CLOCK_ALT   (XTAL(8'000'000))         /* alternative main cpu clock for newer games */
#define SOUND_CLOCK     (XTAL(8'000'000))         /* sound cpu clock */
#define VIDEO_CLOCK     (XTAL_7.8643MHz)


class videopkr_state : public driver_device
{
public:
	videopkr_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag)
		, m_maincpu(*this, "maincpu")
		, m_soundcpu(*this, "soundcpu")
		, m_dac(*this, "dac")
		, m_gfxdecode(*this, "gfxdecode")
		, m_digits(*this, "digit%u", 0U)
		, m_lamp(*this, "lamp%u", 0U)
		{ }

	DECLARE_READ8_MEMBER(videopkr_io_r);
	DECLARE_WRITE8_MEMBER(videopkr_io_w);
	DECLARE_READ8_MEMBER(videopkr_p1_data_r);
	DECLARE_READ8_MEMBER(videopkr_p2_data_r);
	DECLARE_WRITE8_MEMBER(videopkr_p1_data_w);
	DECLARE_WRITE8_MEMBER(videopkr_p2_data_w);
	DECLARE_READ_LINE_MEMBER(videopkr_t0_latch);
	DECLARE_WRITE_LINE_MEMBER(prog_w);
	DECLARE_READ8_MEMBER(sound_io_r);
	DECLARE_WRITE8_MEMBER(sound_io_w);
	DECLARE_READ8_MEMBER(sound_p2_r);
	DECLARE_WRITE8_MEMBER(sound_p2_w);
	DECLARE_READ8_MEMBER(baby_sound_p0_r);
	DECLARE_WRITE8_MEMBER(baby_sound_p0_w);
	DECLARE_READ8_MEMBER(baby_sound_p1_r);
	DECLARE_WRITE8_MEMBER(baby_sound_p1_w);
	DECLARE_READ8_MEMBER(baby_sound_p2_r);
	DECLARE_WRITE8_MEMBER(baby_sound_p2_w);
	DECLARE_READ8_MEMBER(baby_sound_p3_r);
	DECLARE_WRITE8_MEMBER(baby_sound_p3_w);
	TILE_GET_INFO_MEMBER(get_bg_tile_info);
	DECLARE_PALETTE_INIT(videopkr);
	DECLARE_VIDEO_START(vidadcba);
	DECLARE_PALETTE_INIT(babypkr);
	DECLARE_PALETTE_INIT(fortune1);
	uint32_t screen_update_videopkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	TIMER_DEVICE_CALLBACK_MEMBER(sound_t1_callback);
	void count_7dig(unsigned long data, uint8_t index);
	void babypkr(machine_config &config);
	void videodad(machine_config &config);
	void videopkr(machine_config &config);
	void fortune1(machine_config &config);
	void blckjack(machine_config &config);
	void bpoker(machine_config &config);
	void i8039_io_port(address_map &map);
	void i8039_map(address_map &map);
	void i8039_sound_mem(address_map &map);
	void i8039_sound_port(address_map &map);
	void i8051_sound_mem(address_map &map);
	void i8051_sound_port(address_map &map);
	void i8751_io_port(address_map &map);
	void i8751_map(address_map &map);

protected:
	virtual void machine_start() override;
	virtual void video_start() override;

	uint8_t m_data_ram[0x100];
	uint8_t m_video_ram[0x0400];
	uint8_t m_color_ram[0x0400];
	uint16_t m_p1;
	uint16_t m_p2;
	uint8_t m_t0_latch;
	uint16_t m_n_offs;
	uint8_t m_vp_sound_p2;
	uint8_t m_p24_data;
	uint8_t m_sound_latch;
	uint8_t m_baby_latch;
	uint8_t m_sound_ant;
	uint8_t m_dc_4020;
	uint8_t m_dc_40103;
	uint8_t m_te_40103;
	uint8_t m_ld_40103;
	uint8_t m_ant_jckp;
	uint8_t m_jckp;
	uint8_t m_ant_cio;
	uint8_t m_c_io;
	uint8_t m_hp_1;
	uint8_t m_hp_2;
	uint8_t m_bell;
	uint8_t m_aux3;
	uint8_t m_dvrt;
	unsigned long m_count0;
	unsigned long m_count1;
	unsigned long m_count2;
	unsigned long m_count3;
	unsigned long m_count4;
	uint8_t m_sbp0;
	uint8_t m_sbp2;
	uint8_t m_sbp3;
	tilemap_t *m_bg_tilemap;
	required_device<cpu_device> m_maincpu;
	required_device<cpu_device> m_soundcpu;
	required_device<dac_byte_interface> m_dac;
	required_device<gfxdecode_device> m_gfxdecode;
	output_finder<28> m_digits;
	output_finder<14> m_lamp;
};


#define DATA_NVRAM_SIZE     0x100

/*************************
*     Video Hardware     *
*************************/

/* BCD to Seven Segment Decoder */
static uint8_t dec_7seg(int data)
{
	uint8_t segment;
	switch (data)
	{
		case 0: segment = 0x3f; break;
		case 1: segment = 0x06; break;
		case 2: segment = 0x5b; break;
		case 3: segment = 0x4f; break;
		case 4: segment = 0x66; break;
		case 5: segment = 0x6d; break;
		case 6: segment = 0x7d; break;
		case 7: segment = 0x07; break;
		case 8: segment = 0x7f; break;
		case 9: segment = 0x6f; break;
		default: segment = 0x79;
	}

	return segment;
}

/* Display a seven digit counter on layout - Index points to less significant digit*/
void videopkr_state::count_7dig(unsigned long data, uint8_t index)
{
	uint8_t i;
	char strn[8];
	sprintf(strn,"%7lu",data);

	for (i = 0; i < 7; i++)
	{
		m_digits[index+i] = dec_7seg((strn[6 - i] | 0x10) - 0x30);
	}
}

PALETTE_INIT_MEMBER(videopkr_state, videopkr)
{
	const uint8_t *color_prom = memregion("proms")->base();
	int j;

	for (j = 0; j < palette.entries(); j++)
	{
		int r, g, b, tr, tg, tb, i;

		i = (color_prom[j] >> 3) & 0x01;

		/* red component */
		tr = 0xf0 - (0xf0 * ((color_prom[j] >> 0) & 0x01));
		r = tr - (i * (tr / 5));

		/* green component */
		tg = 0xf0 - (0xf0 * ((color_prom[j] >> 1) & 0x01));
		g = tg - (i * (tg / 5));

		/* blue component */
		tb = 0xf0 - (0xf0 * ((color_prom[j] >> 2) & 0x01));
		b = tb - (i * (tb / 5));

		palette.set_pen_color(j, rgb_t(r, g, b));
	}
}

PALETTE_INIT_MEMBER(videopkr_state,babypkr)
{
	const uint8_t *color_prom = memregion("proms")->base();
	int j;

	for (j = 0; j < palette.entries(); j++)
	{
		int r, g, b, tr, tg, tb, i, top;

		top = 0xff;

		/* intense component */
		i = 0x2f * ((color_prom[j] >> 3) & 0x01);
		top = top - i;

		/* red component */
		tr =  0xdf * ((color_prom[j] >> 0) & 0x01);
		r = top - ((tr * top) / 0x100 );

		/* green component */
		tg =  0xdf * ((color_prom[j] >> 1) & 0x01);
		g = top - ((tg * top) / 0x100 );

		/* blue component */
		tb =  0xdf * ((color_prom[j] >> 2) & 0x01);
		b = top - ((tb * top) / 0x100);

		palette.set_pen_color(j, rgb_t(r, g, b));
	}
}

PALETTE_INIT_MEMBER(videopkr_state,fortune1)
{
	const uint8_t *color_prom = memregion("proms")->base();
	int j;

	for (j = 0; j < palette.entries(); j++)
	{
		int r, g, b, tr, tg, tb, i, c;

		i = (color_prom[j] >> 3) & 0x01;

		/* red component */
		tr = 0xf0 - (0xf0 * ((color_prom[j] >> 0) & 0x01));
		r = tr - (i * (tr / 5));

		/* green component */
		tg = 0xf0 - (0xf0 * ((color_prom[j] >> 1) & 0x01));
		g = tg - (i * (tg / 5));

		/* blue component */
		tb = 0xf0 - (0xf0 * ((color_prom[j] >> 2) & 0x01));
		b = tb - (i * (tb / 5));

		c = j;

		// Swap Position of Inner-most Colors on Each 4 Color Palette
		if ((c % 4) == 1 || (c % 4) == 2)
			c = ((int)(c / 4) * 4) + (3 - (c % 4));

		palette.set_pen_color(c, rgb_t(r, g, b));
	}
}

TILE_GET_INFO_MEMBER(videopkr_state::get_bg_tile_info)
{
	int offs = tile_index;
	int attr = m_color_ram[offs] + ioport("IN2")->read(); /* Color Switch Action */
	int code = m_video_ram[offs];
	int color = attr;
	SET_TILE_INFO_MEMBER(0, code, color, 0);
}


void videopkr_state::video_start()
{
	m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(videopkr_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
}

VIDEO_START_MEMBER(videopkr_state,vidadcba)
{
	m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(videopkr_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 8, 32, 32);
}


uint32_t videopkr_state::screen_update_videopkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	m_bg_tilemap->mark_all_dirty();
	m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
	return 0;
}


/*************************
*      R/W Handlers      *
*************************/

READ8_MEMBER(videopkr_state::videopkr_io_r)
{
	uint8_t valor = 0, hf, co;

	uint16_t kbdin;

	switch (m_p2)
	{
		case 0xef:  /* inputs are multiplexed through a diode matrix */
		{
			hf = ((ioport("IN1")->read() & 0x10 ) >> 4) & 1;            /* Hopper full detection */
			co = 0x10 * ((ioport("IN1")->read() & 0x20 ) >> 5);     /* Coin Out detection */
			kbdin = ((ioport("IN1")->read() & 0xaf ) << 8) + ioport("IN0")->read();

			switch (kbdin)
			{
				case 0x0000: valor = 0x00; break;
				case 0x0001: valor = 0x01; break;   /* Door */
				case 0x4000: valor = 0x02; break;
				case 0x8000: valor = 0x03; break;   /* Hand Pay */
				case 0x0002: valor = 0x04; break;   /* Books */
				case 0x0004: valor = 0x05; break;   /* Coin In */
				case 0x0008: valor = 0x07; break;   /* Start */
				case 0x0010: valor = 0x08; break;   /* Discard */
				case 0x0020: valor = 0x09; break;   /* Cancel */
				case 0x0040: valor = 0x0a; break;   /* Hold 1 */
				case 0x0080: valor = 0x0b; break;   /* Hold 2 */
				case 0x0100: valor = 0x0c; break;   /* Hold 3 */
				case 0x0200: valor = 0x0d; break;   /* Hold 4 */
				case 0x0400: valor = 0x0e; break;   /* Hold 5 */
				case 0x0800: valor = 0x06; break;   /* Bet */
			}

			if ((valor == 0x00) & hf )
			{
				valor = 0x0f;
			}

			valor += co;
			break;
		}

		case 0xdf:
		{
			m_n_offs = ((m_p1 & 0xc0) << 2 ) + offset;
			valor = m_data_ram[offset];
			break;
		}

		case 0x5f:
		{
			m_n_offs = ((m_p1 & 0xc0) << 2 ) + offset;
			valor = m_data_ram[offset];
			break;
		}

		case 0x7c:
		case 0x7d:
		case 0x7e:
		case 0x7f:
		{
			m_n_offs = ((m_p1 & 0xc0) << 2 ) + offset;
			valor = m_color_ram[m_n_offs];
			break;
		}

		case 0xbc:
		case 0xbd:
		case 0xbe:
		case 0xbf:
		{
			m_n_offs = ((m_p1 & 0xc0) << 2 ) + offset;
			valor = m_video_ram[m_n_offs];
			break;
		}
	}

	return valor;
}

WRITE8_MEMBER(videopkr_state::videopkr_io_w)
{
	switch (m_p2)
	{
		case 0x3c:
		case 0x3d:
		case 0x3e:
		case 0x3f:
		{
			m_n_offs = ((m_p1 & 0xc0) << 2 ) + offset;
			m_color_ram[m_n_offs] = data & 0x0f;
			m_video_ram[m_n_offs] = data;
			m_bg_tilemap->mark_tile_dirty(m_n_offs);
			break;
		}

		case 0xdf:
		{
			m_data_ram[offset] = (data & 0x0f) + 0xf0;
			break;
		}

		case 0x7c:
		case 0x7d:
		case 0x7e:
		case 0x7f:
		{
			m_n_offs = ((m_p1 & 0xc0) << 2 ) + offset;
			m_color_ram[m_n_offs] = data & 0x0f;
			m_bg_tilemap->mark_tile_dirty(m_n_offs);
			break;
		}

		case 0xbc:
		case 0xbd:
		case 0xbe:
		case 0xbf:
		{
			m_n_offs = ((m_p1 & 0xc0) << 2 ) + offset;
			m_video_ram[m_n_offs] = data;
			m_bg_tilemap->mark_tile_dirty(m_n_offs);
			break;
		}

		case 0xef:  /* Port 2.4 */
		{
			m_lamp[0] = BIT(data, 0);    /* L_1 */
			m_lamp[1] = BIT(data, 1);    /* L_2 */
			m_lamp[2] = BIT(data, 2);    /* L_3 */
			m_lamp[3] = BIT(data, 3);    /* L_4 */
			m_lamp[4] = BIT(data, 4);    /* Coin */
			m_lamp[5] = BIT(data, 5);    /* Hopper_1 */
			m_lamp[6] = BIT(data, 6);    /* Hopper_2 */
			m_lamp[7] = BIT(data, 7);    /* Diverter */
			m_p24_data = data;
			m_hp_1 = (~m_p24_data >> 6) & 1;
			m_hp_2 = (~m_p24_data >> 5) & 1;
			m_dvrt = (~m_p24_data >> 7) & 1;
			break;
		}

		case 0xff:
		{
			m_t0_latch = m_t0_latch ^ 0x01;     /* fix the bookkeeping mode */
			break;
		}
	}
}

READ8_MEMBER(videopkr_state::videopkr_p1_data_r)
{
	return m_p1;
}

READ8_MEMBER(videopkr_state::videopkr_p2_data_r)
{
	return m_p2;
}

WRITE8_MEMBER(videopkr_state::videopkr_p1_data_w)
{
	m_p1 = data;

	m_lamp[8] = BIT(data, 0);    /* Aux_0 - Jackpot mech. counter (Baby Games)*/
	m_lamp[9] = BIT(data, 1);    /* Aux_1 - */
	m_lamp[10] = BIT(data, 2);   /* Aux_2 - */
	m_lamp[11] = BIT(data, 3);   /* Aux_3 - */
	m_lamp[12] = BIT(data, 4);   /* Aux_4 - Bell */
	m_lamp[13] = BIT(data, 5);   /* Aux_5 - /CIO */

	m_jckp = m_p1 & 1;

	if ((~m_c_io & 1) & m_ant_cio & m_hp_1 & m_hp_2)
	{
		++m_count1; /* Decoded Coin In Mech. Counter*/
	}

	if ((~m_c_io & 1) & m_ant_cio & (~m_hp_1 & 1) & (~m_hp_2 & 1))
	{
		++m_count2; /* Decoded Coind Out Mech. Counter */
	}

	if (~m_c_io & m_ant_cio & m_hp_1 & m_hp_2 & ~m_dvrt)
	{
		++m_count3; /* Decoded Coin to Drop Mech. Counter */
	}

	if (~m_jckp & m_ant_jckp)
	{
		++m_count4; /* Decoded Jackpot Mech. Counter */
	}

	count_7dig(m_count1, 0);
	count_7dig(m_count2, 7);
	count_7dig(m_count3, 14);
	count_7dig(m_count4, 21);

	m_ant_cio = m_c_io;
	m_ant_jckp = m_jckp;
}

WRITE8_MEMBER(videopkr_state::videopkr_p2_data_w)
{
	m_p2 = data;
}

READ_LINE_MEMBER(videopkr_state::videopkr_t0_latch)
{
	return m_t0_latch;
}

WRITE_LINE_MEMBER(videopkr_state::prog_w)
{
	if (!state)
		m_maincpu->set_input_line(0, CLEAR_LINE);   /* clear interrupt FF */
}

/*************************
*     Sound Handlers     *
*************************/
/*

  Sound Data ( Sound Board latch )

    Data Bit     Comes from
    ---------------------------------------------
    bit 0        Coin I/O     Port 1.5
    bit 1        Hopper2      Port 2.4 Data Bit 6
    bit 2        Hopper1      Port 2.4 Data Bit 5
    bit 3        Bell         Port 1.4
    bit 4        Aux_3        Port 1.3
    bit 5        N/U          Pulled Up
    bit 6        N/U          Pulled Up
    bit 7        N/U          Pulled Up


  Sound Codes

    Hex     Bin         Sound                       Game
    --------------------------------------------------------------------------
    0xFF    11111111    No Sound (default state)    All Games.
    0xFE    11111110    Coin In sound               All Games.
    0xEF    11101111    Cards draw sound            Video Poker & Black Jack.
    0xF9    11111001    Hopper run                  Video Poker & Black Jack.
    0xF8    11111000    Coin Out sound              Video Poker & Black Jack.
    0xF6    11110110    Coin Out sound              Video Dado  & Video Cordoba.
    0xFA    11111010    Dice rolling sound          Video Dado.
    0xFA    11111010    Spinning reels sound        Video Cordoba.
    0xFB    11111011    Dice rolling sound          Video Dado.
    0xFB    11111011    Stopping reels sound        Video Cordoba.

*/

READ8_MEMBER(videopkr_state::sound_io_r)
{
	switch (m_vp_sound_p2)
	{
		case 0xbf:
		{
			m_c_io = (m_p1 >> 5) & 1;
			m_hp_1 = (~m_p24_data >> 6) & 1;
			m_hp_2 = (~m_p24_data >> 5) & 1;
			m_bell = (m_p1 >> 4) & 1;
			m_aux3 = (m_p1 >> 3) & 1;
			m_dvrt = (~m_p24_data >> 7) & 1;
			m_sound_ant = m_sound_latch;
			m_sound_latch = m_c_io + (m_hp_1 << 1) + (m_hp_2 << 2) + (m_bell << 3) + 0xf0;

			break;
		}
	}

	return m_sound_latch;
}

WRITE8_MEMBER(videopkr_state::sound_io_w)
{
	if (m_vp_sound_p2 == 0x5f || m_vp_sound_p2 == 0xdf)
	{
		m_dc_40103 = data;
		m_dc_4020 = 0;
	}
}

READ8_MEMBER(videopkr_state::sound_p2_r)
{
	return m_vp_sound_p2;
}

WRITE8_MEMBER(videopkr_state::sound_p2_w)
{
	m_vp_sound_p2 = data;

	switch (data)
	{
		case 0x5f:
		{
			m_te_40103 = 0; /* p2.7 LOW */
			m_ld_40103 = 0; /* p2.5 LOW */
			break;
		}

		case 0x7f:
		{
			m_te_40103 = 0;
			m_ld_40103 = 1;
			break;
		}

		case 0xff:
		{
			m_te_40103 = 1;
			m_ld_40103 = 1;
			break;
		}
	}
}


/* Baby Sound Handlers */

READ8_MEMBER(videopkr_state::baby_sound_p0_r)
{
	return m_sbp0;
}

WRITE8_MEMBER(videopkr_state::baby_sound_p0_w)
{
	m_sbp0 = data;
}

READ8_MEMBER(videopkr_state::baby_sound_p1_r)
{
	m_c_io = (m_p1 >> 5) & 1;
	m_hp_1 = (~m_p24_data >> 6) & 1;
	m_hp_2 = (~m_p24_data >> 5) & 1;
	m_bell = (m_p1 >> 4) & 1;
	m_aux3 = (m_p1 >> 3) & 1;
	m_baby_latch = m_c_io + (m_hp_1 << 1) + (m_hp_2 << 2) + (m_bell << 3) + (m_aux3 << 4) + 0xe0;
	return m_baby_latch;
}

WRITE8_MEMBER(videopkr_state::baby_sound_p1_w)
{
	m_baby_latch = m_baby_latch | data;
}

READ8_MEMBER(videopkr_state::baby_sound_p2_r)
{
	return m_sbp2;
}

WRITE8_MEMBER(videopkr_state::baby_sound_p2_w)
{
	m_sbp2 = data;
	m_dac->write(data);
}

READ8_MEMBER(videopkr_state::baby_sound_p3_r)
{
	return m_sbp3;
}

WRITE8_MEMBER(videopkr_state::baby_sound_p3_w)
{
	ay8910_device *ay8910 = machine().device<ay8910_device>("aysnd");
	uint8_t lmp_ports, ay_intf;
	m_sbp3 = data;
	lmp_ports = m_sbp3 >> 1 & 0x07;

	output().set_value("TOP_1", (lmp_ports >> 0) & 1);
	output().set_value("TOP_2", (lmp_ports >> 1) & 1);
	output().set_value("TOP_3", (lmp_ports >> 2) & 1);

	if (!(m_sbp3 & 0x10))
	{
		reset();
		logerror("AY3-8910: Reset\n");
	}

	ay_intf = (m_sbp3 >> 5) & 0x07;

	switch (ay_intf)
	{
		case 0x00:  break;
		case 0x01:  break;
		case 0x02:  break;
		case 0x03:  ay8910->data_w(space, 1, m_sbp0); break;
		case 0x04:  break;
		case 0x05:  m_sbp0 = ay8910->data_r(space, m_sbp0); break;
		case 0x06:  break;
		case 0x07:  ay8910->address_w(space, 0, m_sbp0); break;
	}
}


TIMER_DEVICE_CALLBACK_MEMBER(videopkr_state::sound_t1_callback)
{
	if (m_te_40103 == 1)
	{
		m_dc_40103++;

		if (m_dc_40103 == 0)
		{
			m_soundcpu->set_input_line(0, ASSERT_LINE);
		}
	}
}

/*************************
* Memory Map Information *
*************************/

void videopkr_state::i8039_map(address_map &map)
{
	map(0x0000, 0x0fff).rom();
}

void videopkr_state::i8039_io_port(address_map &map)
{
	map(0x00, 0xff).rw(this, FUNC(videopkr_state::videopkr_io_r), FUNC(videopkr_state::videopkr_io_w));
}

void videopkr_state::i8751_map(address_map &map)
{
	map(0x0000, 0x7fff).rom();
}

void videopkr_state::i8751_io_port(address_map &map)
{
	map(0x0000, 0x0fff).ram(); // NVRAM?
	map(0x8000, 0x8000).noprw(); // ???
	map(0x9000, 0x9000).writeonly(); // ???
	map(0xa000, 0xbfff).ram(); // video RAM?
	map(0xc000, 0xc003).rw("ppi", FUNC(i8255_device::read), FUNC(i8255_device::write));
	map(0xf000, 0xf000).writeonly(); // ???
}

void videopkr_state::i8039_sound_mem(address_map &map)
{
	map(0x0000, 0x0fff).rom();
}

void videopkr_state::i8039_sound_port(address_map &map)
{
	map(0x00, 0xff).rw(this, FUNC(videopkr_state::sound_io_r), FUNC(videopkr_state::sound_io_w));
}


void videopkr_state::i8051_sound_mem(address_map &map)
{
	map(0x0000, 0x0fff).rom();
}

void videopkr_state::i8051_sound_port(address_map &map)
{
	map(0x0000, 0x1ff).ram();
}


/************************
*      Input Ports      *
************************/

static INPUT_PORTS_START( videopkr )
	PORT_START("IN0")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_GAMBLE_DOOR )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_BOOK ) PORT_NAME("Books")
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2)
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start")
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Discard") PORT_CODE(KEYCODE_2)
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_POKER_CANCEL )
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_POKER_HOLD1 )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_POKER_HOLD2 )

	PORT_START("IN1")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_POKER_HOLD3 )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_POKER_HOLD4 )
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_POKER_HOLD5 )
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hopper") PORT_TOGGLE PORT_CODE(KEYCODE_H)
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT)
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )

	PORT_START("IN2")
	PORT_DIPNAME( 0x20, 0x00, "Color Sw." )     PORT_DIPLOCATION("SW1:1")
	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
	PORT_DIPSETTING(    0x00, DEF_STR( On  ) )

INPUT_PORTS_END

static INPUT_PORTS_START( blckjack )
	PORT_START("IN0")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_GAMBLE_DOOR )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_BOOK ) PORT_NAME("Books")
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2)
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start")
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Hit") PORT_CODE(KEYCODE_Z)
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Stand") PORT_CODE(KEYCODE_X)
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Double") PORT_CODE(KEYCODE_C)

	PORT_START("IN1")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hopper") PORT_TOGGLE PORT_CODE(KEYCODE_H)
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT)
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )

	PORT_START("IN2")
	PORT_DIPNAME( 0x20, 0x00, "Color Sw." )     PORT_DIPLOCATION("SW1:1")
	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
	PORT_DIPSETTING(    0x00, DEF_STR( On  ) )
INPUT_PORTS_END

static INPUT_PORTS_START( videodad )
	PORT_START("IN0")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_GAMBLE_DOOR )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_BOOK ) PORT_NAME("Books")
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2)
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_GAMBLE_TAKE )
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Crap") PORT_CODE(KEYCODE_3)
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("6 or Less") PORT_CODE(KEYCODE_Z)
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Seven") PORT_CODE(KEYCODE_X)
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("8 or More") PORT_CODE(KEYCODE_C)

	PORT_START("IN1")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Field") PORT_CODE(KEYCODE_S)
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Eleven") PORT_CODE(KEYCODE_V)
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Twelve") PORT_CODE(KEYCODE_B)
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hopper") PORT_TOGGLE PORT_CODE(KEYCODE_H)
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT)
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )

	PORT_START("IN2")
	PORT_DIPNAME( 0x20, 0x00, "Color Sw." )     PORT_DIPLOCATION("SW1:1")
	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
	PORT_DIPSETTING(    0x00, DEF_STR( On  ) )
INPUT_PORTS_END

static INPUT_PORTS_START( videocba )
	PORT_START("IN0")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_GAMBLE_DOOR )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_BOOK ) PORT_NAME("Books")
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2)
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start")
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )

	PORT_START("IN1")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hopper") PORT_TOGGLE PORT_CODE(KEYCODE_H)
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT) PORT_NAME("Payout") PORT_CODE(KEYCODE_M)
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )

	PORT_START("IN2")
	PORT_DIPNAME( 0x20, 0x00, "Color Sw." )     PORT_DIPLOCATION("SW1:1")
	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
	PORT_DIPSETTING(    0x00, DEF_STR( On  ) )
INPUT_PORTS_END


static INPUT_PORTS_START( babypkr )
	PORT_START("IN0")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_GAMBLE_DOOR )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_BOOK ) PORT_NAME("Books")
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2)
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Start")
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_GAMBLE_D_UP ) PORT_NAME("Double / Discard") PORT_CODE(KEYCODE_3)
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_POKER_CANCEL ) PORT_NAME("Cancel / Take")
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_POKER_HOLD1 )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_POKER_HOLD2 )

	PORT_START("IN1")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_POKER_HOLD3 )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_POKER_HOLD4 )
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_POKER_HOLD5 )
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_GAMBLE_BET )
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hopper") PORT_TOGGLE PORT_CODE(KEYCODE_H)
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT)
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED  )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hand Pay") PORT_CODE(KEYCODE_W)

	PORT_START("IN2")
	PORT_DIPNAME( 0x20, 0x00, "Color Sw." )     PORT_DIPLOCATION("SW1:1")
	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
	PORT_DIPSETTING(    0x00, DEF_STR( On  ) )

INPUT_PORTS_END

static INPUT_PORTS_START( babydad )
	PORT_START("IN0")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_GAMBLE_DOOR )
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_GAMBLE_BOOK ) PORT_NAME("Books")
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2)
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_GAMBLE_TAKE )
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Crap") PORT_CODE(KEYCODE_3)
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("6 or Less") PORT_CODE(KEYCODE_N)
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Seven") PORT_CODE(KEYCODE_Z)
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("8 or More") PORT_CODE(KEYCODE_X)

	PORT_START("IN1")
	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Field")  PORT_CODE(KEYCODE_C)
	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Eleven") PORT_CODE(KEYCODE_V)
	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_NAME("Twelve") PORT_CODE(KEYCODE_B)
	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_GAMBLE_BET )
	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hopper") PORT_TOGGLE PORT_CODE(KEYCODE_H)
	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_GAMBLE_PAYOUT)
	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED  )
	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hand Pay") PORT_CODE(KEYCODE_W)

	PORT_START("IN2")
	PORT_DIPNAME( 0x20, 0x00, "Color Sw." )     PORT_DIPLOCATION("SW1:1")
	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
	PORT_DIPSETTING(    0x00, DEF_STR( On  ) )

INPUT_PORTS_END


/*************************
*    Graphics Layouts    *
*************************/

static const gfx_layout tilelayout_16 =
{
	16, 8,
	RGN_FRAC(1,4),
	2,
	{ 0, RGN_FRAC(1,2) },
	{ 0, 1, 2, 3, 4, 5, 6, 7,
		RGN_FRAC(1,4), RGN_FRAC(1,4) + 1, RGN_FRAC(1,4) + 2, RGN_FRAC(1,4) + 3,
		RGN_FRAC(1,4) + 4, RGN_FRAC(1,4) + 5, RGN_FRAC(1,4) + 6, RGN_FRAC(1,4) + 7
	},
	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
	8*8
};

static const gfx_layout tilelayout_8 =
{
	8,8,
	RGN_FRAC(1,2),
	2,
	{ 0, RGN_FRAC(1,2) },
	{ 0, 1, 2, 3, 4, 5, 6, 7 },
	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
	8*8
};


/******************************
* Graphics Decode Information *
******************************/

static GFXDECODE_START( gfx_videopkr )
	GFXDECODE_ENTRY( "tiles", 0, tilelayout_8, 0, 64 )
GFXDECODE_END


static GFXDECODE_START( gfx_videodad )
	GFXDECODE_ENTRY( "tiles", 0, tilelayout_16, 0, 64 )
GFXDECODE_END


/*******************************
*    Machine Start / Reset     *
*******************************/

void videopkr_state::machine_start()
{
	m_digits.resolve();
	m_lamp.resolve();
	m_vp_sound_p2 = 0xff;   /* default P2 latch value */
	m_sound_latch = 0xff;   /* default sound data latch value */
	m_p24_data = 0xff;
	m_p1 = 0xff;
	m_ant_cio = 0;
	m_count0 = 0;

	machine().device<nvram_device>("nvram")->set_base(m_data_ram, sizeof(m_data_ram));
}

/************************
*    Machine Drivers    *
************************/

MACHINE_CONFIG_START(videopkr_state::videopkr)

	/* basic machine hardware */
	MCFG_DEVICE_ADD("maincpu", I8039, CPU_CLOCK)
	MCFG_DEVICE_PROGRAM_MAP(i8039_map)
	MCFG_DEVICE_IO_MAP(i8039_io_port)
	MCFG_MCS48_PORT_P1_IN_CB(READ8(*this, videopkr_state, videopkr_p1_data_r))
	MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(*this, videopkr_state, videopkr_p1_data_w))
	MCFG_MCS48_PORT_P2_IN_CB(READ8(*this, videopkr_state, videopkr_p2_data_r))
	MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, videopkr_state, videopkr_p2_data_w))
	MCFG_MCS48_PORT_PROG_OUT_CB(WRITELINE(*this, videopkr_state, prog_w))
	MCFG_MCS48_PORT_T0_IN_CB(READLINE(*this, videopkr_state, videopkr_t0_latch))

	MCFG_DEVICE_VBLANK_INT_DRIVER("screen", videopkr_state,  irq0_line_assert)

	MCFG_DEVICE_ADD("soundcpu", I8039, SOUND_CLOCK)
	MCFG_DEVICE_PROGRAM_MAP(i8039_sound_mem)
	MCFG_DEVICE_IO_MAP(i8039_sound_port)
	MCFG_MCS48_PORT_P1_OUT_CB(WRITE8("dac", dac_byte_interface, write))
	MCFG_MCS48_PORT_P2_IN_CB(READ8(*this, videopkr_state, sound_p2_r))
	MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, videopkr_state, sound_p2_w))

	MCFG_NVRAM_ADD_0FILL("nvram")

	MCFG_TIMER_DRIVER_ADD_PERIODIC("t1_timer", videopkr_state, sound_t1_callback, attotime::from_hz(50))

	/* video hardware */
	MCFG_SCREEN_ADD("screen", RASTER)

	MCFG_SCREEN_SIZE(32*8, 32*8)
	MCFG_SCREEN_VISIBLE_AREA(5*8, 31*8-1, 3*8, 29*8-1)

	MCFG_SCREEN_REFRESH_RATE(60)
	MCFG_SCREEN_VBLANK_TIME(2080)
	MCFG_SCREEN_UPDATE_DRIVER(videopkr_state, screen_update_videopkr)
	MCFG_SCREEN_PALETTE("palette")

	MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_videopkr)
	MCFG_PALETTE_ADD("palette", 256)
	MCFG_PALETTE_INIT_OWNER(videopkr_state, videopkr)

	/* sound hardware */
	SPEAKER(config, "speaker").front_center();
	MCFG_DEVICE_ADD("dac", MC1408, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.275)
	MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
	MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
MACHINE_CONFIG_END


MACHINE_CONFIG_START(videopkr_state::blckjack)
	videopkr(config);

	/* basic machine hardware */

	/* video hardware */
	MCFG_SCREEN_MODIFY("screen")
	MCFG_SCREEN_SIZE(32*8, 32*8)
	MCFG_SCREEN_VISIBLE_AREA(4*8, 31*8-1, 2*8, 30*8-1)
MACHINE_CONFIG_END


MACHINE_CONFIG_START(videopkr_state::videodad)
	videopkr(config);

	/* basic machine hardware */
	MCFG_DEVICE_MODIFY("maincpu")
	MCFG_DEVICE_CLOCK(CPU_CLOCK_ALT)

	/* video hardware */
	MCFG_SCREEN_MODIFY("screen")
	MCFG_SCREEN_SIZE(32*16, 32*8)
	MCFG_SCREEN_VISIBLE_AREA(4*16, 31*16-1, 2*8, 30*8-1)

	MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_videodad)
	MCFG_VIDEO_START_OVERRIDE(videopkr_state,vidadcba)
MACHINE_CONFIG_END


MACHINE_CONFIG_START(videopkr_state::babypkr)
	videopkr(config);

	/* basic machine hardware */
	MCFG_DEVICE_MODIFY("maincpu")
	MCFG_DEVICE_CLOCK(CPU_CLOCK_ALT)
	/* most likely romless or eprom */
	MCFG_DEVICE_REPLACE("soundcpu", I8031, CPU_CLOCK )
	MCFG_DEVICE_PROGRAM_MAP(i8051_sound_mem)
	MCFG_DEVICE_IO_MAP(i8051_sound_port)
	MCFG_MCS51_PORT_P0_IN_CB(READ8(*this, videopkr_state, baby_sound_p0_r))
	MCFG_MCS51_PORT_P0_OUT_CB(WRITE8(*this, videopkr_state, baby_sound_p0_w))
	MCFG_MCS51_PORT_P1_IN_CB(READ8(*this, videopkr_state, baby_sound_p1_r))
	MCFG_MCS51_PORT_P1_OUT_CB(WRITE8(*this, videopkr_state, baby_sound_p1_w))
	MCFG_MCS51_PORT_P2_IN_CB(READ8(*this, videopkr_state, baby_sound_p2_r))
	MCFG_MCS51_PORT_P2_OUT_CB(WRITE8(*this, videopkr_state, baby_sound_p2_w))
	MCFG_MCS51_PORT_P3_IN_CB(READ8(*this, videopkr_state, baby_sound_p3_r))
	MCFG_MCS51_PORT_P3_OUT_CB(WRITE8(*this, videopkr_state, baby_sound_p3_w))

	/* video hardware */
	MCFG_SCREEN_MODIFY("screen")
	MCFG_SCREEN_SIZE(32*16, 32*8)
	MCFG_SCREEN_VISIBLE_AREA(5*16, 31*16-1, 3*8, 29*8-1)

	MCFG_PALETTE_MODIFY("palette")
	MCFG_PALETTE_INIT_OWNER(videopkr_state,babypkr)
	MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_videodad)
	MCFG_VIDEO_START_OVERRIDE(videopkr_state,vidadcba)

	MCFG_DEVICE_ADD("aysnd", AY8910, CPU_CLOCK / 6) /* no ports used */
	MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.3)
MACHINE_CONFIG_END

MACHINE_CONFIG_START(videopkr_state::fortune1)
	videopkr(config);

	/* basic machine hardware */
	MCFG_DEVICE_MODIFY("maincpu")
	MCFG_DEVICE_CLOCK(CPU_CLOCK_ALT)

	MCFG_PALETTE_MODIFY("palette")
	MCFG_PALETTE_INIT_OWNER(videopkr_state,fortune1)
MACHINE_CONFIG_END

MACHINE_CONFIG_START(videopkr_state::bpoker)
	babypkr(config);
	MCFG_DEVICE_REPLACE("maincpu", I8751, XTAL(6'000'000))
	MCFG_DEVICE_PROGRAM_MAP(i8751_map)
	MCFG_DEVICE_IO_MAP(i8751_io_port)
	MCFG_MCS51_PORT_P0_IN_CB(NOOP) // ???
	MCFG_MCS51_PORT_P1_IN_CB(NOOP) // ???
	MCFG_MCS51_PORT_P1_OUT_CB(NOOP) // ???

	MCFG_DEVICE_ADD("ppi", I8255A, 0)
	//MCFG_I8255_OUT_PORTA_CB()
	//MCFG_I8255_IN_PORTB_CB()
	//MCFG_I8255_OUT_PORTC_CB()
	//MCFG_I8255_IN_PORTC_CB()
MACHINE_CONFIG_END


/*************************
*        Rom Load        *
*************************/

ROM_START( videopkr )
	ROM_REGION( 0x1000, "maincpu", 0 )
	ROM_LOAD( "vpoker.c5",      0x0000, 0x0800, CRC(200d21e4) SHA1(d991c9f10a36a02491bb0aba32129675fed77a10) )
	ROM_LOAD( "vpoker.c7",      0x0800, 0x0800, CRC(f72c2a90) SHA1(e9c54d1f895cde0aaca4121a252da40594195a25) )

	ROM_REGION( 0x1000, "soundcpu", 0 ) /* sound cpu program */
	ROM_LOAD( "vpsona3.pbj",    0x0000, 0x0800, CRC(a4f7bf7f) SHA1(a08287821f3471cb3e1ae0528811da930fd57387) )
	ROM_LOAD( "vpsona2.pbj",    0x0800, 0x0800, CRC(583a9b95) SHA1(a10e85452e285b2a63f885f4e39b7f76ee8b2407) )

	ROM_REGION( 0x1000, "tiles", 0 )
	ROM_LOAD( "vpbj_b15.org",   0x0000, 0x0800, CRC(67468e3a) SHA1(761766f0fb92693d32179a914e11da517cc5747d) )
	ROM_LOAD( "vpbj_b12.org",   0x0800, 0x0800, CRC(4aba166e) SHA1(930cea2216a39b5d72021d1b449db018a121adce) )

	ROM_REGION( 0x0100, "proms", 0 )
	ROM_LOAD( "vpbjorg.col",    0x0000, 0x0100, CRC(09abf5f1) SHA1(f2d6b4f2f08b47b93728dafb50576d5ca859255f) )
	ROM_END

ROM_START( blckjack )
	ROM_REGION( 0x1000, "maincpu", 0 )
	ROM_LOAD( "bjc5org.old",    0x0000, 0x0800, CRC(e266a28a) SHA1(1f90c85a2a817f1927c9ab2cbf79cfa2dd116dc8) )
	ROM_LOAD( "bjc7org.old",    0x0800, 0x0800, CRC(c60c565f) SHA1(c9ed232301750288bd000ac4e2dcf2253745ff0a) )

	ROM_REGION( 0x1000, "soundcpu", 0 ) /* sound cpu program */
	ROM_LOAD( "vpsona3.pbj",    0x0000, 0x0800, CRC(a4f7bf7f) SHA1(a08287821f3471cb3e1ae0528811da930fd57387) )
	ROM_LOAD( "vpsona2.pbj",    0x0800, 0x0800, CRC(583a9b95) SHA1(a10e85452e285b2a63f885f4e39b7f76ee8b2407) )

	ROM_REGION( 0x1000, "tiles", 0 )
	ROM_LOAD( "vpbj_b15.org",   0x0000, 0x0800, CRC(67468e3a) SHA1(761766f0fb92693d32179a914e11da517cc5747d) )
	ROM_LOAD( "vpbj_b12.org",   0x0800, 0x0800, CRC(4aba166e) SHA1(930cea2216a39b5d72021d1b449db018a121adce) )

	ROM_REGION( 0x0100, "proms", 0 )
	ROM_LOAD( "vpbjorg.col",    0x0000, 0x0100, CRC(09abf5f1) SHA1(f2d6b4f2f08b47b93728dafb50576d5ca859255f) )
ROM_END

ROM_START( videodad )
	ROM_REGION( 0x1000, "maincpu", 0 )
	ROM_LOAD( "dac5org.old",    0x0000, 0x0800, CRC(b373c8e9) SHA1(7a99d6aa152f8e6adeddbfdfd13278edeaa529bc) )
	ROM_LOAD( "dac7org.old",    0x0800, 0x0800, CRC(afabae30) SHA1(c4198ba8de6811e3367b0154ff479f6738721bfa) )

	ROM_REGION( 0x1000, "soundcpu", 0 ) /* sound cpu program */
	ROM_LOAD( "vdsona3.dad",    0x0000, 0x0800, CRC(13f7a462) SHA1(2e2e904637ca7873a2ed67d7ab1524e51b324660) )
	ROM_LOAD( "vdsona2.dad",    0x0800, 0x0800, CRC(120e4512) SHA1(207748d4f5793180305bb115af877042517d901f) )

	ROM_REGION( 0x2000, "tiles", 0 )
	ROM_LOAD( "vdadob15.bin",   0x0000, 0x0800, CRC(caa6a4b0) SHA1(af99da30b8ee63d54ac1f1e6737ed707501a5a25) )
	ROM_LOAD( "vdadob14.bin",   0x0800, 0x0800, CRC(eabfae6b) SHA1(189b38da5e9c99f99c5425cdfefccc6991e3f85e) )
	ROM_LOAD( "vdadob12.bin",   0x1000, 0x0800, CRC(176f7b31) SHA1(613521ed9caf904db22860686e0424d0c0e0cba6) )
	ROM_LOAD( "vdadob11.bin",   0x1800, 0x0800, CRC(259492c7) SHA1(003cc40a88f2b9fad0089574963e7e654211bb16) )

	ROM_REGION( 0x0100, "proms", 0 )
	ROM_LOAD( "vdvcorg.col",    0x0000, 0x0100, CRC(741b1a22) SHA1(50983ea37f0479793ba38a112a0266c2edc4b5ef) )
ROM_END

ROM_START( videocba )
	ROM_REGION( 0x1000, "maincpu", 0 )
	ROM_LOAD( "vcc5org.old",    0x0000, 0x0800, CRC(96d72283) SHA1(056197a9e2ad40d1d6610bbe8a1855b81c0a6715) )
	ROM_LOAD( "vcc7org.old",    0x0800, 0x0800, CRC(fdec55c1) SHA1(19b740f3b7f2acaa0fc09f4c0a2fe69721ebbcaf) )

	ROM_REGION( 0x1000, "soundcpu", 0 ) /* sound cpu program */
	ROM_LOAD( "vcsona3.rod",    0x0000, 0x0800, CRC(b0948d6c) SHA1(6c45d350288f69b4b2b5ac16ab2b418f14c6eded) )
	ROM_LOAD( "vcsona2.rod",    0x0800, 0x0800, CRC(44ff9e85) SHA1(5d7988d2d3bca932b77e014dc61f7a2347b01603) )

	ROM_REGION( 0x2000, "tiles", 0 )
	ROM_LOAD( "vcbab15.bin",    0x0000, 0x0800, CRC(fce8c772) SHA1(f9736b724b620d60a17d77f6b773f39b99b47190) )
	ROM_LOAD( "vcbab14.bin",    0x0800, 0x0800, CRC(6fd66330) SHA1(0ee3b3329b94ded81f028ebb687e580787c74ded) )
	ROM_LOAD( "vcbab12.bin",    0x1000, 0x0800, CRC(e534d6c3) SHA1(7a93c6c07b5a28558ee005fed2098dc2933c3252) )
	ROM_LOAD( "vcbab11.bin",    0x1800, 0x0800, CRC(e2069a6d) SHA1(2d4e71f2838451215e6f9629e2d1a35808510353) )

	ROM_REGION( 0x0100, "proms", 0 )
	ROM_LOAD( "vdcbaorg.col",   0x0000, 0x0100, CRC(6cdca5ae) SHA1(f7430af1adfa24fdd68a026ee431ead7d47ba269) )
ROM_END

ROM_START( babypkr )
	ROM_REGION( 0x4000, "maincpu", 0 )
	ROM_LOAD( "pok8039.old",    0x0000, 0x4000, CRC(c5400ef1) SHA1(1f27c92d2979319070a695f71ed494f6d47fe88f) )

	ROM_REGION( 0x1000, "soundcpu", 0 )
	ROM_LOAD( "dadvpbj.son",    0x0000, 0x1000, CRC(7b71cd30) SHA1(d782c50689a5aea632b6d274a1a7435a092ad20c) )

	ROM_REGION( 0x20000, "tiles", 0 )
	ROM_LOAD( "vpbjep15.mme",   0x00000, 0x8000,CRC(cad0f7cf) SHA1(0721b8b30dbf2a5da2967b0cfce24b4cd62d3f9d) )
	ROM_LOAD( "vpbjep14.mme",   0x08000, 0x8000,CRC(96f512fa) SHA1(f5344aeb57f53c43156e923fb7f0d8d37c73dbe9) )
	ROM_LOAD( "vpbjep12.mme",   0x10000, 0x8000,CRC(cfdca530) SHA1(609a5ad6f34e6b5c1c35584ddc62d4ff87546415) )
	ROM_LOAD( "vpbjep11.mme",   0x18000, 0x8000,CRC(44e6c489) SHA1(ca211cb3807c476cd8c5ac98b0d18b4b2724df45) )

	ROM_REGION( 0x0100, "proms", 0 )
	ROM_LOAD( "babypok.col",    0x0000, 0x0100, CRC(2b98e88a) SHA1(bb22ef090e9e5dddc5c160d41a5f52df0db6feb6) )
ROM_END

ROM_START( babydad )
	ROM_REGION( 0x4000, "maincpu", 0 )
	ROM_LOAD( "da400org.old",   0x0000, 0x4000, CRC(cbca3a0c) SHA1(5d9428f26edf2c5531398a6ae36b4e9169b2c1c1) )

	ROM_REGION( 0x1000, "soundcpu", 0 )
	ROM_LOAD( "dadvpbj.son",    0x0000, 0x1000, CRC(7b71cd30) SHA1(d782c50689a5aea632b6d274a1a7435a092ad20c) )

	ROM_REGION( 0x20000, "tiles", 0 )
	ROM_LOAD( "ep15dad.dad",    0x00000, 0x8000,CRC(21bd102d) SHA1(52788d09dbe38fa29b8ff044a1c5249cad3d45b4) )
	ROM_LOAD( "ep14dad.dad",    0x08000, 0x8000,CRC(b6e2c8a2) SHA1(352d88e1d764da5133de2be9987d4875f0c9237f) )
	ROM_LOAD( "ep12dad.dad",    0x10000, 0x8000,CRC(98702beb) SHA1(6d42ea48df7546932570da1e9b0be7a1f01f930c) )
	ROM_LOAD( "ep11dad.dad",    0x18000, 0x8000,CRC(90aac63b) SHA1(8b312f2313334b4b5b0344b786aa1a7a4979ea92) )

	ROM_REGION( 0x0100, "proms", 0 )
	ROM_LOAD( "babydad.col",    0x0000, 0x0100, CRC(b3358b3f) SHA1(d499a08fefaa3566de2e6fcddd237d6dfa840d8a) )
ROM_END

/*
Video Poker PCB
-----------------

Main + daughterboard...


MAINBOARD:
----------

1x AMD D8751H.
1x AY-3-8910A.
1x LM380N.
1x 6.0 MHz. Xtal.

5x pots:
- 3 together on the connectors opposit side (maybe RGB).
- 1 near the AY-3-8910.
- 1 opposit to the sound circuitry.

1x 8.0000 MHz. Xtal, near the 3 pots (RGB).
NOTE: silkscreened 7.8643 MHz. on the PCB.

ROMs:

conf_11_poker_ver_1.00_9055.bin : AMD Am27C256.
checksum : 00779055h
CRC-32 : B8ABC965h

conf_12_poker_ver_1.00_3909.bin : AMD Am27C256.
checksum : 00753909h
CRC-32 : 3E72D96Ch

conf_14_poker_ver_1.00_813a.bin : AMD Am27C256.
checksum : 0074813Ah
CRC-32 : F3D6A741h

conf_15_poker_ver_1.00_ea91.bin : AMD Am27C256.
checksum : 0074EA91h
CRC-32 : 4EFEA023h

sonido_dados_poker_y_b.jack_3d2f_(d8751h).bin : AMD D8751H.
checksum : 000C3D2Fh
CRC-32 : 7B71CD30h


DAUGHTERBOARD:
--------------

1x AMD P80C31BH (8031 CPU)
1x AMD P8255A (PPI)
1x 40-pin empty socket (silkscreened 'zocalo' = socket)

1x NEC D4464C-15 SRAM
1x DALLAS DS1232

1x 27256 ROM:

b_poker_ver_1403.bin

FUJITSU MBM27256.
-Buffer checksum : 003D1403h
-CRC-32 : 61ECA2F6h

1x 8.0000 MHz. Xtal.

1x 3-pin connector (JP2).
1x 7-pin connector (JP4).
1x 8-pin connector (JP3).
1x 14-pin connector (impresora).

*/
ROM_START( bpoker )
	ROM_REGION( 0x8000, "maincpu", 0 )
	ROM_LOAD( "b_poker_ver_1403.bin", 0x0000, 0x8000, CRC(61eca2f6) SHA1(62a671e86b94005a9ffc4b6545a90c43880e0a11) )

	ROM_REGION( 0x1000, "soundcpu", 0 )
	ROM_LOAD( "sonido_dados_poker_y_b.jack_3d2f_=d8751h=.bin", 0x0000, 0x1000, CRC(7b71cd30) SHA1(d782c50689a5aea632b6d274a1a7435a092ad20c) )

	ROM_REGION( 0x20000, "tiles", 0 )
	ROM_LOAD( "conf_15_poker_ver_1.00_ea91.bin", 0x00000, 0x8000, CRC(4efea023) SHA1(c10a30353d793a54eab14bd5e9687668743b66de) )
	ROM_LOAD( "conf_14_poker_ver_1.00_813a.bin", 0x08000, 0x8000, CRC(f3d6a741) SHA1(5fbfcf4b8fdd1ef9f3d0f9acc735d5c23f45b607) )
	ROM_LOAD( "conf_12_poker_ver_1.00_3909.bin", 0x10000, 0x8000, CRC(3e72d96c) SHA1(3d921b9a79b8116984f58954141800d1856d8311) )
	ROM_LOAD( "conf_11_poker_ver_1.00_9055.bin", 0x18000, 0x8000, CRC(b8abc965) SHA1(61a6cdcfd4cd65d4a7ce02c6a2c4216ab6da095c) )

	ROM_REGION( 0x0100, "proms", 0 )
	ROM_LOAD( "babypok.col",    0x0000, 0x0100, BAD_DUMP CRC(2b98e88a) SHA1(bb22ef090e9e5dddc5c160d41a5f52df0db6feb6) )
ROM_END

ROM_START( fortune1 )
	ROM_REGION( 0x1000, "maincpu", 0 )
	ROM_LOAD( "pk485-s-000-7ff.c5",   0x0000, 0x0800, CRC(d74c4860) SHA1(9d151e2be5c1e9fc2e7ce5e533eb08e4b849f2c1) )
	ROM_LOAD( "pk485-s-800-fff.c7",   0x0800, 0x0800, CRC(490da6b0) SHA1(4b7afd058aeda929821d62c58e234769d64339e1) )

	ROM_REGION( 0x1000, "soundcpu", 0 )
	ROM_LOAD( "vpsona3.pbj",    0x0000, 0x0800, CRC(a4f7bf7f) SHA1(a08287821f3471cb3e1ae0528811da930fd57387) )
	ROM_LOAD( "vpsona2.pbj",    0x0800, 0x0800, CRC(583a9b95) SHA1(a10e85452e285b2a63f885f4e39b7f76ee8b2407) )

	ROM_REGION( 0x1000, "tiles", 0 )
	ROM_LOAD( "cg073-cg0-a.b12",     0x0000, 0x0800, CRC(fff2d7aa) SHA1(935b8623fda5b4b25ba1aaea869ebb2baded515c) )
	ROM_LOAD( "cg073-cg1-a.b15",     0x0800, 0x0800, CRC(a7cb05c4) SHA1(7cd76ade7cf9c50421b054ee525108829c31307c) )

	ROM_REGION( 0x100, "proms", 0 )
	ROM_LOAD( "3140-cap8.b8", 0x0000, 0x0100, CRC(09abf5f1) SHA1(f2d6b4f2f08b47b93728dafb50576d5ca859255f) )
ROM_END

/*************************
*      Game Drivers      *
*************************/
//     YEAR  NAME      PARENT    MACHINE   INPUT     CLASS           INIT        ROT   COMPANY                                FULLNAME                          FLAGS                LAYOUT
GAMEL( 1984, videopkr, 0,        videopkr, videopkr, videopkr_state, empty_init, ROT0, "InterFlip",                           "Video Poker",                    0,                   layout_videopkr )
GAMEL( 1984, fortune1, videopkr, fortune1, videopkr, videopkr_state, empty_init, ROT0, "IGT - International Game Technology", "Fortune I (PK485-S) Draw Poker", 0,                   layout_videopkr )
GAMEL( 1984, blckjack, videopkr, blckjack, blckjack, videopkr_state, empty_init, ROT0, "InterFlip",                           "Black Jack",                     0,                   layout_blckjack )
GAMEL( 1987, videodad, videopkr, videodad, videodad, videopkr_state, empty_init, ROT0, "InterFlip",                           "Video Dado",                     0,                   layout_videodad )
GAMEL( 1987, videocba, videopkr, videodad, videocba, videopkr_state, empty_init, ROT0, "InterFlip",                           "Video Cordoba",                  0,                   layout_videocba )
GAMEL( 1987, babypkr,  videopkr, babypkr,  babypkr,  videopkr_state, empty_init, ROT0, "Recreativos Franco",                  "Baby Poker",                     0,                   layout_babypkr  )
GAMEL( 1987, babydad,  videopkr, babypkr,  babydad,  videopkr_state, empty_init, ROT0, "Recreativos Franco",                  "Baby Dado",                      0,                   layout_babydad  )
GAMEL( 198?, bpoker,   videopkr, bpoker,   babypkr,  videopkr_state, empty_init, ROT0, "Recreativos Franco",                  "Video Poker (v1403)",            MACHINE_NOT_WORKING, layout_babypkr  )