1 // license:BSD-3-Clause
2 // copyright-holders:Roberto Fresca
3 /********************************************************************************
4
5
6 AMERICAN POKER 2 - VIDEO HARDWARE
7 ---------------------------------
8
9 Company: Novomatic.
10 Year: 1990.
11
12 Driver by Roberto Fresca, with a lot of help of Grull Osgo.
13 Based on a preliminary work of Curt Coder.
14
15
16 --- Supported Sets ---
17
18 Set Name | Relation | Description
19 ---------+----------+------------------------------------
20 ampoker2 | parent | American Poker II.
21 ampkr2b1 | clone | American Poker II (bootleg, set 1).
22 ampkr2b2 | clone | American Poker II (bootleg, set 2).
23 ampkr2b3 | clone | American Poker II (bootleg, set 3).
24 ampkr228 | clone | American Poker II (iamp2 v28).
25 pkrdewin | clone | Poker De Win.
26 ampkr95 | clone | American Poker 95.
27 videomat | clone | Videomat (polish bootleg).
28 rabbitpk | clone | Rabbit Poker / Arizona Poker 1.1? (with PIC)
29 sigmapkr | parent | Sigma Poker.
30 sigma2k | parent | Sigma Poker 2000.
31 arizna10 | clone | Arizona Poker 1.1? (with PIC)
32
33
34 *********************************************************************************
35
36
37 Resistor Network
38 ----------------
39
40 The following diagram is related to taiwanese and argentine PCBs.
41
42
43 82S147AN
44 +---------+
45 | | 470
46 | O1-Pin06|---/\/\/\----+---> BLUE
47 | | 220 |
48 | O2-Pin07|---/\/\/\----+
49 | | 1K
50 | O3-Pin08|---/\/\/\----+---> GREEN
51 | | 470 |
52 | O4-Pin09|---/\/\/\----+
53 | | 220 |
54 | O5-Pin11|---/\/\/\----+
55 | | 1K
56 | O6-Pin12|---/\/\/\----+---> RED
57 | | 470 |
58 | O7-Pin13|---/\/\/\----+
59 | | 220 |
60 | O8-Pin14|---/\/\/\----+
61 | |
62 +---------+
63
64
65 All colors are directly routed to the edge connector.
66 There are not pull-up or pull-down resistors.
67
68
69 ********************************************************************************/
70
71
72 #include "emu.h"
73 #include "includes/ampoker2.h"
74
75 #include "video/resnet.h"
76
77
ampoker2_palette(palette_device & palette) const78 void ampoker2_state::ampoker2_palette(palette_device &palette) const
79 {
80 /* - bits -
81 76543210
82 RRRGGGBB
83 */
84 static constexpr int resistances_rg[3] = { 1000, 470, 220 };
85 static constexpr int resistances_b [2] = { 470, 220 };
86
87 double weights_r[3], weights_g[3], weights_b[2];
88 compute_resistor_weights(0, 255, -1.0,
89 3, resistances_rg, weights_r, 0, 0,
90 3, resistances_rg, weights_g, 0, 0,
91 2, resistances_b, weights_b, 0, 0);
92
93
94 uint8_t const *const color_prom = memregion("proms")->base();
95 for (int i = 0; i < palette.entries(); i++)
96 {
97 int bit0, bit1, bit2;
98
99 // blue component
100 bit0 = BIT(color_prom[i], 0);
101 bit1 = BIT(color_prom[i], 1);
102 int const b = combine_weights(weights_b, bit0, bit1);
103
104 // green component
105 bit0 = BIT(color_prom[i], 2);
106 bit1 = BIT(color_prom[i], 3);
107 bit2 = BIT(color_prom[i], 4);
108 int const g = combine_weights(weights_g, bit0, bit1, bit2);
109
110 // red component
111 bit0 = BIT(color_prom[i], 5);
112 bit1 = BIT(color_prom[i], 6);
113 bit2 = BIT(color_prom[i], 7);
114 int const r = combine_weights(weights_r, bit0, bit1, bit2);
115
116 palette.set_pen_color(i, rgb_t(r, g, b));
117 }
118 }
119
videoram_w(offs_t offset,uint8_t data)120 void ampoker2_state::videoram_w(offs_t offset, uint8_t data)
121 {
122 m_videoram[offset] = data;
123 m_bg_tilemap->mark_tile_dirty(offset / 2);
124 }
125
TILE_GET_INFO_MEMBER(ampoker2_state::get_bg_tile_info)126 TILE_GET_INFO_MEMBER(ampoker2_state::get_bg_tile_info)
127 {
128 int offs = tile_index * 2;
129 int attr = m_videoram[offs + 1];
130 int code = m_videoram[offs];
131 int color = attr;
132 code = code + (256 * (color & 0x03)); /* code = color.bit1 + color.bit0 + code */
133 color = color >> 1; /* color = color - bit0 (bit1..bit7) */
134
135 tileinfo.set(0, code, color, 0);
136 }
137
TILE_GET_INFO_MEMBER(ampoker2_state::s2k_get_bg_tile_info)138 TILE_GET_INFO_MEMBER(ampoker2_state::s2k_get_bg_tile_info)
139 {
140 int offs = tile_index * 2;
141 int attr = m_videoram[offs + 1];
142 int code = m_videoram[offs];
143 int color = attr;
144 code = code + (256 * (color & 0x0f)); /* the game uses 2 extra bits */
145 color = color >> 1;
146
147 tileinfo.set(0, code, color, 0);
148 }
149
video_start()150 void ampoker2_state::video_start()
151 {
152 m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ampoker2_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS,
153 8, 8, 64, 32);
154 }
155
VIDEO_START_MEMBER(ampoker2_state,sigma2k)156 VIDEO_START_MEMBER(ampoker2_state,sigma2k)
157 {
158 m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ampoker2_state::s2k_get_bg_tile_info)), TILEMAP_SCAN_ROWS,
159 8, 8, 64, 32);
160 }
161
screen_update(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)162 uint32_t ampoker2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
163 {
164 m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
165 return 0;
166 }
167