1 /***************************************************************************
2 
3 Express Raider - (c) 1986 Data East USA
4 
5 Ernesto Corvi
6 ernesto@imagina.com
7 
8 Last Modified 14th Jul 2003
9 
10 Memory Map:
11 Main CPU: ( 6502 )
12 0000-05ff RAM
13 0600-07ff Sprites
14 0800-0bff Videoram
15 0c00-0fff Colorram
16 1800-1800 DSW 0
17 1801-1801 Controls
18 1802-1802 Coins
19 1803-1803 DSW 1
20 2100-2100 Sound latch write
21 2800-2801 Protection
22 3800-3800 VBblank ( bootleg 1 only )
23 4000-ffff MRA_ROM
24 
25 Sound Cpu: ( 6809 )
26 0000-1fff RAM
27 2000-2001 YM2203
28 4000-4001 YM3526
29 6000-6000 Sound latch read
30 8000-ffff ROM
31 
32 NOTES:
33 The main 6502 cpu is a custom one. The differences with a regular 6502 is as follows:
34 - Extra opcode ( $4b00 ), wich i think reads an external port. VBlank irq is on bit 1 ( 0x02 ).
35 - Reset, IRQ and NMI vectors are moved.
36 
37 Also, there was some protection circuitry which is now emulated.
38 
39 The way i dealt with the custom opcode was to change it to return memory
40 position $ff (wich i verified is not used by the game). And i hacked in
41 a read handler wich returns the vblank on bit 1. It's an ugly hack, but
42 works fine.
43 
44 The bootleg version patched the rom to get rid of the extra opcode ( bootlegs
45 used a regular 6502 ), the vectors hardcoded in place, and also had the
46 protection cracked.
47 
48 The background tiles had a very ugly encoding. It was so ugly that our
49 decode gfx routine will not be able to decode it without some little help.
50 So thats why exprraid_gfx_expand() is there. Many thanks to Phil
51 Stroffolino, who figured out the encoding.
52 
53 NOTES ON THE BOOTLEGS:
54 
55 1st bootleg set expects to read vblank status from 0x3800, country warning
56 sign has been defaced by the bootleggers
57 
58 2nd bootleg set expects to read vblank status from 0xFFC0, country warning
59 sign is intact, however Credit is spelt incorrectly.
60 
61 ***************************************************************************/
62 
63 #include "driver.h"
64 #include "vidhrdw/generic.h"
65 #include "cpu/m6809/m6809.h"
66 
67 
68 extern WRITE_HANDLER( exprraid_videoram_w );
69 extern WRITE_HANDLER( exprraid_colorram_w );
70 extern WRITE_HANDLER( exprraid_flipscreen_w );
71 extern WRITE_HANDLER( exprraid_bgselect_w );
72 extern WRITE_HANDLER( exprraid_scrollx_w );
73 extern WRITE_HANDLER( exprraid_scrolly_w );
74 
75 extern VIDEO_START( exprraid );
76 extern VIDEO_UPDATE( exprraid );
77 
78 
79 /*****************************************************************************************/
80 /* Emulate Protection ( only for original express raider, code is cracked on the bootleg */
81 /*****************************************************************************************/
82 
READ_HANDLER(exprraid_prot_0_r)83 static READ_HANDLER( exprraid_prot_0_r )
84 {
85 	UINT8 *RAM = memory_region(REGION_CPU1);
86 
87 	return RAM[0x02a9];
88 }
89 
READ_HANDLER(exprraid_prot_1_r)90 static READ_HANDLER( exprraid_prot_1_r )
91 {
92 	return 0x02;
93 }
94 
WRITE_HANDLER(sound_cpu_command_w)95 static WRITE_HANDLER( sound_cpu_command_w )
96 {
97     soundlatch_w(0,data);
98     cpu_set_irq_line(1,IRQ_LINE_NMI,PULSE_LINE);
99 }
100 
READ_HANDLER(vblank_r)101 static READ_HANDLER( vblank_r ) {
102 	int val = readinputport( 0 );
103 
104 	if ( ( val & 0x02 ) )
105 		cpu_spin();
106 
107 	return val;
108 }
109 
MEMORY_READ_START(readmem)110 static MEMORY_READ_START( readmem )
111 	{ 0x00ff, 0x00ff, vblank_r }, /* HACK!!!! see init_exprraid below */
112     { 0x0000, 0x05ff, MRA_RAM },
113     { 0x0600, 0x07ff, MRA_RAM }, /* sprites */
114     { 0x0800, 0x0bff, MRA_RAM },
115     { 0x0c00, 0x0fff, MRA_RAM },
116     { 0x1800, 0x1800, input_port_1_r }, /* DSW 0 */
117     { 0x1801, 0x1801, input_port_2_r }, /* Controls */
118     { 0x1802, 0x1802, input_port_3_r }, /* Coins */
119     { 0x1803, 0x1803, input_port_4_r }, /* DSW 1 */
120 	{ 0x2800, 0x2800, exprraid_prot_0_r }, /* protection */
121 	{ 0x2801, 0x2801, exprraid_prot_1_r }, /* protection */
122     { 0x4000, 0xffff, MRA_ROM },
123 MEMORY_END
124 
125 static MEMORY_WRITE_START( writemem )
126     { 0x0000, 0x05ff, MWA_RAM },
127     { 0x0600, 0x07ff, MWA_RAM, &spriteram, &spriteram_size }, /* sprites */
128     { 0x0800, 0x0bff, exprraid_videoram_w, &videoram },
129     { 0x0c00, 0x0fff, exprraid_colorram_w, &colorram },
130     { 0x2001, 0x2001, sound_cpu_command_w },
131 	{ 0x2002, 0x2002, exprraid_flipscreen_w },
132     { 0x2800, 0x2803, exprraid_bgselect_w },
133     { 0x2804, 0x2804, exprraid_scrolly_w },
134     { 0x2805, 0x2806, exprraid_scrollx_w },
135     { 0x2807, 0x2807, MWA_NOP },	/* Scroll related ?*/
136     { 0x4000, 0xffff, MWA_ROM },
137 MEMORY_END
138 
139 static MEMORY_READ_START( sub_readmem )
140     { 0x0000, 0x1fff, MRA_RAM },
141     { 0x2000, 0x2000, YM2203_status_port_0_r },
142 	{ 0x2001, 0x2001, YM2203_read_port_0_r },
143     { 0x4000, 0x4000, YM3526_status_port_0_r },
144 	{ 0x6000, 0x6000, soundlatch_r },
145     { 0x8000, 0xffff, MRA_ROM },
146 MEMORY_END
147 
148 static MEMORY_WRITE_START( sub_writemem )
149     { 0x0000, 0x1fff, MWA_RAM },
150     { 0x2000, 0x2000, YM2203_control_port_0_w },
151 	{ 0x2001, 0x2001, YM2203_write_port_0_w },
152     { 0x4000, 0x4000, YM3526_control_port_0_w },
153     { 0x4001, 0x4001, YM3526_write_port_0_w },
154     { 0x8000, 0xffff, MWA_ROM },
155 MEMORY_END
156 
157 INPUT_PORTS_START( exprraid )
158 	PORT_START /* IN 0 - 0x3800 */
159 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_VBLANK )
160 
161 	PORT_START /* DSW 0 - 0x1800 */
162 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
163 	PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
164 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
165 	PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
166 	PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
167 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
168 	PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
169 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
170 	PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
171 	PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
172 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
173 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
174 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
175 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) )
176 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
177 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
178 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
179 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
180 	PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
181 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
182 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
183 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
184 
185 	PORT_START /* IN 1 - 0x1801 */
186 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
187 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
188 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
189 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
190 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
191 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
192 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
193 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
194 
195 	PORT_START /* IN 2 - 0x1802 */
196 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
197 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
198 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
199 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
200 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
201 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
202 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
203 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
204 
205 	PORT_START /* IN 3 - 0x1803 */
206 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
207 	PORT_DIPSETTING(    0x01, "1" )
208 	PORT_DIPSETTING(    0x03, "3" )
209 	PORT_DIPSETTING(    0x02, "5" )
210 	PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Infinite", IP_KEY_NONE, IP_JOY_NONE )
211 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
212 	PORT_DIPSETTING(    0x04, "Every 50000" )
213 	PORT_DIPSETTING(    0x00, "50000 80000" )
214 	PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
215 	PORT_DIPSETTING(    0x10, "Easy" )
216 	PORT_DIPSETTING(    0x18, "Normal" )
217 	PORT_DIPSETTING(    0x08, "Hard" )
218 	PORT_DIPSETTING(    0x00, "Hardest" )
219 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
220 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
221 	PORT_DIPSETTING(    0x20, DEF_STR( On ) )
222 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )	/* This one has to be set for coin up */
223 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
224 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
225 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
226 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
227 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
228 INPUT_PORTS_END
229 
230 
231 
232 static struct GfxLayout charlayout =
233 {
234 	8,8,	/* 8*8 characters */
235 	1024,	/* 1024 characters */
236 	2,	/* 2 bits per pixel */
237 	{ 0, 4 },	/* the bitplanes are packed in the same byte */
238 	{ (0x2000*8)+0, (0x2000*8)+1, (0x2000*8)+2, (0x2000*8)+3, 0, 1, 2, 3 },
239 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
240 	8*8	/* every char takes 8 consecutive bytes */
241 };
242 
243 static struct GfxLayout spritelayout =
244 {
245 	16,16,	/* 16*16 sprites */
246 	2048,	/* 2048 sprites */
247 	3,	/* 3 bits per pixel */
248 	{ 2*2048*32*8, 2048*32*8, 0 },	/* the bitplanes are separated */
249 	{ 128+0, 128+1, 128+2, 128+3, 128+4, 128+5, 128+6, 128+7, 0, 1, 2, 3, 4, 5, 6, 7 },
250 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
251 	32*8	/* every char takes 32 consecutive bytes */
252 };
253 
254 static struct GfxLayout tile1 =
255 {
256 	16,16,	/* 16*16 tiles */
257 	128,	/* 128 tiles */
258 	3,	/* 3 bits per pixel */
259 	{ 4, 0x10000*8+0, 0x10000*8+4 },
260 	{ 0, 1, 2, 3, 1024*32*2,1024*32*2+1,1024*32*2+2,1024*32*2+3,
261 		128+0,128+1,128+2,128+3,128+1024*32*2,128+1024*32*2+1,128+1024*32*2+2,128+1024*32*2+3 }, /* BOGUS */
262 	{ 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,
263 		64+0*8,64+1*8,64+2*8,64+3*8,64+4*8,64+5*8,64+6*8,64+7*8 },
264 	32*8
265 };
266 
267 static struct GfxLayout tile2 =
268 {
269 	16,16,	/* 16*16 tiles */
270 	128,	/* 128 tiles */
271 	3,	/* 3 bits per pixel */
272 	{ 0, 0x11000*8+0, 0x11000*8+4  },
273 	{ 0, 1, 2, 3, 1024*32*2,1024*32*2+1,1024*32*2+2,1024*32*2+3,
274 		128+0,128+1,128+2,128+3,128+1024*32*2,128+1024*32*2+1,128+1024*32*2+2,128+1024*32*2+3 }, /* BOGUS */
275 	{ 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,
276 		64+0*8,64+1*8,64+2*8,64+3*8,64+4*8,64+5*8,64+6*8,64+7*8 },
277 	32*8
278 };
279 
280 
281 static struct GfxDecodeInfo gfxdecodeinfo[] =
282 {
283 	{ REGION_GFX1, 0x00000, &charlayout,   128, 2 }, /* characters */
284 	{ REGION_GFX2, 0x00000, &spritelayout,  64, 8 }, /* sprites */
285 	{ REGION_GFX3, 0x00000, &tile1,          0, 4 }, /* background tiles */
286 	{ REGION_GFX3, 0x00000, &tile2,          0, 4 },
287 	{ REGION_GFX3, 0x04000, &tile1,          0, 4 },
288 	{ REGION_GFX3, 0x04000, &tile2,          0, 4 },
289 	{ REGION_GFX3, 0x08000, &tile1,          0, 4 },
290 	{ REGION_GFX3, 0x08000, &tile2,          0, 4 },
291 	{ REGION_GFX3, 0x0c000, &tile1,          0, 4 },
292 	{ REGION_GFX3, 0x0c000, &tile2,          0, 4 },
293 	{ -1 } /* end of array */
294 };
295 
296 
297 
298 /* handler called by the 3812 emulator when the internal timers cause an IRQ */
irqhandler(int linestate)299 static void irqhandler(int linestate)
300 {
301 	cpu_set_irq_line_and_vector(1,0,linestate,0xff);
302 }
303 
304 static struct YM2203interface ym2203_interface =
305 {
306     1,      /* 1 chip */
307     1500000,        /* 1.5 MHz ??? */
308     { YM2203_VOL(30,30) },
309     { 0 },
310     { 0 },
311     { 0 },
312     { 0 }
313 };
314 
315 static struct YM3526interface ym3526_interface =
316 {
317 	1,                      /* 1 chip (no more supported) */
318 	3600000,	/* 3.600000 MHz ? (partially supported) */
319 	{ 60 },		/* volume */
320 	{ irqhandler }
321 };
322 
INTERRUPT_GEN(exprraid_interrupt)323 static INTERRUPT_GEN( exprraid_interrupt )
324 {
325 	static int coin = 0;
326 
327 	if ( ( ~readinputport( 3 ) ) & 0xc0 ) {
328 		if ( coin == 0 ) {
329 			coin = 1;
330 			cpu_set_irq_line(0, IRQ_LINE_NMI, PULSE_LINE);
331 		}
332 	} else
333 		coin = 0;
334 }
335 
336 static MACHINE_DRIVER_START( exprraid )
337 
338 	/* basic machine hardware */
339 	MDRV_CPU_ADD(M6502, 4000000)        /* 4 MHz ??? */
MDRV_CPU_MEMORY(readmem,writemem)340 	MDRV_CPU_MEMORY(readmem,writemem)
341 	MDRV_CPU_VBLANK_INT(exprraid_interrupt,1)
342 
343 	MDRV_CPU_ADD(M6809, 2000000)        /* 2 MHz ??? */
344 	MDRV_CPU_MEMORY(sub_readmem,sub_writemem)
345 								/* IRQs are caused by the YM3526 */
346 	MDRV_FRAMES_PER_SECOND(60)
347 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
348 
349 	/* video hardware */
350 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
351 	MDRV_SCREEN_SIZE(32*8, 32*8)
352 	MDRV_VISIBLE_AREA(1*8, 31*8-1, 1*8, 31*8-1)
353 	MDRV_GFXDECODE(gfxdecodeinfo)
354 	MDRV_PALETTE_LENGTH(256)
355 
356 	MDRV_PALETTE_INIT(RRRR_GGGG_BBBB)
357 	MDRV_VIDEO_START(exprraid)
358 	MDRV_VIDEO_UPDATE(exprraid)
359 
360 	/* sound hardware */
361 	MDRV_SOUND_ADD(YM2203, ym2203_interface)
362 	MDRV_SOUND_ADD(YM3526, ym3526_interface)
363 MACHINE_DRIVER_END
364 
365 
366 
367 /***************************************************************************
368 
369   Game driver(s)
370 
371 ***************************************************************************/
372 
373 ROM_START( exprraid )
374 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
375 	ROM_LOAD( "cz01",    0x4000, 0x4000, CRC(dc8f9fba) SHA1(cae6af54fc0081d606b6884e8873aed356a37ba9) )
376 	ROM_LOAD( "cz00",    0x8000, 0x8000, CRC(a81290bc) SHA1(ddb0acda6124427bee691f9926c41fda27ed816e) )
377 
378 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the sub cpu */
379 	ROM_LOAD( "cz02",    0x8000, 0x8000, CRC(552e6112) SHA1(f8412a63cab0aa47321d602f69bf534426c6aa5d) )
380 
381 	ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )
382 	ROM_LOAD( "cz07",    0x00000, 0x4000, CRC(686bac23) SHA1(b6c96ed40e90a8ba32c2e78a65f9589d387b0254) )	/* characters */
383 
384 	ROM_REGION( 0x30000, REGION_GFX2, ROMREGION_DISPOSE )
385 	ROM_LOAD( "cz09",    0x00000, 0x8000, CRC(1ed250d1) SHA1(c98b0440e4319308e683e857bbfeb6a150c76ff3) )	/* sprites */
386 	ROM_LOAD( "cz08",    0x08000, 0x8000, CRC(2293fc61) SHA1(bf81db375f5424396559dcf0e04d34a52f6a020a) )
387 	ROM_LOAD( "cz13",    0x10000, 0x8000, CRC(7c3bfd00) SHA1(87b48e09aaeacf78f3260df893b0922e25d10a5d) )
388 	ROM_LOAD( "cz12",    0x18000, 0x8000, CRC(ea2294c8) SHA1(bc996351921e68e6237cee2d29fee882931ce0ea) )
389 	ROM_LOAD( "cz11",    0x20000, 0x8000, CRC(b7418335) SHA1(e9d08ee651b9221c371e2629a757bceca7b6192b) )
390 	ROM_LOAD( "cz10",    0x28000, 0x8000, CRC(2f611978) SHA1(fb60be573184d2af1dfdd543e68eeec53f2788f2) )
391 
392 	ROM_REGION( 0x20000, REGION_GFX3, ROMREGION_DISPOSE )
393 	ROM_LOAD( "cz04",    0x00000, 0x8000, CRC(643a1bd3) SHA1(b23631d96cb413808f65f3ebe8fe6539b6140606) )	/* tiles */
394 	/* Save 0x08000-0x0ffff to expand the previous so we can decode the thing */
395 	ROM_LOAD( "cz05",    0x10000, 0x8000, CRC(c44570bf) SHA1(3e9b8b6b36c7f5ae016dba3987ea19a29bd5ee5b) )	/* tiles */
396 	ROM_LOAD( "cz06",    0x18000, 0x8000, CRC(b9bb448b) SHA1(84974b1f3a5b58cd427d874f805a6dd9244c1101) )	/* tiles */
397 
398 	ROM_REGION( 0x8000, REGION_GFX4, 0 )     /* background tilemaps */
399 	ROM_LOAD( "cz03",    0x0000, 0x8000, CRC(6ce11971) SHA1(16bfa69b3ad02253e81c8110c9b840be03952790) )
400 
401 	ROM_REGION( 0x0400, REGION_PROMS, 0 )
402 	ROM_LOAD( "cz17.prm", 0x0000, 0x0100, CRC(da31dfbc) SHA1(ac476440864f538918f7bef2e1db82fd19195f89) ) /* red */
403 	ROM_LOAD( "cz16.prm", 0x0100, 0x0100, CRC(51f25b4c) SHA1(bfcca57613fbb22919e00db1f6a8c7ca50faa60b) ) /* green */
404 	ROM_LOAD( "cz15.prm", 0x0200, 0x0100, CRC(a6168d7f) SHA1(0c7b31adcd764ce2631c3fb5c1a968b01f65e741) ) /* blue */
405 	ROM_LOAD( "cz14.prm", 0x0300, 0x0100, CRC(52aad300) SHA1(ff09772b930afa87e28d0628ef85a589a3d149c9) ) /* ??? */
406 ROM_END
407 
408 ROM_START( wexpress )
409 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
410 	ROM_LOAD( "2",       0x4000, 0x4000, CRC(ea5e5a8f) SHA1(fa92bcb6b97c2966cd330b309eba73f9c059f14e) )
411 	ROM_LOAD( "1",       0x8000, 0x8000, CRC(a7daae12) SHA1(a97f4bc05a3ec096d8c717bdf096f4b0e59dc2c2) )
412 
413 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the sub cpu */
414 	ROM_LOAD( "cz02",    0x8000, 0x8000, CRC(552e6112) SHA1(f8412a63cab0aa47321d602f69bf534426c6aa5d) )
415 
416 	ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )
417 	ROM_LOAD( "cz07",    0x00000, 0x4000, CRC(686bac23) SHA1(b6c96ed40e90a8ba32c2e78a65f9589d387b0254) )	/* characters */
418 
419 	ROM_REGION( 0x30000, REGION_GFX2, ROMREGION_DISPOSE )
420 	ROM_LOAD( "cz09",    0x00000, 0x8000, CRC(1ed250d1) SHA1(c98b0440e4319308e683e857bbfeb6a150c76ff3) )	/* sprites */
421 	ROM_LOAD( "cz08",    0x08000, 0x8000, CRC(2293fc61) SHA1(bf81db375f5424396559dcf0e04d34a52f6a020a) )
422 	ROM_LOAD( "cz13",    0x10000, 0x8000, CRC(7c3bfd00) SHA1(87b48e09aaeacf78f3260df893b0922e25d10a5d) )
423 	ROM_LOAD( "cz12",    0x18000, 0x8000, CRC(ea2294c8) SHA1(bc996351921e68e6237cee2d29fee882931ce0ea) )
424 	ROM_LOAD( "cz11",    0x20000, 0x8000, CRC(b7418335) SHA1(e9d08ee651b9221c371e2629a757bceca7b6192b) )
425 	ROM_LOAD( "cz10",    0x28000, 0x8000, CRC(2f611978) SHA1(fb60be573184d2af1dfdd543e68eeec53f2788f2) )
426 
427 	ROM_REGION( 0x20000, REGION_GFX3, ROMREGION_DISPOSE )
428 	ROM_LOAD( "4",       0x00000, 0x8000, CRC(f2e93ff0) SHA1(2e631966e1fa0b2699aa782b589d36801072ba03) )	/* tiles */
429 	/* Save 0x08000-0x0ffff to expand the previous so we can decode the thing */
430 	ROM_LOAD( "cz05",    0x10000, 0x8000, CRC(c44570bf) SHA1(3e9b8b6b36c7f5ae016dba3987ea19a29bd5ee5b) )	/* tiles */
431 	ROM_LOAD( "6",       0x18000, 0x8000, CRC(c3a56de5) SHA1(aefc516c6c69b12291c0bda03729910181a91a17) )	/* tiles */
432 
433 	ROM_REGION( 0x8000, REGION_GFX4, 0 )     /* background tilemaps */
434 	ROM_LOAD( "3",        0x0000, 0x8000, CRC(242e3e64) SHA1(4fa8e93ef055bfdbe3bd619c53bf2448e1b832f0) )
435 
436 	ROM_REGION( 0x0400, REGION_PROMS, 0 )
437 	ROM_LOAD( "cz17.prm", 0x0000, 0x0100, CRC(da31dfbc) SHA1(ac476440864f538918f7bef2e1db82fd19195f89) ) /* red */
438 	ROM_LOAD( "cz16.prm", 0x0100, 0x0100, CRC(51f25b4c) SHA1(bfcca57613fbb22919e00db1f6a8c7ca50faa60b) ) /* green */
439 	ROM_LOAD( "cz15.prm", 0x0200, 0x0100, CRC(a6168d7f) SHA1(0c7b31adcd764ce2631c3fb5c1a968b01f65e741) ) /* blue */
440 	ROM_LOAD( "cz14.prm", 0x0300, 0x0100, CRC(52aad300) SHA1(ff09772b930afa87e28d0628ef85a589a3d149c9) ) /* ??? */
441 ROM_END
442 
443 ROM_START( wexpresb )
444 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
445 	ROM_LOAD( "wexpress.3", 0x4000, 0x4000, CRC(b4dd0fa4) SHA1(8d17eb28ae92486c67859871ea2bef8f50f39dbd) )
446 	ROM_LOAD( "wexpress.1", 0x8000, 0x8000, CRC(e8466596) SHA1(dbbd3b84d0f017292595fc19f7412b984851221a) )
447 
448 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the sub cpu */
449 	ROM_LOAD( "cz02",    0x8000, 0x8000, CRC(552e6112) SHA1(f8412a63cab0aa47321d602f69bf534426c6aa5d) )
450 
451 	ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )
452 	ROM_LOAD( "cz07",    0x00000, 0x4000, CRC(686bac23) SHA1(b6c96ed40e90a8ba32c2e78a65f9589d387b0254) )	/* characters */
453 
454 	ROM_REGION( 0x30000, REGION_GFX2, ROMREGION_DISPOSE )
455 	ROM_LOAD( "cz09",    0x00000, 0x8000, CRC(1ed250d1) SHA1(c98b0440e4319308e683e857bbfeb6a150c76ff3) )	/* sprites */
456 	ROM_LOAD( "cz08",    0x08000, 0x8000, CRC(2293fc61) SHA1(bf81db375f5424396559dcf0e04d34a52f6a020a) )
457 	ROM_LOAD( "cz13",    0x10000, 0x8000, CRC(7c3bfd00) SHA1(87b48e09aaeacf78f3260df893b0922e25d10a5d) )
458 	ROM_LOAD( "cz12",    0x18000, 0x8000, CRC(ea2294c8) SHA1(bc996351921e68e6237cee2d29fee882931ce0ea) )
459 	ROM_LOAD( "cz11",    0x20000, 0x8000, CRC(b7418335) SHA1(e9d08ee651b9221c371e2629a757bceca7b6192b) )
460 	ROM_LOAD( "cz10",    0x28000, 0x8000, CRC(2f611978) SHA1(fb60be573184d2af1dfdd543e68eeec53f2788f2) )
461 
462 	ROM_REGION( 0x20000, REGION_GFX3, ROMREGION_DISPOSE )
463 	ROM_LOAD( "4",       0x00000, 0x8000, CRC(f2e93ff0) SHA1(2e631966e1fa0b2699aa782b589d36801072ba03) )	/* tiles */
464 	/* Save 0x08000-0x0ffff to expand the previous so we can decode the thing */
465 	ROM_LOAD( "cz05",    0x10000, 0x8000, CRC(c44570bf) SHA1(3e9b8b6b36c7f5ae016dba3987ea19a29bd5ee5b) )	/* tiles */
466 	ROM_LOAD( "6",       0x18000, 0x8000, CRC(c3a56de5) SHA1(aefc516c6c69b12291c0bda03729910181a91a17) )	/* tiles */
467 
468 	ROM_REGION( 0x8000, REGION_GFX4, 0 )     /* background tilemaps */
469 	ROM_LOAD( "3",        0x0000, 0x8000, CRC(242e3e64) SHA1(4fa8e93ef055bfdbe3bd619c53bf2448e1b832f0) )
470 
471 	ROM_REGION( 0x0400, REGION_PROMS, 0 )
472 	ROM_LOAD( "cz17.prm", 0x0000, 0x0100, CRC(da31dfbc) SHA1(ac476440864f538918f7bef2e1db82fd19195f89) ) /* red */
473 	ROM_LOAD( "cz16.prm", 0x0100, 0x0100, CRC(51f25b4c) SHA1(bfcca57613fbb22919e00db1f6a8c7ca50faa60b) ) /* green */
474 	ROM_LOAD( "cz15.prm", 0x0200, 0x0100, CRC(a6168d7f) SHA1(0c7b31adcd764ce2631c3fb5c1a968b01f65e741) ) /* blue */
475 	ROM_LOAD( "cz14.prm", 0x0300, 0x0100, CRC(52aad300) SHA1(ff09772b930afa87e28d0628ef85a589a3d149c9) ) /* ??? */
476 ROM_END
477 
478 ROM_START( wexpresc )
479 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
480 	ROM_LOAD( "s2",      0x4000, 0x4000, CRC(40d70fcb) SHA1(1327d39f872a39e020972952e5756ca59c55f9d0) )
481 	ROM_LOAD( "s1",      0x8000, 0x8000, CRC(7c573824) SHA1(f5e4d4f0866c08c88d012a77e8aa2e74a779f986) )
482 
483 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for the sub cpu */
484 	ROM_LOAD( "cz02",    0x8000, 0x8000, CRC(552e6112) SHA1(f8412a63cab0aa47321d602f69bf534426c6aa5d) )
485 
486 	ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )
487 	ROM_LOAD( "cz07",    0x00000, 0x4000, CRC(686bac23) SHA1(b6c96ed40e90a8ba32c2e78a65f9589d387b0254) )	/* characters */
488 
489 	ROM_REGION( 0x30000, REGION_GFX2, ROMREGION_DISPOSE )
490 	ROM_LOAD( "cz09",    0x00000, 0x8000, CRC(1ed250d1) SHA1(c98b0440e4319308e683e857bbfeb6a150c76ff3) )	/* sprites */
491 	ROM_LOAD( "cz08",    0x08000, 0x8000, CRC(2293fc61) SHA1(bf81db375f5424396559dcf0e04d34a52f6a020a) )
492 	ROM_LOAD( "cz13",    0x10000, 0x8000, CRC(7c3bfd00) SHA1(87b48e09aaeacf78f3260df893b0922e25d10a5d) )
493 	ROM_LOAD( "cz12",    0x18000, 0x8000, CRC(ea2294c8) SHA1(bc996351921e68e6237cee2d29fee882931ce0ea) )
494 	ROM_LOAD( "cz11",    0x20000, 0x8000, CRC(b7418335) SHA1(e9d08ee651b9221c371e2629a757bceca7b6192b) )
495 	ROM_LOAD( "cz10",    0x28000, 0x8000, CRC(2f611978) SHA1(fb60be573184d2af1dfdd543e68eeec53f2788f2) )
496 
497 	ROM_REGION( 0x20000, REGION_GFX3, ROMREGION_DISPOSE )
498 	ROM_LOAD( "4",       0x00000, 0x8000, CRC(f2e93ff0) SHA1(2e631966e1fa0b2699aa782b589d36801072ba03) )	/* tiles */
499 	/* Save 0x08000-0x0ffff to expand the previous so we can decode the thing */
500 	ROM_LOAD( "cz05",    0x10000, 0x8000, CRC(c44570bf) SHA1(3e9b8b6b36c7f5ae016dba3987ea19a29bd5ee5b) )	/* tiles */
501 	ROM_LOAD( "6",       0x18000, 0x8000, CRC(c3a56de5) SHA1(aefc516c6c69b12291c0bda03729910181a91a17) )	/* tiles */
502 
503 	ROM_REGION( 0x8000, REGION_GFX4, 0 )     /* background tilemaps */
504 	ROM_LOAD( "3",        0x0000, 0x8000, CRC(242e3e64) SHA1(4fa8e93ef055bfdbe3bd619c53bf2448e1b832f0) )
505 	/* Proms Weren't Present In This Set, Using the One from the Other */
506 	ROM_REGION( 0x0400, REGION_PROMS, 0 )
507 	ROM_LOAD( "cz17.prm", 0x0000, 0x0100, CRC(da31dfbc) SHA1(ac476440864f538918f7bef2e1db82fd19195f89) ) /* red */
508 	ROM_LOAD( "cz16.prm", 0x0100, 0x0100, CRC(51f25b4c) SHA1(bfcca57613fbb22919e00db1f6a8c7ca50faa60b) ) /* green */
509 	ROM_LOAD( "cz15.prm", 0x0200, 0x0100, CRC(a6168d7f) SHA1(0c7b31adcd764ce2631c3fb5c1a968b01f65e741) ) /* blue */
510 	ROM_LOAD( "cz14.prm", 0x0300, 0x0100, CRC(52aad300) SHA1(ff09772b930afa87e28d0628ef85a589a3d149c9) ) /* ??? */
511 ROM_END
512 
513 
514 static void exprraid_gfx_expand(void)
515 {
516 	/* Expand the background rom so we can use regular decode routines */
517 
518 	UINT8	*gfx = memory_region(REGION_GFX3);
519 	int				offs = 0x10000-0x1000;
520 	int				i;
521 
522 
523 	for ( i = 0x8000-0x1000; i >= 0; i-= 0x1000 )
524 	{
525 		memcpy( &(gfx[offs]), &(gfx[i]), 0x1000 );
526 
527 		offs -= 0x1000;
528 
529 		memcpy( &(gfx[offs]), &(gfx[i]), 0x1000 );
530 
531 		offs -= 0x1000;
532 	}
533 }
534 
535 
DRIVER_INIT(wexpress)536 static DRIVER_INIT( wexpress )
537 {
538 	UINT8 *rom = memory_region(REGION_CPU1);
539 	int i;
540 
541 
542 	exprraid_gfx_expand();
543 
544 	/* HACK!: Implement custom opcode as regular with a mapped io read */
545 	for ( i = 0; i < 0x10000; i++ )
546 	{
547 		/* make sure is what we want to patch */
548 		if ( rom[i] == 0x4b && rom[i+1] == 0x00 && rom[i+2] == 0x29 && rom[i+3] == 0x02 )
549 		{
550 			/* replace custom opcode with: LDA	$FF */
551 			rom[i] = 0xa5;
552 			i++;
553 			rom[i] = 0xff;
554 		}
555 	}
556 }
557 
DRIVER_INIT(exprraid)558 static DRIVER_INIT( exprraid )
559 {
560 	UINT8 *rom = memory_region(REGION_CPU1);
561 
562 
563 	/* decode vectors */
564 	rom[0xfffa] = rom[0xfff7];
565 	rom[0xfffb] = rom[0xfff6];
566 
567 	rom[0xfffc] = rom[0xfff1];
568 	rom[0xfffd] = rom[0xfff0];
569 
570 	rom[0xfffe] = rom[0xfff3];
571 	rom[0xffff] = rom[0xfff2];
572 
573 	/* HACK!: Implement custom opcode as regular with a mapped io read */
574 	init_wexpress();
575 }
576 
DRIVER_INIT(wexpresb)577 static DRIVER_INIT( wexpresb )
578 {
579 	install_mem_read_handler(0, 0x3800, 0x3800, vblank_r);
580 	exprraid_gfx_expand();
581 }
582 
DRIVER_INIT(wexpresc)583 static DRIVER_INIT( wexpresc )
584 {
585 	install_mem_read_handler(0, 0xFFC0, 0xFFC0, vblank_r);
586 	exprraid_gfx_expand();
587 }
588 
589 
590 GAME( 1986, exprraid, 0,        exprraid, exprraid, exprraid, ROT0, "Data East USA", "Express Raider (US)" )
591 GAME( 1986, wexpress, exprraid, exprraid, exprraid, wexpress, ROT0, "Data East Corporation", "Western Express (World[Q])" )
592 GAME( 1986, wexpresb, exprraid, exprraid, exprraid, wexpresb, ROT0, "bootleg", "Western Express (bootleg set 1)" )
593 GAME( 1986, wexpresc, exprraid, exprraid, exprraid, wexpresc, ROT0, "bootleg", "Western Express (bootleg set 2)" )
594