/
norautp.cpp
4609 lines (3751 loc) · 233 KB
/
norautp.cpp
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
// license:BSD-3-Clause
// copyright-holders:Angelo Salese, Roberto Fresca
/******************************************************************************
- NORAUT POKER SYSTEM -
-------------------------
Driver by Roberto Fresca & Angelo Salese.
Games running on this hardware:
-- Z80 based --
* Noraut Poker, 1988, Noraut Ltd.
* Noraut Deluxe Poker (console), 198?, Noraut Ltd.
* Noraut Deluxe Poker (bootleg), 198?, Unknown.
* Noraut Joker Poker (original), 198?, Noraut Ltd.
* Noraut Joker Poker (Prologic HW), 198?, Video Fun Games Ltd.
* Noraut Joker Poker (alt), 1988, Noraut Ltd.
* Noraut Red Hot Joker Poker, 1988, Noraut Ltd.
* Noraut Red Hot Joker Poker (alt HW), 198?, Noraut Ltd.
* Noraut Poker (NTX10A), 1988, Noraut Ltd.
* Noraut Jacks Plus / Joker Poker (V3.010a), 2002, Noraut Ltd.
* Noraut Jacks Plus / Joker Poker (V3.011a), 2003, Noraut Ltd.
* Noraut Joker Poker (console, set 1), 198?, Noraut Ltd.
* Noraut Joker Poker (console, set 2), 198?, Noraut Ltd.
* Mainline Double Joker Poker, 198?, Mainline London.
* Double Joker Poker (45%-75% payout), 199?, DellFern Ltd.
* Royal on Ten (hack of Noraut Deluxe Poker), 2005, Unknown.
* Credit Poker (ver.30c, standard), 1999, CGI.
* Credit Poker (ver.30b, 7 & 9 bonus), 1999, CGI.
* Credit Poker (ver.23b, 7 & 9 bonus), 1998, CGI.
* Double Joker Poker (CGI), 19??, CGI.
* Kimble Double HI-LO (z80 version), 198?, Kimble Ireland.
* PMA Poker, 198?, PMA.
* Poker / Black Jack (Model 7521), 198?, M. Kramer Manufacturing.
* New Hi-Low Poker, 19??, Song won?
* Draw Poker (Joker Poker V.01), 1984, Coinmaster.
-- 8080 based --
* Draw Poker HI-LO, 1983, M. Kramer Manufacturing.
* Draw Poker HI-LO (alt), 1983, Unknown.
* Draw Poker HI-LO (Japanese), 198?, Unknown.
* Kimble Double HI-LO, 198?, Kimble Ireland.
* GTI Poker, 1983, GTI Inc.
* GTI Poker? (SMS hardware), 1983, GTI Inc.
* HI-LO Double Up Joker Poker, 1983, SMS Manufacturing Corp.
* Drews Revenge (v.2.89, set 1), 1986, Drews Inc.
* Drews Revenge (v.2.89, set 2), 1986, Drews Inc.
* Southern Systems Joker Poker, 1982, Southern Systems & Assembly, Ltd.
-- 8080 based with MCU --
* Turbo Poker 2, 1993, Micro Manufacturing, Inc.
-- unknown CPU based --
* Fast Draw (poker conversion kit)?, 198?, Stern Electronics?
* Draw Poker HI-LO (unknown, rev 1), 198?, SMS Manufacturing Corp?.
* Draw Poker HI-LO (unknown, rev 2), 198?, SMS Manufacturing Corp?.
* unknown poker game PKII/DM, 198?, Unknown.
* unknown LJF Corportaion poker game 1989, LJF Corporation
*******************************************************************************
This hardware emulation opened a big can of worms. :)
Seems that the original hardware/game was created by M.Kramer Manufacturing,
and then reprogrammed, copied, bootlegged, used & abused by other companies
like Noraut Ltd, Kimble Ireland, GTI, DellFern, Merit Industries, Red Card,
Blue Games, CGI, Micro Manufacturing, SMS Manufacturing, Drews Distributing,
Drew Industries, Lynch Enterprises Inc, Hillside Gaming Corp, Electro Sport,
Mainline London, Southern Systems, Americade Amusement Inc, Prologic Ireland,
Mosfat, Unique, GEI, Southern Systems, Assembly Ltd., Coinmaster, etc...
You can see some legal issues in the following links:
http://cases.justia.com/us-court-of-appeals/F2/783/421/41759/
Special thanks to Alan Griffin, that kindly helped providing good references
that allowed me to improve the Noraut system emulation.
*******************************************************************************
HARDWARE NOTES:
---------------
Noraut Edge Connector (pinouts)
--------------------------------
Component PN Solder Side
--------------------------------
GND 01 GND
5v DC 02 5v DC
03
12v DC 04 12v DC
05
06
07
0v 08 Readout Switch
0v 09 Low level hopper
0v 10 50p in
0v 11 pound in
0v 12 Bet switch
0v 13 Deal switch
0v 14 Hold 1 switch
0v 15 Half Gamble switch
0v 16 Change Card switch
Refil 17 Coin count/sense from hopper
Low Switch 18 High switch
Hold 3 Switch 19 Hold 2 switch
Hold 5 Switch 20 Hold 4 switch
10p coin 21 Deflect
22 50p in meter
23 Hopper Motor Drive (low volt switch line NOT 24v)
24
25 spk+
26 Panel lamps clock
Monitor sync 27 Hold 1 lamp
Bet lamp 28 Deal lamp
Change lamp 29 Hold 4 lamp
Hold 5 lamp 30 Panel lights reset
High lamp 31 Half Gamble lamp
Hold 2 lamp 32 Low lamp
10p Meter out 33 Meter refil
Video Green 34 Hold 3 lamp
Video Blue 35 10p in Meter
Video Red 36 Spark Detect (Not on all boards)
*******************************************************************************
Control Panel
-------------
There are 2 control panel schemes:
* The default one (11 button-lamps) for systems without CANCEL button.
.--------------------------------------------------------------------------.
| .-------. .------. .------. |
| .------. .------. .------. .------. .------. | BET | | HALF | | HI | |
| | | | | | | | | | | |COLLECT| |GAMBLE| | | |
| | HOLD | | HOLD | | HOLD | | HOLD | | HOLD | '-------' '------' '------' |
| |CANCEL| |CANCEL| |CANCEL| |CANCEL| |CANCEL| .-------. .------. .------. |
| | | | | | | | | | | | DEAL | |CHANGE| | LO | |
| '------' '------' '------' '------' '------' | DRAW | | CARD | | | |
| '-------' '------' '------' |
'--------------------------------------------------------------------------'
HOLD buttons = red.
BET, DEAL, HI & LO = yellow.
HALF GAMBLE & CHANGE CARD = orange.
* The alternate one (12 button-lamps) for systems with CANCEL button.
.-------------------------------------------------------------.
| .------. .------. .------. .------. .------. .----------. |
| | HOLD | | HOLD | | HOLD | | HOLD | | HOLD | | HIGH | |
| '------' '------' '------' '------' '------' '----------' |
| .------. .------. .------. .------. .------. .----------. |
| |CANCEL| |STAND | | SAVE | | DEAL | | BET | | LOW | |
| '------' '------' '------' '------' '------' '----------' |
'-------------------------------------------------------------'
HOLD & CANCEL buttons = yellow (1).
STAND & DEAL buttons = orange (1).
SAVE (HALF GAMBLE) button = blued-green (1).
BET button = red (1).
HIGH & LOW buttons = yellow.
(1) Circular-shaped buttons.
Some lamps are wired in different way in this scheme.
*******************************************************************************
Narout System Ports Map
-----------------------
(*) Confirmed lines.
PPI-0 (60h-63h); PortA IN.
DIP Switches bank:
7654 3210
---- ---x * DIP switch 8
---- --x- * DIP switch 7
---- -x-- * DIP switch 6
---- x--- * DIP switch 5
---x ---- * DIP switch 4
--x- ---- * DIP switch 3
-x-- ---- * DIP switch 2
x--- ---- * DIP switch 1
PPI-0 (60h-63h); PortB OUT.
Lamps:
7654 3210
---- ---x * CHANGE CARD lamp.
---- --x- * SAVE / HALF GAMBLE lamp.
---- -x-- * HOLD 1 lamp.
---- x--- * HOLD 2 lamp.
---x ---- * HOLD 3 lamp.
--x- ---- * HOLD 4 lamp.
-x-- ---- * HOLD 5 lamp.
x--- ---- * CANCEL lamp.
PPI-0 (60h-63h); PortC OUT.
Lamps & Coin Counters:
7654 3210
---- ---x * HI lamp.
---- --x- * LO lamp.
---- -x-- * HOPPER MOTOR DRIVE
---- x--- * Payout pulse.
---x ---- * Coin 2 counter.
--x- ---- * Coin 1 counter.
-x-- ---- + Coin counter related.
x--- ---- + DEFLECT (always activated).
-----------------------------------------------------------
PPI-1 (a0h-a3h); PortA IN.
Regular Inputs:
7654 3210
---- ---x * DEAL / DRAW button.
---- --x- * BET / CHANGE CARD button.
---- -x-- * COIN 1 mech.
---- x--- * COIN 2 mech.
---x ---- * READOUT button (noraut11).
--x- ---- * HI button.
-x-- ---- * LO button.
x--- ---- * PAYOUT button.
PPI-1 (a0h-a3h); PortB IN.
Regular Inputs:
7654 3210
---- ---x * STAND / TAKE button.
---- --x- * SAVE / HALF GAMBLE button.
---- -x-- * HOLD 1 button.
---- x--- * HOLD 2 button.
---x ---- * HOLD 3 button.
--x- ---- * HOLD 4 button.
-x-- ---- * HOLD 5 button.
x--- ---- * CANCEL button.
PPI-1 (a0h-a3h); PortC OUT.
Sound & Lamps:
7654 3210
---- ---x * DEAL / DRAW Lamp.
---- --x- * BET / COLLECT Lamp.
---- -x-- + PANEL LIGHTS RESET (always activated after initialize).
---- x--- + PANEL LAMPS CLOCK
xxxx ---- * Discrete Sound Lines.
-----------------------------------------------------------
PPI-2 (a0h-a3h); PortA IN/OUT
VRAM Handlers:
7654 3210
xxxx xxxx VRAM DATA.
PPI-2 (a0h-a3h); PortB OUT
VRAM Handlers:
7654 3210
xxxx xxxx VRAM ADDRESSING.
PPI-2 (a0h-a3h); PortC IN/OUT.
PortA handshake lines & PC0-PC2 (noraut11 = OUT; noraut12 = IN):
7654 3210
---- ---x * N/C (noraut11).
---- --x- * N/C (noraut11).
---- -x-- * N/C (noraut11).
---- ---x * N/C (noraut12).
---- --x- * READOUT SWITCH (noraut12).
---- -x-- * LOW LEVEL HOPPER (noraut12).
xxxx x--- * PortA HANDSHAKE LINES (all systems).
*******************************************************************************
*** Game Notes ***
- norautjp:
At the first start-up, the game will give you a very clever
"FU" screen. Press the following buttons *together* on different times
to get rid of it (and actually initialize the machine):
* start + bet buttons (1+2);
* Hold 3 + Hold 2 + Save (Half Gamble) + Change Card (C+X+F+D)
Also notice that you actually need to map the last four buttons on the
same button / on a joypad since MAME's steady key doesn't seem to work on
my end...
*******************************************************************************
--------------------
*** Memory Map ***
--------------------
Noraut HW:
0x0000 - 0x1FFF ; ROM space.
0x2000 - 0x27FF ; NVRAM.
0x60 - 0x63 ; PPI 8255 0 - DIP Switches, lamps & counters.
0xA0 - 0xA3 ; PPI 8255 1 - Regular Inputs, sound lines & remaining lamps.
0xC0 - 0xC3 ; PPI 8255 2 - Video RAM access & other stuff.
DPHL HW:
0x0000 - 0x1FFF ; ROM space.
0x5000 - 0x53FF ; NVRAM.
0x7C - 0x7F ; PPI 8255 0 - DIP Switches, lamps & counters.
0xBC - 0xBF ; PPI 8255 1 - Regular Inputs, sound lines & remaining lamps.
0xDC - 0xDF ; PPI 8255 2 - Video RAM access & other stuff.
*******************************************************************************
DRIVER UPDATES:
[2009-01-27]
- Initial release.
- Defined ROM, RAM.
- Added 2x PPI 8255 for regular I/O.
- Added complete inputs and hooked DIP switches.
- Added video RAM support.
- Added NVRAM.
- Added lamps support.
- Added coin counters.
- Identified the sound writes.
- Added hardware description.
- Added pinout scheme.
- Added technical notes.
[2009-01-28]
- Merged GTI Poker (gtipoker.c) with this driver.
- Added new memory map and machine driver for gtipoker.
- Hooked 2x PPI 8255 to gtipoker.
- Hooked the video RAM access ports to gtipoker.
- Changed norautpn description from Noraut Poker (No Payout),
to Noraut Poker (bootleg), since the game has payout system.
- Some clean-ups.
[2009-08-21]
- Switched to pre-defined Xtal clock.
- Changed the way how graphics are banked/accessed.
- Fixed the graphics offset and number of tiles per bank.
- Added new set: Noraut Red Hot Joker Poker.
- Added new set: Noraut Poker (NTX10A).
- Added new set: Noraut Joker Poker (V3.010a).
- Fixed the tile size/decode for the first GFX bank.
- Added proper norautrh inputs, including the readout button.
- Added partial DIP switches to norautrh.
- Added more technical notes.
[2009-08-23/26]
- Added a default NVRAM to Noraut Joker Poker to bypass the 'F U' screen.
This is due to the physical keyboard limitation when needs to enter
4 simultaneous inputs.
- Executed a trojan on 2 noraut systems to confirm the way 16x32 tiles are decoded.
- Fixed the x-offset for 32x32 tiles lines.
- Fixed the screen aspect and visible area.
- Confirmed correct colors. No bipolar PROM involved.
- Added Noraut Joker Poker hardware and PCB layouts.
- Documented the discrete audio circuitry. Added a full diagram.
[2009-08-29]
- Fixed the coin counters.
- Documented all the output ports.
- Added a scheme with descriptions for every existent port.
- Added full lamps support to naroutp, naroutjp, naroutrh and naroutpn.
- Created lamps layouts for 11 and 12-lamps scheme.
- Rerouted some inputs to mantain the inputs layout.
- Renamed some inputs to match the text with the real cab buttons.
- Removed the imperfect colors flag from the existent sets.
- Added 2 different control panel layouts to the source.
- Updated technical notes.
[2009-08-30]
- Corrected CPU clock to Xtal/8.
- Discovered 3 new I/O lines coming from PPI-2, PC0-PC2. They are mixed with the handshake ones.
- Added the READOUT button to noraut12 games.
- Splitted the main machine driver to cover 2 different Noraut systems.
- Added partial support for PPI-2, PC0-PC2 output lines on noraut11 games.
- Figured out other remaining I/O lines.
- Added new handlers to simulate the handshake lines. Still need real support through PPI-2.
- Updated technical notes.
[2009-09-03]
- Routed the whole video RAM access through PPI-2.
(bypassed the handshake lines for now).
- Merged back the noraut machine drivers after the 3rd PPI connection.
- Added Low Level Hopper manual input.
- Added a new machine driver for extended hardware.
It has 2 jumpers that cut the a14 and a15 addressing lines.
[2009-09-09]
- Added accurate discrete sound system emulation.
- Fixed the discrete sound system diagram, based on real sound references.
[2009-10-12]
- Added Draw Poker HI-LO hardware support, based on 8080A CPU.
- Mirrored the PPI's offsets to simplify/merge the hardware emulation.
- Added hardware documentation and PCB layouts from both DPHL sets.
- Added DPHL discrete sound circuitry scheme/documentation.
- Added Turbo Poker 2 from Micro Manufacturing.
- Added PMA poker.
- Documented the Turbo Poker 2 hardware.
- Added Turbo Poker 2 PCB layout from hi-res picture.
- Switched to the new PPI core.
- Commented out the 3rd PPI device till handshaked strobe lines can be
properly emulated. For now, all VRAM access is through direct handlers.
This allow to remove the hacks per set needed to boot the games.
[2009-10-13]
- Added Draw Poker HI-LO (japanese), based on 8080A CPU.
- Merged the gtipoker memory map and machine driver with dphl.
- Created a base machine driver and then derivatives by hardware.
- Splitted the regular RAM and NVRAM systems.
- Added 'HI-LO Double Up Joker Poker' from SMS Manufacturing.
- Added smshilo hardware details and PCB layout.
- Added smshilo discrete sound circuitry scheme/documentation.
[2009-11-26]
- A lot of work in memory maps and machine driver stuff.
- Improved Inputs / DIP switches for some games.
- Added lamps support / layouts to new working games.
- Added preliminary support to Kimble hardware.
- Added support to CGI's Credit Poker 30x games.
- Added new (and fixed old) technical notes.
- Added Noraut Deluxe Poker (console).
- Added Noraut Joker Poker (original).
- Added Noraut Red Hot Joker Poker (alt HW).
- Added Noraut Joker Poker (V3.011a).
- Added Noraut unknown set 1 (console).
- Added Noraut unknown set 2 (console).
- Added Mainline Double Joker Poker.
- Added Double Joker Poker (45%-75% payout).
- Added Royal on Ten (Noraut Deluxe hack).
- Added Credit Poker (ver.30c, standard).
- Added Poker / Black Jack (Model 7521).
- Added Kimble Joker Poker.
- Added DRHL Poker (v.2.89).
- Renamed norautpn description to Noraut Deluxe Poker (bootleg).
- Added a placeholder for tpoker2's undumped 68705 MCU.
- Reorganized the driver, plus some clean-ups.
- Renamed kimblejp to kimbldhl. Changed game description to Kimble Double HI-LO.
- Added specific memory map & machine driver to Kimble Double HI-LO.
- Fix the Kimble Double HI-LO CPU type.
- Added notes about the code obfuscation and PPI's handling/offsets.
[2009-12-04]
- Added new technical notes.
- Added Kimble Double HI-LO (z80 HW mod).
- Added Noraut Joker Poker (Prologic HW).
- Added proper discrete sound support to Kimble games,
and Prologic-Noraut Joker Poker.
- Slightly adjusted the visual area.
This can be wrong and must be rechecked.
- Relocated the hardware notes and layouts to ROM_LOAD section,
so can be seen/maintained in a cleaner way.
- Fixed the default lamps state.
[2009-12-08]
- Added Fast Draw (poker conversion kit)?. Seems based on 8080 CPU hardware.
- Added Draw Poker HI-LO (unknown, rev 1). Seems based on 8080 CPU hardware.
- Added Draw Poker HI-LO (unknown, rev 2). Seems based on 8080 CPU hardware.
- Added a PCB layout for M.Kramer's Black Jack Poker, based on a hi-res pic.
- Added undumped devices as NO_DUMP.
- Added some technical notes.
[2009-12-08]
- Added Southern Systems Joker Poker. Based on 8080 CPU.
- Added some technical notes.
[2011-01-24]
- Changed DRHL description to "Drews Revenge (v.2.89, set 1)"
- Added Drews Revenge (v.2.89, set 2). Based on 8080 CPU.
[2013-04-09]
- Added GTI Poker? (SMS hardware). Based on 8080 CPU.
- Added PCB description and sound hardware schematics.
[2013-2023]
- Added more sets.
- Partial decryption of norautua & norautub sets.
- Decryption of noraut3 sets.
- Working inputs, DIP switches, and button-lamps layouts to noraut3 games.
- Change game description to noraut3 games, since are dual games selectable
through a DIP switch.
TODO:
- Check the 3rd PPI device at 0xc0-0xc3 (VRAM).
/OBF handshake line (PC7) formerly didn't seems to work properly.
- Interrupts in 8080 based games.
- Emulation of 8228 device for the 8080 based games.
- Find WTH are the reads at EFh.
- Find if wide chars are hardcoded or tied to a bit.
- Save support.
- Parent/clone relationship.
*******************************************************************************/
#include "emu.h"
#include "norautp.h"
#include "cpu/i8085/i8085.h"
#include "cpu/z80/z80.h"
#include "machine/nvram.h"
#include "speaker.h"
#include "noraut11.lh"
#include "noraut12.lh"
#define NORAUT_MASTER_CLOCK XTAL(18'432'000)
#define DPHL_MASTER_CLOCK XTAL(18'000'000)
#define NORAUT_CPU_CLOCK NORAUT_MASTER_CLOCK / 8 // 2.30275 MHz - Measured: 2.305 MHz
#define DPHL_CPU_CLOCK DPHL_MASTER_CLOCK / 9 // 2 MHz (from 8224)
/*********************************************
* Video Hardware *
*********************************************/
void norautp_state::video_start()
{
m_np_vram = make_unique_clear<uint16_t[]>(0x1000/2);
}
uint32_t norautp_state::screen_update_norautp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int x, y, count;
count = 0;
bitmap.fill(m_palette->pen(0), cliprect); // black pen
for(y = 0; y < 8; y++)
{
// Double width, displaced 8 pixels in X
if(y == 2 || (y >= 4 && y < 6))
{
for(x = 0; x < 16; x++)
{
int tile = m_np_vram[count] & 0x3f;
int colour = (m_np_vram[count] & 0xc0) >> 6;
m_gfxdecode->gfx(1)->opaque(bitmap,cliprect, tile, colour, 0, 0, (x * 32) + 8, y * 32);
count+=2;
}
}
else
{
for(x = 0; x < 32; x++)
{
int tile = m_np_vram[count] & 0x3f;
int colour = (m_np_vram[count] & 0xc0) >> 6;
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile, colour, 0, 0, x * 16, y * 32);
count++;
}
}
}
return 0;
}
void norautp_state::norautp_palette(palette_device &palette) const
{
// 1st gfx bank
palette.set_pen_color(0, rgb_t(0x00, 0x00, 0xff)); // blue
palette.set_pen_color(1, rgb_t(0xff, 0xff, 0x00)); // yellow
palette.set_pen_color(2, rgb_t(0x00, 0x00, 0xff)); // blue
palette.set_pen_color(3, rgb_t(0xff, 0xff, 0xff)); // white
palette.set_pen_color(4, rgb_t(0xff, 0xff, 0xff)); // white
palette.set_pen_color(5, rgb_t(0xff, 0x00, 0x00)); // red
palette.set_pen_color(6, rgb_t(0xff, 0xff, 0xff)); // white
palette.set_pen_color(7, rgb_t(0x00, 0x00, 0x00)); // black
}
/*******************************************
* R/W Handlers *
*******************************************/
void norautp_state::mainlamps_w(uint8_t data)
{
/* PPI-0 (60h-63h); PortB OUT.
Lamps:
7654 3210
---- ---x * CHANGE CARD lamp.
---- --x- * SAVE / HALF GAMBLE lamp.
---- -x-- * HOLD 1 lamp.
---- x--- * HOLD 2 lamp.
---x ---- * HOLD 3 lamp.
--x- ---- * HOLD 4 lamp.
-x-- ---- * HOLD 5 lamp.
x--- ---- * CANCEL lamp.
*/
m_lamps[0] = BIT(data, 0); // CHANGE CARD lamp
m_lamps[1] = BIT(data, 1); // SAVE / HALF GAMBLE lamp
m_lamps[2] = BIT(data, 2); // HOLD 1 lamp
m_lamps[3] = BIT(data, 3); // HOLD 2 lamp
m_lamps[4] = BIT(data, 4); // HOLD 3 lamp
m_lamps[5] = BIT(data, 5); // HOLD 4 lamp
m_lamps[6] = BIT(data, 6); // HOLD 5 lamp
m_lamps[7] = BIT(data, 7); // CANCEL lamp
// popmessage("lamps: %02x", data);
}
void norautp_state::soundlamps_w(uint8_t data)
{
/* PPI-1 (a0h-a3h); PortC OUT.
Sound & Lamps:
7654 3210
---- ---x * DEAL / DRAW Lamp.
---- --x- * BET / COLLECT Lamp.
---- -x-- + PANEL LIGHTS RESET (always activated after initialize).
---- x--- + PANEL LAMPS CLOCK
xxxx ---- * Discrete Sound Lines.
*/
m_lamps[8] = BIT(data, 0); // DEAL / DRAW lamp
m_lamps[9] = BIT(data, 1); // BET / COLLECT lamp
// the 4 MSB are for discrete sound
m_discrete->write(NORAUTP_SND_EN, (data >> 7) & 0x01);
m_discrete->write(NORAUTP_FREQ_DATA, (data >> 4) & 0x07);
// popmessage("sound bits 4-5-6-7: %02x, %02x, %02x, %02x", ((data >> 4) & 0x01), ((data >> 5) & 0x01), ((data >> 6) & 0x01), ((data >> 7) & 0x01));
}
void norautp_state::counterlamps_w(uint8_t data)
{
/* PPI-0 (60h-63h); PortC OUT.
Lamps & Coin Counters:
7654 3210
---- ---x * HI lamp.
---- --x- * LO lamp.
---- -x-- * HOPPER MOTOR DRIVE
---- x--- * Payout pulse.
---x ---- * Coin 2 counter.
--x- ---- * Coin 1 counter.
-x-- ---- + Coin counter related.
x--- ---- + DEFLECT (always activated).
*/
m_lamps[10] = BIT(data, 0); // HI lamp
m_lamps[11] = BIT(data, 1); // LO lamp
machine().bookkeeping().coin_counter_w(0, data & 0x10); // Coin1/3 counter
machine().bookkeeping().coin_counter_w(1, data & 0x20); // Coin2 counter
machine().bookkeeping().coin_counter_w(2, data & 0x08); // Payout pulse
}
/* Game waits for bit 7 (0x80) to be set.
This should be the /OBF line (PC7) from PPI-2 (handshake).
PC0-PC2 could be set as input or output.
*/
//uint8_t norautp_state::ppi2_portc_r()
//{
// return;
//}
//void norautp_state::ppi2_portc_w(uint8_t data)
//{
// // PC0-PC2 don't seems to be connected to any output
//}
void norautp_state::ppi2_obf_w(int state)
{
machine().scheduler().synchronize(timer_expired_delegate(FUNC(norautp_state::ppi2_ack), this), state);
}
TIMER_CALLBACK_MEMBER(norautp_state::ppi2_ack)
{
m_ppi8255[2]->pc6_w(param);
if (param == 0)
{
uint8_t const np_addr = m_ppi8255[2]->pb_r();
uint8_t const vram_data = m_ppi8255[2]->pa_r();
m_np_vram[np_addr] = vram_data;
}
}
#ifdef UNUSED_FUNCTION // old implementation
// game waits for /OBF signal (bit 7) to be set.
uint8_t norautp_state::test_r()
{
return 0xff;
}
uint8_t norautp_state::vram_data_r()
{
return m_np_vram[m_np_addr];
}
void norautp_state::vram_data_w(uint8_t data)
{
m_np_vram[m_np_addr] = data & 0xff;
// trigger 8255-2 port C bit 7 (/OBF)
// m_ppi8255_2->set_pc_bit(7, 0);
// m_ppi8255_2->set_pc_bit(7, 1);
}
void norautp_state::vram_addr_w(uint8_t data)
{
m_np_addr = data;
}
#endif
// game waits for bit 4 (0x10) to be reset.
uint8_t norautp_state::test2_r()
{
return 0x00;
}
/*********************************************
* Memory Map Information *
*********************************************/
/*
CPU & PPI settings by set...
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| Set | CPU | PPI-0 offset | config | PPI-1 offset | config | PPI-2 offset | config |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| norautp | Z80 | 0x60-0x63 | 0x90 | 0xA0-0xA3 | 0x92 | 0xC0-0xC3 | 0xC1 (PC0-2 as input) |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| norautdx | Z80 | 0x60-0x63 | 0x90 | 0xA0-0xA3 | 0x92 | 0xC0-0xC3 | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| norautpn | Z80 | 0x60-0x63 | 0x90 | 0xA0-0xA3 | 0x92 | 0xC0-0xC3 | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| norautjp | Z80 | 0x60-0x63 | 0x90 | 0xA0-0xA3 | 0x92 | 0xC0-0xC3 | 0xC1 (PC0-2 as input) |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| norautrh | Z80 | 0x60-0x63 | 0x90 | 0xA0-0xA3 | 0x92 | 0xC0-0xC3 | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| norautu | BOXED | 0x60-0x63 | 0x90 | 0xA0-0xA3 | 0x92 | 0xC0-0xC3 | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| norautv3 | Z80 | unknown | | unknown | | unknown | |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| pma | Z80 | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| bjpoker | Z80 | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| dphl | 8080 | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| dphla | 8080 | 0x60-0x63 | 0x90 | 0xA0-0xA3 | 0x92 | 0xC0-0xC3 | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| dphljp | 8080 | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| kimbldhl | 8080 | 0x60-0x63 | 0x90 | 0xA0-0xA3 | 0x92 | 0xC0-0xC3 | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| gtipoker | 8080 | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| smshilo | 8080 | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| tpoker2 | 8080 | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| drhl | 8080? | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| ssjkrpkr | 8080 | 0x60-0x63 | 0x90 | 0xA0-0xA3 | 0x92 | 0xC0-0xC3 | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| fastdrwp | 8080? | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| dphlunka | 8080? | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| dphlunkb | 8080? | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| pkii_dm | Z80? | 0x7C-0x7F | 0x90 | 0xBC-0xBF | 0x92 | 0xDC-0xDF | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
| cdrawpkr | Z80 | 0x70-0x73 | 0x90 | 0xB0-0xB3 | 0x92 | 0xD0-0xD3 | 0xC0 |
+----------+---------+--------------+--------+--------------+--------+--------------+------------------------+
*/
void norautp_state::norautp_map(address_map &map)
{
map.global_mask(0x3fff);
map(0x0000, 0x1fff).rom();
map(0x2000, 0x27ff).ram().share("nvram"); // 6116
}
void norautp_state::decrypted_opcodes_map(address_map &map)
{
map.global_mask(0x3fff);
map(0x0000, 0x1fff).rom().share(m_decrypted_opcodes);
}
void norautp_state::norautp_portmap(address_map &map)
{
map.global_mask(0xff);
map(0x60, 0x63).mirror(0x1c).rw("ppi8255_0", FUNC(i8255_device::read), FUNC(i8255_device::write));
map(0xa0, 0xa3).mirror(0x1c).rw("ppi8255_1", FUNC(i8255_device::read), FUNC(i8255_device::write));
map(0xc0, 0xc3).mirror(0x3c).rw("ppi8255_2", FUNC(i8255_device::read), FUNC(i8255_device::write));
//map(0xc0, 0xc0).mirror(0x3c).rw(FUNC(norautp_state::vram_data_r), FUNC(norautp_state::vram_data_w));
//map(0xc1, 0xc1).mirror(0x3c).w(FUNC(norautp_state::vram_addr_w));
//map(0xc2, 0xc2).mirror(0x3c).r(FUNC(norautp_state::test_r));
map(0xef, 0xef).r(FUNC(norautp_state::test2_r));
}
/*
Video RAM R/W:
c0 --> W ; data (hanshaked)
c1 --> W ; addressing
c2 --> R ; status (handshaking lines) + input (PC0-2)
c3 --> W ; PPI control + alternate 00 & 01 (PC1 out?)
PPI Mirror isn't accurate.
There are writes to 0xF7 and reads + compare to 0xEF.
Don't know what's supposed to be mirrored there.
*/
void norautp_state::nortest1_map(address_map &map)
{
map.global_mask(0x7fff);
map(0x0000, 0x2fff).rom();
map(0x5000, 0x57ff).ram().share("nvram");
}
void norautp_state::norautxp_map(address_map &map)
{
// map.global_mask(~0x4000);
map.global_mask(0x7fff);
map(0x0000, 0x3fff).rom(); // need to be checked
map(0x6000, 0x67ff).ram().share("nvram"); // HM6116
}
void norautp_state::norautx4_map(address_map &map)
{
map(0x0000, 0x3fff).rom();
map(0x6000, 0x67ff).ram().share("nvram"); // 6116
}
#ifdef UNUSED_CODE
void norautp_state::norautx8_map(address_map &map)
{
map(0x0000, 0x7fff).rom(); // need to be checked
map(0xc000, 0xc7ff).ram().share("nvram"); // 6116
}
#endif
void norautp_state::noraut3_map(address_map &map)
{
map(0x0000, 0x3fff).rom().region("maincpu", 0x4000);
map(0x6000, 0x67ff).ram().share("nvram"); // 6116
map(0x8000, 0xbfff).rom().region("maincpu", 0xc000);
}
void norautp_state::noraut3_decrypted_opcodes_map(address_map &map)
{
map(0x0000, 0x3fff).rom().region("maincpu", 0x0000);
map(0x8000, 0xbfff).rom().region("maincpu", 0x8000);
}
void norautp_state::kimble_map(address_map &map)
{
map(0x0000, 0xbfff).rom();
map(0xc000, 0xc7ff).ram().share("nvram");
map(0xc800, 0xc9ff).ram(); // working RAM?
}
#ifdef UNUSED_CODE
void norautp_state::norautxp_portmap(address_map &map)
{
map.global_mask(0xff);
}
#endif
void norautp_state::newhilop_map(address_map &map)
{
map(0x0000, 0x1fff).rom();
map(0xd000, 0xd7ff).ram().share("nvram"); // 6116
}
void norautp_state::cgidjp_map(address_map &map)
{
map.global_mask(0x3fff);
map(0x0000, 0x1fff).rom().region("maincpu", 0x2000);
map(0x2000, 0x27ff).ram().share("nvram"); // 6116
}
void norautp_state::cgidjp_opcodes_map(address_map &map)
{
map.global_mask(0x3fff);
map(0x0000, 0x1fff).rom().region("maincpu", 0);
}
/*************** 8080 based **************/
void norautp_state::dphl_map(address_map &map)
{
map.global_mask(0x7fff); // A15 not connected
map(0x0000, 0x3fff).rom();
map(0x5000, 0x53ff).ram().share("nvram"); // should be 2x 0x100 segments (4x 2111)
}
void norautp_state::dphla_map(address_map &map)
{
map.global_mask(0x3fff);
map(0x0000, 0x1fff).rom();
map(0x2000, 0x23ff).ram().share("nvram");
}
void norautp_state::ssjkrpkr_map(address_map &map)
{
map.global_mask(0x7fff);
map(0x0000, 0x1fff).rom();
map(0x4000, 0x43ff).ram().share("nvram");
}
void norautp_state::dphltest_map(address_map &map)