1 /***************************************************************************
2
3 -= Blomby Car =-
4
5 driver by Luca Elia (l.elia@tin.it)
6
7
8 Main CPU : 68000
9 Video Chips : TI TPC1020AFN-084 (= Actel A1020A PL84C 9548)
10 Sound Chips : K-665 9546 (= M6295)
11
12 To Do:
13
14 - Flip screen unused ?
15 - Better driving wheel(s) support
16
17 ***************************************************************************/
18
19 #include "driver.h"
20 #include "vidhrdw/generic.h"
21
22 /* Variables defined in vidhrdw: */
23
24 extern data16_t *blmbycar_vram_0, *blmbycar_scroll_0;
25 extern data16_t *blmbycar_vram_1, *blmbycar_scroll_1;
26
27 /* Functions defined in vidhrdw: */
28
29 WRITE16_HANDLER( blmbycar_palette_w );
30
31 WRITE16_HANDLER( blmbycar_vram_0_w );
32 WRITE16_HANDLER( blmbycar_vram_1_w );
33
34 VIDEO_START( blmbycar );
35 VIDEO_UPDATE( blmbycar );
36
37
38 /***************************************************************************
39
40
41 Sound Banking
42
43
44 ***************************************************************************/
45
46 /* The top 64k of samples are banked (16 banks total) */
47
WRITE16_HANDLER(blmbycar_okibank_w)48 WRITE16_HANDLER( blmbycar_okibank_w )
49 {
50 if (ACCESSING_LSB)
51 {
52 unsigned char *RAM = memory_region(REGION_SOUND1);
53 memcpy(&RAM[0x30000],&RAM[0x40000 + 0x10000*(data & 0xf)],0x10000);
54 }
55 }
56
57 /***************************************************************************
58
59
60 Input Handling
61
62
63 ***************************************************************************/
64
65 /* Preliminary potentiometric wheel support */
66
67 static data8_t pot_wheel = 0;
68
WRITE16_HANDLER(blmbycar_pot_wheel_reset_w)69 static WRITE16_HANDLER( blmbycar_pot_wheel_reset_w )
70 {
71 if (ACCESSING_LSB)
72 pot_wheel = ~readinputport(2) & 0xff;
73 }
74
WRITE16_HANDLER(blmbycar_pot_wheel_shift_w)75 static WRITE16_HANDLER( blmbycar_pot_wheel_shift_w )
76 {
77 if (ACCESSING_LSB)
78 {
79 static int old;
80 if ( ((old & 0xff) == 0xff) && ((data & 0xff) == 0) )
81 pot_wheel <<= 1;
82 old = data;
83 }
84 }
85
READ16_HANDLER(blmbycar_pot_wheel_r)86 static READ16_HANDLER( blmbycar_pot_wheel_r )
87 {
88 return ((pot_wheel & 0x80) ? 0x04 : 0) |
89 (rand() & 0x08);
90 }
91
92
93 /* Preliminary optical wheel support */
94
READ16_HANDLER(blmbycar_opt_wheel_r)95 static READ16_HANDLER( blmbycar_opt_wheel_r )
96 {
97 return (~readinputport(2) & 0xff) << 8;
98 }
99
100
101 /***************************************************************************
102
103
104 Memory Maps
105
106
107 ***************************************************************************/
108
MEMORY_READ16_START(blmbycar_readmem)109 static MEMORY_READ16_START( blmbycar_readmem )
110 { 0x000000, 0x0fffff, MRA16_ROM }, // ROM
111 { 0xfec000, 0xfeffff, MRA16_RAM }, // RAM
112 { 0x200000, 0x2005ff, MRA16_RAM }, // Palette
113 { 0x200600, 0x203fff, MRA16_RAM }, //
114 { 0x204000, 0x2045ff, MRA16_RAM }, // Palette
115 { 0x204600, 0x207fff, MRA16_RAM }, //
116 { 0x104000, 0x105fff, MRA16_RAM }, // Layer 1
117 { 0x106000, 0x107fff, MRA16_RAM }, // Layer 0
118 { 0x440000, 0x441fff, MRA16_RAM }, //
119 { 0x444000, 0x445fff, MRA16_RAM }, // Sprites (size?)
120 { 0x700000, 0x700001, input_port_0_word_r }, // 2 x DSW
121 { 0x700002, 0x700003, input_port_1_word_r }, // Joystick + Buttons
122 { 0x700004, 0x700005, blmbycar_opt_wheel_r }, // Wheel (optical)
123 { 0x700006, 0x700007, input_port_3_word_r }, //
124 { 0x700008, 0x700009, blmbycar_pot_wheel_r }, // Wheel (potentiometer)
125 { 0x70000e, 0x70000f, OKIM6295_status_0_lsb_r }, // Sound
126 MEMORY_END
127
128 static MEMORY_WRITE16_START( blmbycar_writemem )
129 { 0x000000, 0x0fffff, MWA16_ROM }, // ROM
130 { 0xfec000, 0xfeffff, MWA16_RAM }, // RAM
131 { 0x100000, 0x103fff, MWA16_RAM }, //
132 { 0x104000, 0x105fff, blmbycar_vram_1_w, &blmbycar_vram_1 }, // Layer 1
133 { 0x106000, 0x107fff, blmbycar_vram_0_w, &blmbycar_vram_0 }, // Layer 0
134 { 0x108000, 0x10bfff, MWA16_RAM }, //
135 { 0x10c000, 0x10c003, MWA16_RAM, &blmbycar_scroll_1 }, // Scroll 1
136 { 0x10c004, 0x10c007, MWA16_RAM, &blmbycar_scroll_0 }, // Scroll 0
137 { 0x200000, 0x2005ff, blmbycar_palette_w }, // Palette
138 { 0x200600, 0x203fff, MWA16_RAM }, //
139 { 0x204000, 0x2045ff, blmbycar_palette_w, &paletteram16 }, // Palette
140 { 0x204600, 0x207fff, MWA16_RAM }, //
141 { 0x440000, 0x441fff, MWA16_RAM }, //
142 { 0x444000, 0x445fff, MWA16_RAM, &spriteram16, &spriteram_size }, // Sprites (size?)
143 { 0x70000a, 0x70000b, MWA16_NOP }, // ? Wheel
144 { 0x70000c, 0x70000d, blmbycar_okibank_w }, // Sound
145 { 0x70000e, 0x70000f, OKIM6295_data_0_lsb_w }, //
146 { 0x70006a, 0x70006b, blmbycar_pot_wheel_reset_w }, // Wheel (potentiometer)
147 { 0x70007a, 0x70007b, blmbycar_pot_wheel_shift_w }, //
148 MEMORY_END
149
150
151 /***************************************************************************
152
153
154 Input Ports
155
156
157 ***************************************************************************/
158
159 INPUT_PORTS_START( blmbycar )
160
161 PORT_START // IN0 - $700000.w
162 PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
163 PORT_DIPSETTING( 0x0002, "Easy" )
164 PORT_DIPSETTING( 0x0003, "Normal" )
165 PORT_DIPSETTING( 0x0001, "Hard" )
166 PORT_DIPSETTING( 0x0000, "Hardest" )
167 PORT_DIPNAME( 0x0004, 0x0004, "Joysticks" )
168 PORT_DIPSETTING( 0x0000, "1" )
169 PORT_DIPSETTING( 0x0004, "2" )
170 PORT_DIPNAME( 0x0018, 0x0018, "Controls" )
171 PORT_DIPSETTING( 0x0018, "Joystick" )
172 // PORT_DIPSETTING( 0x0010, "Pot Wheel" ) // Preliminary
173 // PORT_DIPSETTING( 0x0008, "Opt Wheel" ) // Preliminary
174 // PORT_DIPSETTING( 0x0000, DEF_STR( Unused ) ) // Time goes to 0 rally fast!
175 PORT_DIPNAME( 0x0020, 0x0000, DEF_STR( Demo_Sounds ) )
176 PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
177 PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
178 PORT_DIPNAME( 0x0040, 0x0040, "Unknown 1-6" )
179 PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
180 PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
181 PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
182
183 PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) )
184 PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) )
185 PORT_DIPSETTING( 0x0000, DEF_STR( 3C_4C ) )
186 PORT_DIPSETTING( 0x0100, DEF_STR( 2C_3C ) )
187 PORT_DIPSETTING( 0x0600, DEF_STR( 1C_2C ) )
188 PORT_DIPSETTING( 0x0500, DEF_STR( 1C_3C ) )
189 PORT_DIPSETTING( 0x0400, DEF_STR( 1C_4C ) )
190 PORT_DIPSETTING( 0x0300, DEF_STR( 1C_5C ) )
191 PORT_DIPSETTING( 0x0200, DEF_STR( 1C_6C ) )
192 PORT_DIPNAME( 0x3800, 0x3800, DEF_STR( Coin_B ) )
193 PORT_DIPSETTING( 0x1000, DEF_STR( 6C_1C ) )
194 PORT_DIPSETTING( 0x1800, DEF_STR( 5C_1C ) )
195 PORT_DIPSETTING( 0x2000, DEF_STR( 4C_1C ) )
196 PORT_DIPSETTING( 0x2800, DEF_STR( 3C_1C ) )
197 PORT_DIPSETTING( 0x3000, DEF_STR( 2C_1C ) )
198 PORT_DIPSETTING( 0x0800, DEF_STR( 3C_2C ) )
199 PORT_DIPSETTING( 0x0000, DEF_STR( 4C_3C ) )
200 PORT_DIPSETTING( 0x3800, DEF_STR( 1C_1C ) )
201 PORT_DIPNAME( 0x4000, 0x4000, "Credits To Start" )
202 PORT_DIPSETTING( 0x4000, "1" )
203 PORT_DIPSETTING( 0x0000, "2" )
204 PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Free_Play ) )
205 PORT_DIPSETTING( 0x8000, DEF_STR( Off ) )
206 PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
207
208 PORT_START // IN1 - $700002.w
209 PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 )
210 PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 )
211 PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
212 PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 )
213 PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
214 PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
215 PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN1 )
216 PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN2 )
217
218 PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 )
219 PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 )
220 PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
221 PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 )
222 PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
223 PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
224 PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START1 )
225 PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
226
227 PORT_START // IN2 - $700004.w
228 PORT_ANALOG ( 0x00ff, 0x0080, IPT_AD_STICK_X, 30, 1, 0x00, 0xff )
229
230 PORT_START // IN3 - $700006.w
231 PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNKNOWN )
232
233 INPUT_PORTS_END
234
235
236
237 /***************************************************************************
238
239
240 Graphics Layouts
241
242
243 ***************************************************************************/
244
245 /* 16x16x4 tiles (made of four 8x8 tiles) */
246 static struct GfxLayout layout_16x16x4 =
247 {
248 16,16,
249 RGN_FRAC(1,4),
250 4,
251 { RGN_FRAC(3,4),RGN_FRAC(2,4),RGN_FRAC(1,4),RGN_FRAC(0,4) },
252 { STEP8(0,1), STEP8(8*8*2,1) },
253 { STEP8(0,8), STEP8(8*8*1,8) },
254 16*16
255 };
256
257 /* Layers both use the first $20 color codes. Sprites the next $10 */
258 static struct GfxDecodeInfo blmbycar_gfxdecodeinfo[] =
259 {
260 { REGION_GFX1, 0, &layout_16x16x4, 0x0, 0x30 }, // [0] Layers + Sprites
261 { -1 }
262 };
263
264
265
266 /***************************************************************************
267
268
269 Machine Drivers
270
271
272 ***************************************************************************/
273
274 static struct OKIM6295interface blmbycar_okim6295_interface =
275 {
276 1,
277 { 8000 }, /* ? */
278 { REGION_SOUND1 },
279 { 100 }
280 };
281
282 static MACHINE_DRIVER_START( blmbycar )
283
284 /* basic machine hardware */
285 MDRV_CPU_ADD(M68000, 10000000) /* ? */
MDRV_CPU_MEMORY(blmbycar_readmem,blmbycar_writemem)286 MDRV_CPU_MEMORY(blmbycar_readmem,blmbycar_writemem)
287 MDRV_CPU_VBLANK_INT(irq1_line_hold,1)
288
289 MDRV_FRAMES_PER_SECOND(60)
290 MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
291
292 /* video hardware */
293 MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
294 MDRV_SCREEN_SIZE(0x180, 0x100)
295 MDRV_VISIBLE_AREA(0, 0x180-1, 0, 0x100-1)
296 MDRV_GFXDECODE(blmbycar_gfxdecodeinfo)
297 MDRV_PALETTE_LENGTH(0x300)
298
299 MDRV_VIDEO_START(blmbycar)
300 MDRV_VIDEO_UPDATE(blmbycar)
301
302 /* sound hardware */
303 MDRV_SOUND_ATTRIBUTES(SOUND_SUPPORTS_STEREO)
304 MDRV_SOUND_ADD(OKIM6295, blmbycar_okim6295_interface)
305 MACHINE_DRIVER_END
306
307
308
309
310 /***************************************************************************
311
312
313 ROMs Loading
314
315
316 ***************************************************************************/
317
318 /***************************************************************************
319
320 Blomby Car
321 Abm & Gecas, 1990.
322
323 CPU : 68000
324 SND : Oki M6295 (samples only)
325 OSC : 30.000 + 24.000
326 DSW : 2 x 8
327 GFX : TI TPC1020AFN-084
328
329 ***************************************************************************/
330
331 ROM_START( blmbycar )
332 ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* 68000 Code */
333 ROM_LOAD16_BYTE( "bcrom4.bin", 0x000000, 0x080000, CRC(06d490ba) SHA1(6d113561b474bf613c6b91c9525a52025ae65ab7) )
334 ROM_LOAD16_BYTE( "bcrom6.bin", 0x000001, 0x080000, CRC(33aca664) SHA1(04fff492654d3edac62e9d35808e5946bcc78cbb) )
335
336 ROM_REGION( 0x200000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites */
337 ROM_LOAD( "bc_rom7", 0x000000, 0x080000, CRC(e55ca79b) SHA1(4453a6ae0518832f437ab701c28cb2f32920f8ba) )
338 ROM_LOAD( "bc_rom8", 0x080000, 0x080000, CRC(cdf38c96) SHA1(3273c29b6a01a7296d06fc653120f8c615195d2c) )
339 ROM_LOAD( "bc_rom9", 0x100000, 0x080000, CRC(0337ab3d) SHA1(18c72cd640c7b599390dffaeb670f5832202bf06) )
340 ROM_LOAD( "bc_rom10", 0x180000, 0x080000, CRC(5458917e) SHA1(c8dd5a391cc20a573e27a140b185893a8c04859e) )
341
342 ROM_REGION( 0x140000, REGION_SOUND1, 0 ) /* 8 bit adpcm (banked) */
343 ROM_LOAD( "bc_rom1", 0x040000, 0x080000, CRC(ac6f8ba1) SHA1(69d2d47cdd331bde5a8973d29659b3f8520452e7) )
344 ROM_LOAD( "bc_rom2", 0x0c0000, 0x080000, CRC(a4bc31bf) SHA1(f3d60141a91449a73f6cec9f4bc5d95ca7911e19) )
345 ROM_COPY( REGION_SOUND1, 0x040000, 0x000000, 0x040000 )
346 ROM_END
347
348 ROM_START( blmbycau )
349 ROM_REGION( 0x100000, REGION_CPU1, 0 ) /* 68000 Code */
350 ROM_LOAD16_BYTE( "bc_rom4", 0x000000, 0x080000, CRC(76f054a2) SHA1(198efd152b13033e5249119ca48b9e0f6351b0b9) )
351 ROM_LOAD16_BYTE( "bc_rom6", 0x000001, 0x080000, CRC(2570b4c5) SHA1(706465950023a6ef7c85ceb9c76246d7556b3859) )
352
353 ROM_REGION( 0x200000, REGION_GFX1, ROMREGION_DISPOSE ) /* Sprites */
354 ROM_LOAD( "bc_rom7", 0x000000, 0x080000, CRC(e55ca79b) SHA1(4453a6ae0518832f437ab701c28cb2f32920f8ba) )
355 ROM_LOAD( "bc_rom8", 0x080000, 0x080000, CRC(cdf38c96) SHA1(3273c29b6a01a7296d06fc653120f8c615195d2c) )
356 ROM_LOAD( "bc_rom9", 0x100000, 0x080000, CRC(0337ab3d) SHA1(18c72cd640c7b599390dffaeb670f5832202bf06) )
357 ROM_LOAD( "bc_rom10", 0x180000, 0x080000, CRC(5458917e) SHA1(c8dd5a391cc20a573e27a140b185893a8c04859e) )
358
359 ROM_REGION( 0x140000, REGION_SOUND1, 0 ) /* 8 bit adpcm (banked) */
360 ROM_LOAD( "bc_rom1", 0x040000, 0x080000, CRC(ac6f8ba1) SHA1(69d2d47cdd331bde5a8973d29659b3f8520452e7) )
361 ROM_LOAD( "bc_rom2", 0x0c0000, 0x080000, CRC(a4bc31bf) SHA1(f3d60141a91449a73f6cec9f4bc5d95ca7911e19) )
362 ROM_COPY( REGION_SOUND1, 0x040000, 0x000000, 0x040000 )
363 ROM_END
364
365
366 DRIVER_INIT( blmbycar )
367 {
368 data16_t *RAM = (data16_t *) memory_region(REGION_CPU1);
369 size_t size = memory_region_length(REGION_CPU1) / 2;
370 int i;
371
372 for (i = 0; i < size; i++)
373 {
374 data16_t x = RAM[i];
375 x = (x & ~0x0606) | ((x & 0x0202) << 1) | ((x & 0x0404) >> 1);
376 RAM[i] = x;
377 }
378 }
379
380 /***************************************************************************
381
382
383 Game Drivers
384
385
386 ***************************************************************************/
387
388 GAME( 1994, blmbycar, 0, blmbycar, blmbycar, blmbycar, ROT0, "ABM & Gecas", "Blomby Car" )
389 GAME( 1994, blmbycau, blmbycar, blmbycar, blmbycar, 0, ROT0, "ABM & Gecas", "Blomby Car (not encrypted)" )
390