1 /***************************************************************************
2
3 Cinematronics Embargo driver
4
5 ***************************************************************************/
6
7 #include "driver.h"
8 #include "cpu/s2650/s2650.h"
9 #include "vidhrdw/generic.h"
10
11 static int dial_enable_1;
12 static int dial_enable_2;
13
14 static int input_select;
15
16
17
VIDEO_UPDATE(embargo)18 static VIDEO_UPDATE( embargo )
19 {
20 copybitmap(bitmap, tmpbitmap, 0, 0, 0, 0, cliprect, TRANSPARENCY_NONE, 0);
21 }
22
23
WRITE_HANDLER(embargo_videoram_w)24 static WRITE_HANDLER( embargo_videoram_w )
25 {
26 int col = offset % 32;
27 int row = offset / 32;
28
29 int i;
30
31 for (i = 0; i < 8; i++)
32 {
33 plot_pixel(tmpbitmap, 8 * col + i, row, (data >> i) & 1);
34 }
35
36 videoram[offset] = data;
37 }
38
39
READ_HANDLER(embargo_input_r)40 static READ_HANDLER( embargo_input_r )
41 {
42 return (readinputport(1) << (7 - input_select)) & 0x80;
43 }
44
45
READ_HANDLER(embargo_dial_r)46 static READ_HANDLER( embargo_dial_r )
47 {
48 UINT8 lo = 0;
49 UINT8 hi = 0;
50
51 UINT8 mapped_lo = 0;
52 UINT8 mapped_hi = 0;
53
54 int i;
55
56 /* game reads 4 bits per dial and maps them onto clock directions */
57
58 static const UINT8 map[] =
59 {
60 0x0, 0xB, 0x1, 0x2, 0x4, 0x4, 0x2, 0x3,
61 0x9, 0xA, 0x8, 0x9, 0x8, 0x5, 0x7, 0x6
62 };
63
64 if (dial_enable_1 && !dial_enable_2)
65 {
66 lo = readinputport(3);
67 hi = readinputport(4);
68 }
69 if (dial_enable_2 && !dial_enable_1)
70 {
71 lo = readinputport(5);
72 hi = readinputport(6);
73 }
74
75 lo = 12 * lo / 256;
76 hi = 12 * hi / 256;
77
78 for (i = 0; i < 16; i++)
79 {
80 if (map[i] == lo)
81 {
82 mapped_lo = i;
83 }
84 if (map[i] == hi)
85 {
86 mapped_hi = i;
87 }
88 }
89
90 return 16 * mapped_hi + mapped_lo;
91 }
92
93
WRITE_HANDLER(embargo_port1_w)94 static WRITE_HANDLER( embargo_port1_w )
95 {
96 dial_enable_1 = data & 1; /* other bits unknown */
97 }
WRITE_HANDLER(embargo_port2_w)98 static WRITE_HANDLER( embargo_port2_w )
99 {
100 dial_enable_2 = data & 1; /* other bits unknown */
101 }
102
103
WRITE_HANDLER(embargo_input_w)104 static WRITE_HANDLER( embargo_input_w )
105 {
106 input_select = data & 7;
107 }
108
109
MEMORY_READ_START(readmem)110 static MEMORY_READ_START( readmem )
111 { 0x0000, 0x0fff, MRA_ROM },
112 { 0x1e00, 0x3dff, MRA_RAM },
113 MEMORY_END
114
115
116 static MEMORY_WRITE_START( writemem )
117 { 0x0000, 0x0fff, MWA_ROM },
118 { 0x1e00, 0x1fff, MWA_RAM },
119 { 0x2000, 0x3dff, embargo_videoram_w, &videoram, &videoram_size },
120 MEMORY_END
121
122
123 static PORT_READ_START( readport )
124 { 0x01, 0x01, input_port_0_r },
125 { 0x02, 0x02, embargo_dial_r },
126 { S2650_DATA_PORT, S2650_DATA_PORT, input_port_2_r },
127 { S2650_CTRL_PORT, S2650_CTRL_PORT, embargo_input_r },
128 PORT_END
129
130
131 static PORT_WRITE_START( writeport )
132 { 0x01, 0x01, embargo_port1_w },
133 { 0x02, 0x02, embargo_port2_w },
134 { 0x03, 0x03, IOWP_NOP }, /* always 0xFE */
135 { S2650_CTRL_PORT, S2650_CTRL_PORT, embargo_input_w },
136 PORT_END
137
138
139 INPUT_PORTS_START( embargo )
140
141 PORT_START /* port 0x01 */
142 PORT_DIPNAME( 0x03, 0x00, "Rounds" )
143 PORT_DIPSETTING( 0x00, "3" )
144 PORT_DIPSETTING( 0x01, "4" )
145 PORT_DIPSETTING( 0x02, "5" )
146 PORT_DIPSETTING( 0x03, "6" )
147
148 PORT_START /* S2650_CONTROL_PORT */
149 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
150 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
151 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3 )
152 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4 )
153 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
154 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
155 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
156 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
157
158 PORT_START /* S2650_DATA_PORT */
159 PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 )
160
161 PORT_START
162 PORT_ANALOG( 0xff, 0x80, IPT_DIAL | IPF_PLAYER1, 50, 8, 0, 0 )
163 PORT_START
164 PORT_ANALOG( 0xff, 0x80, IPT_DIAL | IPF_PLAYER2, 50, 8, 0, 0 )
165 PORT_START
166 PORT_ANALOG( 0xff, 0x80, IPT_DIAL | IPF_PLAYER3, 50, 8, 0, 0 )
167 PORT_START
168 PORT_ANALOG( 0xff, 0x80, IPT_DIAL | IPF_PLAYER4, 50, 8, 0, 0 )
169
170 INPUT_PORTS_END
171
172
173 static MACHINE_DRIVER_START( embargo )
174
175 /* basic machine hardware */
176 MDRV_CPU_ADD(S2650, 625000)
177 MDRV_CPU_MEMORY(readmem, writemem)
178 MDRV_CPU_PORTS(readport, writeport)
179
180 MDRV_FRAMES_PER_SECOND(60)
181
182 /* video hardware */
183 MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
184 MDRV_SCREEN_SIZE(256, 256)
185 MDRV_VISIBLE_AREA(0, 255, 0, 239)
186 MDRV_PALETTE_LENGTH(2)
187
188 MDRV_PALETTE_INIT(black_and_white)
189 MDRV_VIDEO_START(generic_bitmapped)
190 MDRV_VIDEO_UPDATE(embargo)
191
192 /* sound hardware */
193 MACHINE_DRIVER_END
194
195
196 ROM_START( embargo )
197 ROM_REGION( 0x8000, REGION_CPU1, 0 )
198 ROM_LOAD( "emb1", 0x0000, 0x0200, CRC(00dcbc24) SHA1(67018a20d7694618123499640f041fb518ea29fa) )
199 ROM_LOAD( "emb2", 0x0200, 0x0200, CRC(e7069b11) SHA1(b933095087cd4fe10f12fd244606aaaed1c31bca) )
200 ROM_LOAD( "emb3", 0x0400, 0x0200, CRC(1af7a966) SHA1(a8f6d1063927106f44c43f64c26b52c07c5450df) )
201 ROM_LOAD( "emb4", 0x0600, 0x0200, CRC(d9c75da0) SHA1(895784ec543f1c73ced5f37751a26cb3305030f3) )
202 ROM_LOAD( "emb5", 0x0800, 0x0200, CRC(15960b58) SHA1(2e6c196b240cef92799f83deef2b1c501c01f9c9) )
203 ROM_LOAD( "emb6", 0x0a00, 0x0200, CRC(7ba23058) SHA1(ad3736ec7617ecb902ea686055e55203be1ea5fd) )
204 ROM_LOAD( "emb7", 0x0c00, 0x0200, CRC(6d46a593) SHA1(5432ae1c167e774c47f06ffd0e8acf801891dee1) )
205 ROM_LOAD( "emb8", 0x0e00, 0x0200, CRC(f0b00634) SHA1(317aacc9022596a2af0f3b399fe119fe9c8c1679) )
206 ROM_END
207
208
209 GAMEX( 1977, embargo, 0, embargo, embargo, 0, ROT0, "Cinematronics", "Embargo", GAME_NO_SOUND )
210