1 /***************************************************************************
2 
3 Popeye  (c) 1982 Nintendo
4 
5 driver by Marc Lafontaine
6 
7 To enter service mode, reset keeping the service button pressed.
8 
9 Notes:
10 - The main set has a protection device mapped at E000/E001. The second set
11   (which is the same revision of the program code) has the protection disabled
12   in a very clean way, so I don't know if it's an original (without the
13   protection device to save costs), or a very well done bootleg.
14 - The bootleg derives from a different revision of the program code which we
15   don't have.
16 
17 ***************************************************************************/
18 
19 #include "driver.h"
20 #include "vidhrdw/generic.h"
21 #include "cpu/z80/z80.h"
22 
23 
24 extern UINT8 *popeye_background_pos;
25 extern UINT8 *popeye_palettebank;
26 
27 extern WRITE_HANDLER( popeye_videoram_w );
28 extern WRITE_HANDLER( popeye_colorram_w );
29 extern WRITE_HANDLER( popeye_backgroundram_w );
30 extern WRITE_HANDLER( popeye_bitmap_w );
31 extern WRITE_HANDLER( skyskipr_bitmap_w );
32 
33 extern PALETTE_INIT( popeye );
34 extern PALETTE_INIT( popeyebl );
35 extern VIDEO_START( skyskipr );
36 extern VIDEO_START( popeye );
37 extern VIDEO_UPDATE( popeye );
38 
39 
40 
INTERRUPT_GEN(popeye_interrupt)41 static INTERRUPT_GEN( popeye_interrupt )
42 {
43 	/* NMIs are enabled by the I register?? How can that be? */
44 	if (activecpu_get_reg(Z80_I) & 1)	/* skyskipr: 0/1, popeye: 2/3 but also 0/1 */
45 		cpu_set_nmi_line(0, PULSE_LINE);
46 }
47 
48 
49 /* the protection device simply returns the last two values written shifted left */
50 /* by a variable amount. */
51 static int prot0,prot1,prot_shift;
52 
READ_HANDLER(protection_r)53 static READ_HANDLER( protection_r )
54 {
55 	if (offset == 0)
56 	{
57 		return ((prot1 << prot_shift) | (prot0 >> (8-prot_shift))) & 0xff;
58 	}
59 	else	/* offset == 1 */
60 	{
61 		/* the game just checks if bit 2 is clear. Returning 0 seems to be enough. */
62 		return 0;
63 	}
64 }
65 
WRITE_HANDLER(protection_w)66 static WRITE_HANDLER( protection_w )
67 {
68 	if (offset == 0)
69 	{
70 		/* this is the same as the level number (1-3) */
71 		prot_shift = data & 0x07;
72 	}
73 	else	/* offset == 1 */
74 	{
75 		prot0 = prot1;
76 		prot1 = data;
77 	}
78 }
79 
80 
81 
82 
MEMORY_READ_START(skyskipr_readmem)83 static MEMORY_READ_START( skyskipr_readmem )
84 	{ 0x0000, 0x7fff, MRA_ROM },
85 	{ 0x8000, 0x87ff, MRA_RAM },
86 	{ 0x8c00, 0x8e7f, MRA_RAM },
87 	{ 0x8e80, 0x8fff, MRA_RAM },
88 	{ 0xe000, 0xe001, protection_r },
89 MEMORY_END
90 
91 static MEMORY_WRITE_START( skyskipr_writemem )
92 	{ 0x0000, 0x7fff, MWA_ROM },
93 	{ 0x8000, 0x87ff, MWA_RAM },
94 	{ 0x8c00, 0x8c02, MWA_RAM, &popeye_background_pos },
95 	{ 0x8c03, 0x8c03, MWA_RAM, &popeye_palettebank },
96 	{ 0x8c04, 0x8e7f, MWA_RAM, &spriteram, &spriteram_size },
97 	{ 0x8e80, 0x8fff, MWA_RAM },
98 	{ 0xa000, 0xa3ff, popeye_videoram_w, &videoram },
99 	{ 0xa400, 0xa7ff, popeye_colorram_w, &colorram },
100 	{ 0xc000, 0xcfff, skyskipr_bitmap_w },
101 	{ 0xe000, 0xe001, protection_w },
102 MEMORY_END
103 
104 static MEMORY_READ_START( popeye_readmem )
105 	{ 0x0000, 0x7fff, MRA_ROM },
106 	{ 0x8000, 0x87ff, MRA_RAM },
107 	{ 0x8800, 0x8bff, MRA_RAM },
108 	{ 0x8c00, 0x8e7f, MRA_RAM },
109 	{ 0x8e80, 0x8fff, MRA_RAM },
110 	{ 0xe000, 0xe001, protection_r },
111 MEMORY_END
112 
113 static MEMORY_WRITE_START( popeye_writemem )
114 	{ 0x0000, 0x7fff, MWA_ROM },
115 	{ 0x8000, 0x87ff, MWA_RAM },
116 	{ 0x8800, 0x8bff, MWA_RAM },
117 	{ 0x8c00, 0x8c02, MWA_RAM, &popeye_background_pos },
118 	{ 0x8c03, 0x8c03, MWA_RAM, &popeye_palettebank },
119 	{ 0x8c04, 0x8e7f, MWA_RAM, &spriteram, &spriteram_size },
120 	{ 0x8e80, 0x8fff, MWA_RAM },
121 	{ 0xa000, 0xa3ff, popeye_videoram_w, &videoram },
122 	{ 0xa400, 0xa7ff, popeye_colorram_w, &colorram },
123 	{ 0xc000, 0xdfff, popeye_bitmap_w },
124 	{ 0xe000, 0xe001, protection_w },
125 MEMORY_END
126 
127 static MEMORY_READ_START( popeyebl_readmem )
128 	{ 0x0000, 0x7fff, MRA_ROM },
129 	{ 0x8000, 0x87ff, MRA_RAM },
130 	{ 0x8c00, 0x8e7f, MRA_RAM },
131 	{ 0x8e80, 0x8fff, MRA_RAM },
132 	{ 0xe000, 0xe01f, MRA_ROM },
133 MEMORY_END
134 
135 static MEMORY_WRITE_START( popeyebl_writemem )
136 	{ 0x0000, 0x7fff, MWA_ROM },
137 	{ 0x8000, 0x87ff, MWA_RAM },
138 	{ 0x8c00, 0x8c02, MWA_RAM, &popeye_background_pos },
139 	{ 0x8c03, 0x8c03, MWA_RAM, &popeye_palettebank },
140 	{ 0x8c04, 0x8e7f, MWA_RAM, &spriteram, &spriteram_size },
141 	{ 0x8e80, 0x8fff, MWA_RAM },
142 	{ 0xa000, 0xa3ff, popeye_videoram_w, &videoram },
143 	{ 0xa400, 0xa7ff, popeye_colorram_w, &colorram },
144 	{ 0xc000, 0xcfff, skyskipr_bitmap_w },
145 	{ 0xe000, 0xe01f, MWA_ROM },
146 MEMORY_END
147 
148 
149 static PORT_READ_START( readport )
150 	{ 0x00, 0x00, input_port_0_r },
151 	{ 0x01, 0x01, input_port_1_r },
152 	{ 0x02, 0x02, input_port_2_r },
153 	{ 0x03, 0x03, AY8910_read_port_0_r },
154 PORT_END
155 
156 static PORT_WRITE_START( writeport )
157 	{ 0x00, 0x00, AY8910_control_port_0_w },
158 	{ 0x01, 0x01, AY8910_write_port_0_w },
159 PORT_END
160 
161 
162 
163 INPUT_PORTS_START( skyskipr )
164 	PORT_START	/* IN0 */
165 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
166 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY )
167 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY )
168 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY )
169 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
170 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
171 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
172 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 )
173 
174 	PORT_START	/* IN1 */
175 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
176 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
177 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
178 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
179 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
180 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
181 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
182 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
183 
184 	PORT_START	/* IN2 */
185 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
186 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
187 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
188 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
189 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
190 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
191 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SERVICE1 )
192 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
193 
194 	PORT_START	/* DSW0 */
195 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) )
196 	PORT_DIPSETTING(    0x03, "A 3/1 B 1/2" )
197 	PORT_DIPSETTING(    0x0e, DEF_STR( 2C_1C ) )
198 	PORT_DIPSETTING(    0x01, "A 2/1 B 2/5" )
199 	PORT_DIPSETTING(    0x04, "A 2/1 B 1/3" )
200 	PORT_DIPSETTING(    0x07, "A 1/1 B 2/1" )
201 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
202 	PORT_DIPSETTING(    0x0c, "A 1/1 B 1/2" )
203 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_2C ) )
204 	PORT_DIPSETTING(    0x06, "A 1/2 B 1/4" )
205 	PORT_DIPSETTING(    0x0b, "A 1/2 B 1/5" )
206 	PORT_DIPSETTING(    0x02, "A 2/5 B 1/1" )
207 	PORT_DIPSETTING(    0x0a, "A 1/3 B 1/1" )
208 	PORT_DIPSETTING(    0x09, "A 1/4 B 1/1" )
209 	PORT_DIPSETTING(    0x05, "A 1/5 B 1/1" )
210 	PORT_DIPSETTING(    0x08, "A 1/6 B 1/1" )
211 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
212 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
213 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
214 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
215 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
216 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
217 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
218 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
219 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
220 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
221 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* scans DSW1 one bit at a time */
222 
223 	PORT_START	/* DSW1 (FAKE - appears as bit 7 of DSW0, see code below) */
224 	PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
225 	PORT_DIPSETTING(    0x03, "1" )
226 	PORT_DIPSETTING(    0x02, "2" )
227 	PORT_DIPSETTING(    0x01, "3" )
228 	PORT_DIPSETTING(    0x00, "4" )
229 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
230 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
231 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
232 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
233 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
234 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
235 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
236 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
237 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
238 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Bonus_Life ) )
239 	PORT_DIPSETTING(    0x20, "15000" )
240 	PORT_DIPSETTING(    0x00, "30000" )
241 	PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
242 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
243 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
244 	PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
245 INPUT_PORTS_END
246 
247 
248 INPUT_PORTS_START( popeye )
249 	PORT_START	/* IN0 */
250 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
251 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY )
252 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY )
253 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY )
254 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
255 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
256 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
257 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
258 
259 	PORT_START	/* IN1 */
260 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
261 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
262 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
263 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
264 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
265 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
266 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
267 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
268 
269 	PORT_START	/* IN2 */
270 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
271 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
272 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
273 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
274 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
275 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
276 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SERVICE1 )
277 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
278 
279 	PORT_START	/* DSW0 */
280 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) )
281 	PORT_DIPSETTING(    0x03, "A 3/1 B 1/2" )
282 	PORT_DIPSETTING(    0x0e, DEF_STR( 2C_1C ) )
283 	PORT_DIPSETTING(    0x01, "A 2/1 B 2/5" )
284 	PORT_DIPSETTING(    0x04, "A 2/1 B 1/3" )
285 	PORT_DIPSETTING(    0x07, "A 1/1 B 2/1" )
286 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
287 	PORT_DIPSETTING(    0x0c, "A 1/1 B 1/2" )
288 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_2C ) )
289 	PORT_DIPSETTING(    0x06, "A 1/2 B 1/4" )
290 	PORT_DIPSETTING(    0x0b, "A 1/2 B 1/5" )
291 	PORT_DIPSETTING(    0x02, "A 2/5 B 1/1" )
292 	PORT_DIPSETTING(    0x0a, "A 1/3 B 1/1" )
293 	PORT_DIPSETTING(    0x09, "A 1/4 B 1/1" )
294 	PORT_DIPSETTING(    0x05, "A 1/5 B 1/1" )
295 	PORT_DIPSETTING(    0x08, "A 1/6 B 1/1" )
296 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
297 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
298 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
299 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
300 	PORT_DIPNAME( 0x60, 0x40, "Copyright" )
301 	PORT_DIPSETTING(    0x40, "Nintendo" )
302 	PORT_DIPSETTING(    0x20, "Nintendo Co.,Ltd" )
303 	PORT_DIPSETTING(    0x60, "Nintendo of America" )
304 //	PORT_DIPSETTING(    0x00, "Nintendo of America" )
305 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* scans DSW1 one bit at a time */
306 
307 	PORT_START	/* DSW1 (FAKE - appears as bit 7 of DSW0, see code below) */
308 	PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
309 	PORT_DIPSETTING(    0x03, "1" )
310 	PORT_DIPSETTING(    0x02, "2" )
311 	PORT_DIPSETTING(    0x01, "3" )
312 	PORT_DIPSETTING(    0x00, "4" )
313 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
314 	PORT_DIPSETTING(    0x0c, "Easy" )
315 	PORT_DIPSETTING(    0x08, "Medium" )
316 	PORT_DIPSETTING(    0x04, "Hard" )
317 	PORT_DIPSETTING(    0x00, "Hardest" )
318 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) )
319 	PORT_DIPSETTING(    0x30, "40000" )
320 	PORT_DIPSETTING(    0x20, "60000" )
321 	PORT_DIPSETTING(    0x10, "80000" )
322 	PORT_DIPSETTING(    0x00, "None" )
323 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
324 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
325 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
326 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
327 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
328 	PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
329 INPUT_PORTS_END
330 
331 
332 INPUT_PORTS_START( popeyef )
333 	PORT_START	/* IN0 */
334 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
335 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY )
336 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY )
337 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY )
338 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
339 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
340 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
341 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
342 
343 	PORT_START	/* IN1 */
344 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
345 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
346 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
347 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
348 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
349 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
350 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
351 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
352 
353 	PORT_START	/* IN2 */
354 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
355 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
356 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
357 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
358 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* probably unused */
359 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
360 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SERVICE1 )
361 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
362 
363 	PORT_START	/* DSW0 */
364 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) )
365 	PORT_DIPSETTING(    0x03, "A 3/1 B 1/2" )
366 	PORT_DIPSETTING(    0x0e, DEF_STR( 2C_1C ) )
367 	PORT_DIPSETTING(    0x01, "A 2/1 B 2/5" )
368 	PORT_DIPSETTING(    0x04, "A 2/1 B 1/3" )
369 	PORT_DIPSETTING(    0x07, "A 1/1 B 2/1" )
370 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
371 	PORT_DIPSETTING(    0x0c, "A 1/1 B 1/2" )
372 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_2C ) )
373 	PORT_DIPSETTING(    0x06, "A 1/2 B 1/4" )
374 	PORT_DIPSETTING(    0x0b, "A 1/2 B 1/5" )
375 	PORT_DIPSETTING(    0x02, "A 2/5 B 1/1" )
376 	PORT_DIPSETTING(    0x0a, "A 1/3 B 1/1" )
377 	PORT_DIPSETTING(    0x09, "A 1/4 B 1/1" )
378 	PORT_DIPSETTING(    0x05, "A 1/5 B 1/1" )
379 	PORT_DIPSETTING(    0x08, "A 1/6 B 1/1" )
380 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
381 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
382 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
383 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
384 	PORT_DIPNAME( 0x60, 0x40, "Copyright" )
385 	PORT_DIPSETTING(    0x40, "Nintendo" )
386 	PORT_DIPSETTING(    0x20, "Nintendo Co.,Ltd" )
387 	PORT_DIPSETTING(    0x60, "Nintendo of America" )
388 //	PORT_DIPSETTING(    0x00, "Nintendo of America" )
389 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )	/* scans DSW1 one bit at a time */
390 
391 	PORT_START	/* DSW1 (FAKE - appears as bit 7 of DSW0, see code below) */
392 	PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
393 	PORT_DIPSETTING(    0x03, "1" )
394 	PORT_DIPSETTING(    0x02, "2" )
395 	PORT_DIPSETTING(    0x01, "3" )
396 	PORT_DIPSETTING(    0x00, "4" )
397 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
398 	PORT_DIPSETTING(    0x0c, "Easy" )
399 	PORT_DIPSETTING(    0x08, "Medium" )
400 	PORT_DIPSETTING(    0x04, "Hard" )
401 	PORT_DIPSETTING(    0x00, "Hardest" )
402 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) )
403 	PORT_DIPSETTING(    0x30, "20000" )
404 	PORT_DIPSETTING(    0x20, "30000" )
405 	PORT_DIPSETTING(    0x10, "50000" )
406 	PORT_DIPSETTING(    0x00, "None" )
407 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
408 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
409 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
410 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
411 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
412 	PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
413 INPUT_PORTS_END
414 
415 
416 static struct GfxLayout charlayout =
417 {
418 	16,16,	/* 16*16 characters (8*8 doubled) */
419 	RGN_FRAC(1,1),
420 	1,
421 	{ 0 },
422 	{ 7,7, 6,6, 5,5, 4,4, 3,3, 2,2, 1,1, 0,0 },
423 	{ 0*8,0*8, 1*8,1*8, 2*8,2*8, 3*8,3*8, 4*8,4*8, 5*8,5*8, 6*8,6*8, 7*8,7*8 },
424 	8*8
425 };
426 
427 static struct GfxLayout spritelayout =
428 {
429 	16,16,
430 	RGN_FRAC(1,4),
431 	2,
432 	{ 0, RGN_FRAC(1,2) },
433 	{RGN_FRAC(1,4)+7,RGN_FRAC(1,4)+6,RGN_FRAC(1,4)+5,RGN_FRAC(1,4)+4,
434 	 RGN_FRAC(1,4)+3,RGN_FRAC(1,4)+2,RGN_FRAC(1,4)+1,RGN_FRAC(1,4)+0,
435 	 7,6,5,4,3,2,1,0 },
436 	{ 15*8, 14*8, 13*8, 12*8, 11*8, 10*8, 9*8, 8*8,
437 	  7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8, },
438 	16*8
439 };
440 
441 static struct GfxDecodeInfo gfxdecodeinfo[] =
442 {
443 	{ REGION_GFX1, 0, &charlayout,      0, 16 },	/* chars */
444 	{ REGION_GFX2, 0, &spritelayout, 16*2, 64 },	/* sprites */
445 	{ -1 } /* end of array */
446 };
447 
448 
449 
450 static int dswbit;
451 
WRITE_HANDLER(popeye_portB_w)452 static WRITE_HANDLER( popeye_portB_w )
453 {
454 	/* bit 0 flips screen */
455 	flip_screen_set(data & 1);
456 
457 	/* bits 1-3 select DSW1 bit to read */
458 	dswbit = (data & 0x0e) >> 1;
459 }
460 
READ_HANDLER(popeye_portA_r)461 static READ_HANDLER( popeye_portA_r )
462 {
463 	int res;
464 
465 
466 	res = input_port_3_r(offset);
467 	res |= (input_port_4_r(offset) << (7-dswbit)) & 0x80;
468 
469 	return res;
470 }
471 
472 static struct AY8910interface ay8910_interface =
473 {
474 	1,	/* 1 chip */
475 	8000000/4,	/* 2 MHz */
476 	{ 40 },
477 	{ popeye_portA_r },
478 	{ 0 },
479 	{ 0 },
480 	{ popeye_portB_w }
481 };
482 
483 
484 
485 static MACHINE_DRIVER_START( skyskipr )
486 	/* basic machine hardware */
487 	MDRV_CPU_ADD_TAG("main", Z80, 8000000/2)	/* 4 MHz */
MDRV_CPU_MEMORY(skyskipr_readmem,skyskipr_writemem)488 	MDRV_CPU_MEMORY(skyskipr_readmem,skyskipr_writemem)
489 	MDRV_CPU_PORTS(readport,writeport)
490 	MDRV_CPU_VBLANK_INT(popeye_interrupt,1)
491 
492 	MDRV_FRAMES_PER_SECOND(60)
493 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
494 
495 	/* video hardware */
496 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
497 	MDRV_SCREEN_SIZE(32*16, 32*16)
498 	MDRV_VISIBLE_AREA(0*16, 32*16-1, 2*16, 30*16-1)
499 	MDRV_GFXDECODE(gfxdecodeinfo)
500 	MDRV_PALETTE_LENGTH(16+16+256)
501 	MDRV_COLORTABLE_LENGTH(16*2+64*4)
502 
503 	MDRV_PALETTE_INIT(popeye)
504 	MDRV_VIDEO_START(skyskipr)
505 	MDRV_VIDEO_UPDATE(popeye)
506 
507 	/* sound hardware */
508 	MDRV_SOUND_ADD(AY8910, ay8910_interface)
509 MACHINE_DRIVER_END
510 
511 
512 static MACHINE_DRIVER_START( popeye )
513 	MDRV_IMPORT_FROM(skyskipr)
514 	MDRV_CPU_MODIFY("main")
515 	MDRV_CPU_MEMORY(popeye_readmem,popeye_writemem)
516 
517 	MDRV_VIDEO_START(popeye)
518 MACHINE_DRIVER_END
519 
520 
521 static MACHINE_DRIVER_START( popeyebl )
522 	MDRV_IMPORT_FROM(skyskipr)
523 	MDRV_CPU_MODIFY("main")
524 	MDRV_CPU_MEMORY(popeyebl_readmem,popeyebl_writemem)
525 
526 	MDRV_PALETTE_INIT(popeyebl)
527 	MDRV_VIDEO_START(popeye)
528 MACHINE_DRIVER_END
529 
530 
531 
532 /***************************************************************************
533 
534   Game driver(s)
535 
536 ***************************************************************************/
537 
538 ROM_START( skyskipr )
539 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
540 	ROM_LOAD( "tnx1-c.2a",    0x0000, 0x1000, CRC(bdc7f218) SHA1(9a5f5959b9228912f810568ddad70daa81c4daac) )
541 	ROM_LOAD( "tnx1-c.2b",    0x1000, 0x1000, CRC(cbe601a8) SHA1(78edc384b75b7958906f887d11eb7cf235d6dc44) )
542 	ROM_LOAD( "tnx1-c.2c",    0x2000, 0x1000, CRC(5ca79abf) SHA1(0712364ad8785a146c4a146cc688c4892dd59c93) )
543 	ROM_LOAD( "tnx1-c.2d",    0x3000, 0x1000, CRC(6b7a7071) SHA1(949a8106a5b750bc15a5919786fb99f15cd9424e) )
544 	ROM_LOAD( "tnx1-c.2e",    0x4000, 0x1000, CRC(6b0c0525) SHA1(e4e12ea9e3140736d7543a274f3b266e58059356) )
545 	ROM_LOAD( "tnx1-c.2f",    0x5000, 0x1000, CRC(d1712424) SHA1(2de42c379f18bfbd68fc64db24c9b0d38de26c29) )
546 	ROM_LOAD( "tnx1-c.2g",    0x6000, 0x1000, CRC(8b33c4cf) SHA1(86d51b5098dffc69330b28662b04bd906d962792) )
547 	/* 7000-7fff empty */
548 
549 	ROM_REGION( 0x0800, REGION_GFX1, ROMREGION_DISPOSE )
550 	ROM_LOAD( "tnx1-v.3h",    0x0000, 0x0800, CRC(ecb6a046) SHA1(7fd2312d39fefe6237699e2916e0c313165755ad) )
551 
552 	ROM_REGION( 0x4000, REGION_GFX2, ROMREGION_DISPOSE )
553 	ROM_LOAD( "tnx1-t.1e",    0x0000, 0x1000, CRC(01c1120e) SHA1(c1ab2af9c582e647e98836a87cb09fe4bcdaf19f) )
554 	ROM_LOAD( "tnx1-t.2e",    0x1000, 0x1000, CRC(70292a71) SHA1(51a5677351e438e7ef2b3812ef5e0e610da6ef4d) )
555 	ROM_LOAD( "tnx1-t.3e",    0x2000, 0x1000, CRC(92b6a0e8) SHA1(d11ff39932cec9b5408dc957bf825dcf1d00c027) )
556 	ROM_LOAD( "tnx1-t.5e",    0x3000, 0x1000, CRC(cc5f0ac3) SHA1(3374b1c387df3a3eba6c523f7c13711260074a89) )
557 
558 	ROM_REGION( 0x0340, REGION_PROMS, 0 )
559 	ROM_LOAD( "tnx1-t.4a",    0x0000, 0x0020, CRC(98846924) SHA1(89688d05c4c2d6f389da4e9c0c13e0f022f2d376) ) /* background palette */
560 	ROM_LOAD( "tnx1-t.1a",    0x0020, 0x0020, CRC(c2bca435) SHA1(e7d3e68d153d646eaf12b263d58b07da2615399c) ) /* char palette */
561 	ROM_LOAD( "tnx1-t.3a",    0x0040, 0x0100, CRC(8abf9de4) SHA1(6e5500639a2dca3c288619fb8bdd120eb49bf8e0) ) /* sprite palette - low 4 bits */
562 	ROM_LOAD( "tnx1-t.2a",    0x0140, 0x0100, CRC(aa7ff322) SHA1(522d21854aa11e24f3679163354ae4fb35619eff) ) /* sprite palette - high 4 bits */
563 	ROM_LOAD( "tnx1-t.3j",    0x0240, 0x0100, CRC(1c5c8dea) SHA1(5738303b2a9c79b7d06bcf20fdb4d9b29f6e2d96) ) /* timing for the protection ALU */
564 ROM_END
565 
566 ROM_START( popeye )
567 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
568 	ROM_LOAD( "c-7a",         0x0000, 0x2000, CRC(9af7c821) SHA1(592acfe221b5c3bd9b920f639b141f37a56d6997) )
569 	ROM_LOAD( "c-7b",         0x2000, 0x2000, CRC(c3704958) SHA1(af96d10fa9bdb86b00c89d10f67cb5ca5586f446) )
570 	ROM_LOAD( "c-7c",         0x4000, 0x2000, CRC(5882ebf9) SHA1(5531229b37f9ba0ede7fdc24909e3c3efbc8ade4) )
571 	ROM_LOAD( "c-7e",         0x6000, 0x2000, CRC(ef8649ca) SHA1(a0157f91600e56e2a953dadbd76da4330652e5c8) )
572 
573 	ROM_REGION( 0x0800, REGION_GFX1, ROMREGION_DISPOSE )
574 	ROM_LOAD( "v-5n",         0x0000, 0x0800, CRC(cca61ddd) SHA1(239f87947c3cc8c6693c295ebf5ea0b7638b781c) )	/* first half is empty */
575 	ROM_CONTINUE(             0x0000, 0x0800 )
576 
577 	ROM_REGION( 0x8000, REGION_GFX2, ROMREGION_DISPOSE )
578 	ROM_LOAD( "v-1e",         0x0000, 0x2000, CRC(0f2cd853) SHA1(426c9b4f6579bfcebe72b976bfe4f05147d53f96) )
579 	ROM_LOAD( "v-1f",         0x2000, 0x2000, CRC(888f3474) SHA1(ddee56b2b49bd50aaf9c98d8ef6e905e3f6ab859) )
580 	ROM_LOAD( "v-1j",         0x4000, 0x2000, CRC(7e864668) SHA1(8e275dbb1c586f4ebca7548db05246ef0f56d7b1) )
581 	ROM_LOAD( "v-1k",         0x6000, 0x2000, CRC(49e1d170) SHA1(bd51a4e34ce8109f26954760156e3cf05fb9db57) )
582 
583 	ROM_REGION( 0x0340, REGION_PROMS, 0 )
584 	ROM_LOAD( "prom-cpu.4a",  0x0000, 0x0020, CRC(375e1602) SHA1(d84159a0af5db577821c43712bc733329a43af80) ) /* background palette */
585 	ROM_LOAD( "prom-cpu.3a",  0x0020, 0x0020, CRC(e950bea1) SHA1(0b48082fe79d9fcdca7e80caff1725713d0c3163) ) /* char palette */
586 	ROM_LOAD( "prom-cpu.5b",  0x0040, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
587 	ROM_LOAD( "prom-cpu.5a",  0x0140, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
588 	ROM_LOAD( "prom-vid.7j",  0x0240, 0x0100, CRC(a4655e2e) SHA1(2a620932fccb763c6c667278c0914f31b9f00ddf) ) /* timing for the protection ALU */
589 ROM_END
590 
591 ROM_START( popeyeu )
592 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
593 	ROM_LOAD( "7a",           0x0000, 0x2000, CRC(0bd04389) SHA1(3b08186c9b20dd4dfb92df98941b18999f23aece) )
594 	ROM_LOAD( "7b",           0x2000, 0x2000, CRC(efdf02c3) SHA1(4fa616bdb4e21f752e46890d007c911fff9ceadc) )
595 	ROM_LOAD( "7c",           0x4000, 0x2000, CRC(8eee859e) SHA1(a597d5655d06d565653c64b18ed8842625e15088) )
596 	ROM_LOAD( "7e",           0x6000, 0x2000, CRC(b64aa314) SHA1(b5367f518350223e191d94434dc535873efb4c74) )
597 
598 	ROM_REGION( 0x0800, REGION_GFX1, ROMREGION_DISPOSE )
599 	ROM_LOAD( "v-5n",         0x0000, 0x0800, CRC(cca61ddd) SHA1(239f87947c3cc8c6693c295ebf5ea0b7638b781c) )	/* first half is empty */
600 	ROM_CONTINUE(             0x0000, 0x0800 )
601 
602 	ROM_REGION( 0x8000, REGION_GFX2, ROMREGION_DISPOSE )
603 	ROM_LOAD( "v-1e",         0x0000, 0x2000, CRC(0f2cd853) SHA1(426c9b4f6579bfcebe72b976bfe4f05147d53f96) )
604 	ROM_LOAD( "v-1f",         0x2000, 0x2000, CRC(888f3474) SHA1(ddee56b2b49bd50aaf9c98d8ef6e905e3f6ab859) )
605 	ROM_LOAD( "v-1j",         0x4000, 0x2000, CRC(7e864668) SHA1(8e275dbb1c586f4ebca7548db05246ef0f56d7b1) )
606 	ROM_LOAD( "v-1k",         0x6000, 0x2000, CRC(49e1d170) SHA1(bd51a4e34ce8109f26954760156e3cf05fb9db57) )
607 
608 	ROM_REGION( 0x0340, REGION_PROMS, 0 )
609 	ROM_LOAD( "prom-cpu.4a",  0x0000, 0x0020, CRC(375e1602) SHA1(d84159a0af5db577821c43712bc733329a43af80) ) /* background palette */
610 	ROM_LOAD( "prom-cpu.3a",  0x0020, 0x0020, CRC(e950bea1) SHA1(0b48082fe79d9fcdca7e80caff1725713d0c3163) ) /* char palette */
611 	ROM_LOAD( "prom-cpu.5b",  0x0040, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
612 	ROM_LOAD( "prom-cpu.5a",  0x0140, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
613 	ROM_LOAD( "prom-vid.7j",  0x0240, 0x0100, CRC(a4655e2e) SHA1(2a620932fccb763c6c667278c0914f31b9f00ddf) ) /* timing for the protection ALU */
614 ROM_END
615 
616 ROM_START( popeyef )
617 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
618 	ROM_LOAD( "tpp2-c_f.7a",  0x0000, 0x2000, CRC(5fc5264d) SHA1(6c3d4df748c55293b6de58bd874a08f8164b878d) )
619 	ROM_LOAD( "tpp2-c_f.7b",  0x2000, 0x2000, CRC(51de48e8) SHA1(7573931c6fcb53ee5ab9408906cd8eb2ba271c64) )
620 	ROM_LOAD( "tpp2-c_f.7c",  0x4000, 0x2000, CRC(62df9647) SHA1(65d043b4142aa3ad2db7a1d4e1a2c22656ca7ade) )
621 	ROM_LOAD( "tpp2-c_f.7e",  0x6000, 0x2000, CRC(f31e7916) SHA1(0f54ea7b1691b7789067fe880ffc56fac1d9523a) )
622 
623 	ROM_REGION( 0x0800, REGION_GFX1, ROMREGION_DISPOSE )
624 	ROM_LOAD( "v-5n",         0x0000, 0x0800, CRC(cca61ddd) SHA1(239f87947c3cc8c6693c295ebf5ea0b7638b781c) )	/* first half is empty */
625 	ROM_CONTINUE(             0x0000, 0x0800 )
626 
627 	ROM_REGION( 0x8000, REGION_GFX2, ROMREGION_DISPOSE )
628 	ROM_LOAD( "v-1e",         0x0000, 0x2000, CRC(0f2cd853) SHA1(426c9b4f6579bfcebe72b976bfe4f05147d53f96) )
629 	ROM_LOAD( "v-1f",         0x2000, 0x2000, CRC(888f3474) SHA1(ddee56b2b49bd50aaf9c98d8ef6e905e3f6ab859) )
630 	ROM_LOAD( "v-1j",         0x4000, 0x2000, CRC(7e864668) SHA1(8e275dbb1c586f4ebca7548db05246ef0f56d7b1) )
631 	ROM_LOAD( "v-1k",         0x6000, 0x2000, CRC(49e1d170) SHA1(bd51a4e34ce8109f26954760156e3cf05fb9db57) )
632 
633 	ROM_REGION( 0x0340, REGION_PROMS, 0 )
634 	ROM_LOAD( "prom-cpu.4a",  0x0000, 0x0020, CRC(375e1602) SHA1(d84159a0af5db577821c43712bc733329a43af80) ) /* background palette */
635 	ROM_LOAD( "prom-cpu.3a",  0x0020, 0x0020, CRC(e950bea1) SHA1(0b48082fe79d9fcdca7e80caff1725713d0c3163) ) /* char palette */
636 	ROM_LOAD( "prom-cpu.5b",  0x0040, 0x0100, CRC(c5826883) SHA1(f2c4d3473b3bfa55bffad003dc1fd79540e7e0d1) ) /* sprite palette - low 4 bits */
637 	ROM_LOAD( "prom-cpu.5a",  0x0140, 0x0100, CRC(c576afba) SHA1(013c8e8db08a03c7ba156cfefa671d26155fe835) ) /* sprite palette - high 4 bits */
638 	ROM_LOAD( "prom-vid.7j",  0x0240, 0x0100, CRC(a4655e2e) SHA1(2a620932fccb763c6c667278c0914f31b9f00ddf) ) /* timing for the protection ALU */
639 ROM_END
640 
641 ROM_START( popeyebl )
642 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
643 	ROM_LOAD( "po1",          0x0000, 0x2000, CRC(b14a07ca) SHA1(b8666a4c6b833f60905692774e30e73f0795df11) )
644 	ROM_LOAD( "po2",          0x2000, 0x2000, CRC(995475ff) SHA1(5cd5ac23a73722e32c80cd6ffc435584750a46c9) )
645 	ROM_LOAD( "po3",          0x4000, 0x2000, CRC(99d6a04a) SHA1(b683a5bb1ac4f6bec7478760c8ad0ff7c00bc652) )
646 	ROM_LOAD( "po4",          0x6000, 0x2000, CRC(548a6514) SHA1(006e076781a3e5c3afa084c723247365358e3187) )
647 	ROM_LOAD( "po_d1-e1.bin", 0xe000, 0x0020, CRC(8de22998) SHA1(e3a232ff85fb207afbe23049a65e828420589342) )	/* protection PROM */
648 
649 	ROM_REGION( 0x0800, REGION_GFX1, ROMREGION_DISPOSE )
650 	ROM_LOAD( "v-5n",         0x0000, 0x0800, CRC(cca61ddd) SHA1(239f87947c3cc8c6693c295ebf5ea0b7638b781c) )	/* first half is empty */
651 	ROM_CONTINUE(             0x0000, 0x0800 )
652 
653 	ROM_REGION( 0x8000, REGION_GFX2, ROMREGION_DISPOSE )
654 	ROM_LOAD( "v-1e",         0x0000, 0x2000, CRC(0f2cd853) SHA1(426c9b4f6579bfcebe72b976bfe4f05147d53f96) )
655 	ROM_LOAD( "v-1f",         0x2000, 0x2000, CRC(888f3474) SHA1(ddee56b2b49bd50aaf9c98d8ef6e905e3f6ab859) )
656 	ROM_LOAD( "v-1j",         0x4000, 0x2000, CRC(7e864668) SHA1(8e275dbb1c586f4ebca7548db05246ef0f56d7b1) )
657 	ROM_LOAD( "v-1k",         0x6000, 0x2000, CRC(49e1d170) SHA1(bd51a4e34ce8109f26954760156e3cf05fb9db57) )
658 
659 	ROM_REGION( 0x0240, REGION_PROMS, 0 )
660 	ROM_LOAD( "popeye.pr1",   0x0000, 0x0020, CRC(d138e8a4) SHA1(eba7f870ccab72105593007f5cd7e0b863912402) ) /* background palette */
661 	ROM_LOAD( "popeye.pr2",   0x0020, 0x0020, CRC(0f364007) SHA1(b77d71df391a9ac9e778e84475627e72de2b8507) ) /* char palette */
662 	ROM_LOAD( "popeye.pr3",   0x0040, 0x0100, CRC(ca4d7b6a) SHA1(ec979fffea9db5a327a5270241e376c21516e343) ) /* sprite palette - low 4 bits */
663 	ROM_LOAD( "popeye.pr4",   0x0140, 0x0100, CRC(cab9bc53) SHA1(e63ba8856190187996e405f6fcee254c8ca6e81f) ) /* sprite palette - high 4 bits */
664 ROM_END
665 
666 
667 
668 DRIVER_INIT( skyskipr )
669 {
670 	UINT8 *buffer;
671 	UINT8 *rom = memory_region(REGION_CPU1);
672 	int len = 0x10000;
673 
674 	/* decrypt the program ROMs */
675 	if ((buffer = malloc(len)))
676 	{
677 		int i;
678 		for (i = 0;i < len; i++)
679 			buffer[i] = BITSWAP8(rom[BITSWAP16(i,15,14,13,12,11,10,8,7,0,1,2,4,5,9,3,6) ^ 0xfc],3,4,2,5,1,6,0,7);
680 		memcpy(rom,buffer,len);
681 		free(buffer);
682 	}
683 }
684 
DRIVER_INIT(popeye)685 DRIVER_INIT( popeye )
686 {
687 	UINT8 *buffer;
688 	UINT8 *rom = memory_region(REGION_CPU1);
689 	int len = 0x10000;
690 
691 	/* decrypt the program ROMs */
692 	if ((buffer = malloc(len)))
693 	{
694 		int i;
695 		for (i = 0;i < len; i++)
696 			buffer[i] = BITSWAP8(rom[BITSWAP16(i,15,14,13,12,11,10,8,7,6,3,9,5,4,2,1,0) ^ 0x3f],3,4,2,5,1,6,0,7);
697 		memcpy(rom,buffer,len);
698 		free(buffer);
699 	}
700 }
701 
702 
703 GAME( 1981, skyskipr, 0,      skyskipr, skyskipr, skyskipr, ROT0, "Nintendo", "Sky Skipper" )
704 GAME( 1982, popeye,   0,      popeye,   popeye,   popeye,   ROT0, "Nintendo", "Popeye (revision D)" )
705 GAME( 1982, popeyeu,  popeye, popeye,   popeye,   popeye,   ROT0, "Nintendo", "Popeye (revision D not protected)" )
706 GAME( 1982, popeyef,  popeye, popeye,   popeyef,  popeye,   ROT0, "Nintendo", "Popeye (revision F)" )
707 GAME( 1982, popeyebl, popeye, popeyebl, popeye,   0,        ROT0, "bootleg",  "Popeye (bootleg)" )
708