1 #include "../machine/jackal.c"
2 #include "../vidhrdw/jackal.c"
3 
4 /***************************************************************************
5 
6   jackal.c
7 
8   Written by Kenneth Lin (kenneth_lin@ai.vancouver.bc.ca)
9 
10 Notes:
11 - The high score table colors are wrong, are there proms missing?
12 - The sprite drawing code could use a rewrite
13 - Sprite lag
14 - After game over, the first main logo screen is one line out of sync after
15   the scrolling is completed.
16 - One of the bootleg Top Gunner gfx ROMs seems to be bad.
17 
18 
19 1st CPU memory map
20 NB. "x", "y" refers to non rotated screen.
21 ie.
22 
23   x --> increase
24 y  -------------------------------------------------------------
25 | | 0                                                           |
26 | | 0                                                           |
27 V |                                                             |
28   |                                                             |
29 i |                                                             |
30 n |I                                                            |
31 c |H                                                            |
32 r |                                                             |
33 e |                                                             |
34 a | 0                                                           |
35 s | 0                                                           |
36 e |                                                             |
37   |                                                             |
38    -------------------------------------------------------------
39 
40 0000-001f  Work area (IO interface?)
41 
42 	0000:	x whole screen scroll
43 	0001:	y whole screen scroll
44 	0002 ?	store
45 	0003 ?	store
46 	0004 ?  Bit 2 controls NMI, bit 4 controls IRQ, bit 5 controls FIRQ
47 	0010:	DSW1
48 	0011:	Player 1 controls
49 	0012:	Player 2 controls
50 	0013:	Coin + selftest
51 	0018:	DSW2
52 	0019 ?	Write value frequently (watchdog reset ?)
53 	001C:	Memory bank selection 0x08=ALT SPRITE/0x10=ALT RAM/0x20=ALT ROM
54 
55 0020-005f  Banked ZRAM (Scroll registers?)
56 
57 	0020 - 002F: 16 horizontal / vertical strips based on memory $0002
58 
59 0060-1fff  Banked COMMON RAM
60 
61 	Using sprite buffer 1 (Base $3000) as example.
62 	Add 0x800 for sprite buffer 2 (Base $3800).
63 
64 	($001C = 0x??, memory block size = 0x08, 65 entries)
65 	0060-0067: 0060, 0061, 0062, 0063, 0064 -> 0311D, 0311E, 0311F, 03120, 03121
66 	0068-006F: 0068, 0069, 006A, 006B, 006C -> 03122, 03123, 03124, 03125, 03126
67 	.
68 	.
69 	0198-019F: 0198, 0199, 019A, 019B, 019C -> 031E0, 031E1, 031E2, 031E3, 031E4
70 	01A0-01A7: 01A0, 01A1, 01A2, 01A3, 01A4 -> 031E5, 031E6, 031E7, 031E8, 031E9
71 
72 	($001C = 0x28, memory block size = 0x28, 49 entries)
73 	01A8-01CF: 01AE, 01AF, 01AA, 01AC, 01A9 -> 13000, 13001, 13002, 13003, 13004
74 	01D0-01F7: 01D6, 01D7, 01D2, 01D4, 01D1 -> 13005, 13006, 13007, 13008, 13009
75 	01F8-021F: 01FE, 01FF, 01FA, 01FC, 01F9 -> 1300A, 1300B, 1300C, 1300D, 1300E
76 	.
77 	.
78 	0900-0927: 0906, 0907, 0902, 0904, 0901 -> 130EB, 130EC, 130ED, 130EE, 130EF
79 	0928-094F: 092E, 092F, 092A, 092C, 0929 -> 130F0, 130F1, 130F2, 130F3, 130F4
80 
81 	($001C = 0x??, memory block size = 0x28, 57 entries)
82 	0950-0977: 0956, 0957, 0952, 0953, 0954 -> 03000, 03001, 03002, 03003, 03004
83 	0978-099F: 097E, 097F, 097A, 097C, 0979 -> 03005, 03006, 03007, 03008, 03009
84 	.
85 	.
86 	11E8-120F: 11EE, 11EF, 11EA, 11EC, 11E9 -> 03113, 03114, 03115, 03116, 03117
87 	1210-1237: 1216, 1217, 1212, 1214, 1211 -> 03118, 03119, 0311A, 0311B, 0311C
88 
89 	12F8-132F: High score table
90 
91 	1340-1343: High score
92 
93 	1C11:	SOUND RAM status from 2nd CPU during self test
94 	1C12:	COLOR RAM status from 2nd CPU during self test
95 	1C13:	ROM1 status from 2nd CPU during self test
96 
97 2000-23ff  ColorRAM (Extended VideoRAM)
98 2400-27ff  VideoRAM
99 2800-2bff  RAM
100 2C00-2fff  ?
101 3000-34ff  Sprite buffer #1
102 3500-37ff  (Unused)
103 3800-3cff  Sprite buffer #2
104 3D00-3fff  (Unused)
105 4000-bfff  Banked ROM
106 C000-ffff  ROM
107 
108 ***************************************************************************/
109 
110 #include "driver.h"
111 #include "vidhrdw/generic.h"
112 #include "cpu/m6809/m6809.h"
113 
114 
115 extern unsigned char *jackal_videoctrl;
116 
117 void jackal_init_machine(void);
118 int jackal_vh_start(void);
119 void jackal_vh_stop(void);
120 
121 READ_HANDLER( jackal_zram_r );
122 READ_HANDLER( jackal_commonram_r );
123 READ_HANDLER( jackal_commonram1_r );
124 READ_HANDLER( jackal_voram_r );
125 READ_HANDLER( jackal_spriteram_r );
126 
127 WRITE_HANDLER( jackal_rambank_w );
128 WRITE_HANDLER( jackal_zram_w );
129 WRITE_HANDLER( jackal_commonram_w );
130 WRITE_HANDLER( jackal_commonram1_w );
131 WRITE_HANDLER( jackal_voram_w );
132 WRITE_HANDLER( jackal_spriteram_w );
133 
134 void jackal_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
135 void jackal_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
136 
137 
138 
READ_HANDLER(rotary_0_r)139 static READ_HANDLER( rotary_0_r )
140 {
141 	return (1 << (readinputport(6) * 8 / 256)) ^ 0xff;
142 }
143 
READ_HANDLER(rotary_1_r)144 static READ_HANDLER( rotary_1_r )
145 {
146 	return (1 << (readinputport(7) * 8 / 256)) ^ 0xff;
147 }
148 
149 static unsigned char intenable;
150 
WRITE_HANDLER(jackal_interrupt_enable_w)151 WRITE_HANDLER( jackal_interrupt_enable_w )
152 {
153 	intenable = data;
154 }
155 
jackal_interrupt(void)156 int jackal_interrupt(void)
157 {
158 	if (intenable & 0x02) return nmi_interrupt();
159 	if (intenable & 0x08) return M6809_INT_IRQ;
160 	if (intenable & 0x10) return M6809_INT_FIRQ;
161 	return ignore_interrupt();
162 }
163 
164 
165 static struct MemoryReadAddress jackal_readmem[] =
166 {
167 	{ 0x0010, 0x0010, input_port_0_r },
168 	{ 0x0011, 0x0011, input_port_1_r },
169 	{ 0x0012, 0x0012, input_port_2_r },
170 	{ 0x0013, 0x0013, input_port_3_r },
171 	{ 0x0014, 0x0014, rotary_0_r },
172 	{ 0x0015, 0x0015, rotary_1_r },
173 	{ 0x0018, 0x0018, input_port_4_r },
174 	{ 0x0020, 0x005f, jackal_zram_r },	/* MAIN   Z RAM,SUB    Z RAM */
175 	{ 0x0060, 0x1fff, jackal_commonram_r },	/* M COMMON RAM,S COMMON RAM */
176 	{ 0x2000, 0x2fff, jackal_voram_r },	/* MAIN V O RAM,SUB  V O RAM */
177 	{ 0x3000, 0x3fff, jackal_spriteram_r },	/* MAIN V O RAM,SUB  V O RAM */
178 	{ 0x4000, 0xbfff, MRA_BANK1 },
179 	{ 0xc000, 0xffff, MRA_ROM },
180 	{ -1 }  /* end of table */
181 };
182 
183 static struct MemoryWriteAddress jackal_writemem[] =
184 {
185 	{ 0x0000, 0x0003, MWA_RAM, &jackal_videoctrl },	/* scroll + other things */
186 	{ 0x0004, 0x0004, jackal_interrupt_enable_w },
187 	{ 0x0019, 0x0019, MWA_NOP },	/* possibly watchdog reset */
188 	{ 0x001c, 0x001c, jackal_rambank_w },
189 	{ 0x0020, 0x005f, jackal_zram_w },
190 	{ 0x0060, 0x1fff, jackal_commonram_w },
191 	{ 0x2000, 0x2fff, jackal_voram_w },
192 	{ 0x3000, 0x3fff, jackal_spriteram_w },
193 	{ 0x4000, 0xffff, MWA_ROM },
194 	{ -1 }  /* end of table */
195 };
196 
197 static struct MemoryReadAddress jackal_sound_readmem[] =
198 {
199 	{ 0x2001, 0x2001, YM2151_status_port_0_r },
200 	{ 0x4000, 0x43ff, MRA_RAM },		/* COLOR RAM (Self test only check 0x4000-0x423f */
201 	{ 0x6000, 0x605f, MRA_RAM },		/* SOUND RAM (Self test check 0x6000-605f, 0x7c00-0x7fff */
202 	{ 0x6060, 0x7fff, jackal_commonram1_r }, /* COMMON RAM */
203 	{ 0x8000, 0xffff, MRA_ROM },
204 	{ -1 }	/* end of table */
205 };
206 
207 static struct MemoryWriteAddress jackal_sound_writemem[] =
208 {
209 	{ 0x2000, 0x2000, YM2151_register_port_0_w },
210 	{ 0x2001, 0x2001, YM2151_data_port_0_w },
211 	{ 0x4000, 0x43ff, paletteram_xBBBBBGGGGGRRRRR_w, &paletteram },
212 	{ 0x6000, 0x605f, MWA_RAM },
213 	{ 0x6060, 0x7fff, jackal_commonram1_w },
214 	{ 0x8000, 0xffff, MWA_ROM },
215 	{ -1 }	/* end of table */
216 };
217 
218 
219 
220 INPUT_PORTS_START( jackal )
221 	PORT_START	/* DSW1 */
222 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
223 	PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
224 	PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
225 	PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
226 	PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
227 	PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
228 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
229 	PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
230 	PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
231 	PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
232 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
233 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
234 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
235 	PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
236 	PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
237 	PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
238 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
239 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
240 	PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
241 	PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
242 	PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
243 	PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
244 	PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
245 	PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
246 	PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
247 	PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
248 	PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
249 	PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
250 	PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
251 	PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
252 	PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
253 	PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
254 	PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
255 	PORT_DIPSETTING(    0x00, "Invalid" )
256 
257 	PORT_START	/* IN1 */
258 	/* note that button 3 for player 1 and 2 are exchanged */
259 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
260 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
261 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
262 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
263 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
264 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
265 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
266 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
267 
268 	PORT_START	/* IN2 */
269 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
270 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
271 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
272 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
273 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
274 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
275 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
276 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
277 
278 	PORT_START	/* IN0 */
279 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
280 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
281 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
282 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
283 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
284 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
285 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
286 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
287 
288 	PORT_START	/* DSW2 */
289 	PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
290 	PORT_DIPSETTING(    0x03, "2" )
291 	PORT_DIPSETTING(    0x02, "3" )
292 	PORT_DIPSETTING(    0x01, "4" )
293 	PORT_DIPSETTING(    0x00, "7" )
294 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
295 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
296 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
297 	PORT_DIPNAME( 0x18, 0x18, DEF_STR( Bonus_Life ) )
298 	PORT_DIPSETTING(    0x18, "30000 150000" )
299 	PORT_DIPSETTING(    0x10, "50000 200000" )
300 	PORT_DIPSETTING(    0x08, "30000" )
301 	PORT_DIPSETTING(    0x00, "50000" )
302 	PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
303 	PORT_DIPSETTING(    0x60, "Easy" )
304 	PORT_DIPSETTING(    0x40, "Medium" )
305 	PORT_DIPSETTING(    0x20, "Hard" )
306 	PORT_DIPSETTING(    0x00, "Hardest" )
307 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
308 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
309 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
310 
311 	PORT_START	/* DSW3 */
312 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
313 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
314 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
315 	PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
316 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
317 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
318 	PORT_DIPNAME( 0x04, 0x00, "Sound Mode" )
319 	PORT_DIPSETTING(    0x04, "Mono" )
320 	PORT_DIPSETTING(    0x00, "Stereo" )
321 	PORT_DIPNAME( 0x08, 0x00, "Sound Adj" )
322 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
323 	PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
324 
325 	/* the rotary controls work in topgunbl only */
326 	PORT_START	/* player 1 8-way rotary control - converted in rotary_0_r() */
327 	PORT_ANALOGX( 0xff, 0x00, IPT_DIAL, 25, 10, 0, 0, JOYCODE_1_BUTTON5, JOYCODE_1_BUTTON6, 0, 0 )
328 
329 	PORT_START	/* player 2 8-way rotary control - converted in rotary_1_r() */
330 	PORT_ANALOGX( 0xff, 0x00, IPT_DIAL | IPF_PLAYER2, 25, 10, 0, 0, JOYCODE_2_BUTTON5, JOYCODE_2_BUTTON6, 0, 0 )
331 INPUT_PORTS_END
332 
333 
334 
335 static struct GfxLayout charlayout =
336 {
337 	8,8,	/* 8*8 characters */
338 	4096,	/* 4096 characters */
339 	8,	/* 8 bits per pixel (!) */
340 	{ 0, 1, 2, 3, 0x20000*8+0, 0x20000*8+1, 0x20000*8+2, 0x20000*8+3 },
341 	{ 0*4, 1*4, 0x40000*8+0*4, 0x40000*8+1*4, 2*4, 3*4, 0x40000*8+2*4, 0x40000*8+3*4 },
342 	{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
343 	16*8	/* every char takes 16 consecutive bytes */
344 };
345 
346 static struct GfxLayout spritelayout =
347 {
348 	16,16,	/* 16*16 sprites */
349 	1024,	/* 1024 sprites */
350 	4,	/* 4 bits per pixel */
351 	{ 0, 1, 2, 3 },	/* the four bitplanes are packed in one nibble */
352 	{ 0*4, 1*4, 0x40000*8+0*4, 0x40000*8+1*4, 2*4, 3*4, 0x40000*8+2*4, 0x40000*8+3*4,
353 			16*8+0*4, 16*8+1*4, 16*8+0x40000*8+0*4, 16*8+0x40000*8+1*4, 16*8+2*4, 16*8+3*4, 16*8+0x40000*8+2*4, 16*8+0x40000*8+3*4 },
354 	{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
355 			16*16, 17*16, 18*16, 19*16, 20*16, 21*16, 22*16, 23*16 },
356 	64*8	/* every sprite takes 64 consecutive bytes */
357 };
358 
359 static struct GfxLayout spritelayout8 =
360 {
361 	8,8,	/* 8*8 characters */
362 	4096,	/* 4096 characters */
363 	4,	/* 4 bits per pixel */
364 	{ 0, 1, 2, 3 },	/* the four bitplanes are packed in one nibble */
365 	{ 0*4, 1*4, 0x40000*8+0*4, 0x40000*8+1*4, 2*4, 3*4, 0x40000*8+2*4, 0x40000*8+3*4 },
366 	{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
367 	16*8	/* every char takes 16 consecutive bytes */
368 };
369 
370 static struct GfxLayout topgunbl_charlayout =
371 {
372 	8,8,	/* 8*8 characters */
373 	4096,	/* 4096 characters */
374 	8,	/* 8 bits per pixel (!) */
375 	{ 0, 1, 2, 3, 0x20000*8+0, 0x20000*8+1, 0x20000*8+2, 0x20000*8+3 },
376 	{ 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 },
377 	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
378 	32*8	/* every char takes 32 consecutive bytes */
379 };
380 
381 static struct GfxLayout topgunbl_spritelayout =
382 {
383 	16,16,	/* 16*16 sprites */
384 	1024,	/* 1024 sprites */
385 	4,	/* 4 bits per pixel */
386 	{ 0, 1, 2, 3 },
387 	{ 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4,
388 			32*8+2*4, 32*8+3*4, 32*8+0*4, 32*8+1*4, 32*8+6*4, 32*8+7*4, 32*8+4*4, 32*8+5*4 },
389 	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
390 			16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32 },
391 	128*8	/* every char takes 32 consecutive bytes */
392 };
393 
394 static struct GfxLayout topgunbl_spritelayout8 =
395 {
396 	8,8,	/* 8*8 characters */
397 	4096,	/* 4096 characters */
398 	4,	/* 4 bits per pixel */
399 	{ 0, 1, 2, 3 },
400 	{ 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 },
401 	{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
402 	32*8	/* every char takes 32 consecutive bytes */
403 };
404 
405 static struct GfxDecodeInfo jackal_gfxdecodeinfo[] =
406 {
407 	{ REGION_GFX1, 0x00000, &charlayout,          256,  1 },	/* colors 256-511 */
408 	{ REGION_GFX1, 0x10000, &spritelayout,        512, 16 },	/* colors   0- 15 with lookup */
409 	{ REGION_GFX1, 0x30000, &spritelayout,  512+16*16, 16 },	/* colors  16- 31 with lookup */
410 	{ REGION_GFX1, 0x10000, &spritelayout8,       512, 16 },  /* to handle 8x8 sprites */
411 	{ REGION_GFX1, 0x30000, &spritelayout8, 512+16*16, 16 },  /* to handle 8x8 sprites */
412 	{ -1 } /* end of array */
413 };
414 
415 static struct GfxDecodeInfo topgunbl_gfxdecodeinfo[] =
416 {
417 	{ REGION_GFX1, 0x00000, &topgunbl_charlayout,          256,  1 },	/* colors 256-511 */
418 	{ REGION_GFX1, 0x40000, &topgunbl_spritelayout,        512, 16 },	/* colors   0- 15 with lookup */
419 	{ REGION_GFX1, 0x60000, &topgunbl_spritelayout,  512+16*16, 16 },	/* colors  16- 31 with lookup */
420 	{ REGION_GFX1, 0x40000, &topgunbl_spritelayout8,       512, 16 },	/* to handle 8x8 sprites */
421 	{ REGION_GFX1, 0x60000, &topgunbl_spritelayout8, 512+16*16, 16 },	/* to handle 8x8 sprites */
422 	{ -1 } /* end of array */
423 };
424 
425 
426 
427 static struct YM2151interface ym2151_interface =
428 {
429 	1,
430 	3580000,
431 	{ YM3012_VOL(50,MIXER_PAN_LEFT,50,MIXER_PAN_RIGHT) },
432 	{ 0 },
433 };
434 
435 
436 static struct MachineDriver machine_driver_jackal =
437 {
438 	/* basic machine hardware */
439 	{
440 		{
441 			CPU_M6809,
442 			2000000,	/* 2 MHz???? */
443 			jackal_readmem,jackal_writemem,0,0,
444 			jackal_interrupt,1
445 		},
446 		{
447 			CPU_M6809,
448 			2000000,	/* 2 MHz???? */
449 			jackal_sound_readmem,jackal_sound_writemem,0,0,
450 			ignore_interrupt,1
451 		}
452 	},
453 	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
454 	10,	/* 10 CPU slices per frame - seems enough to keep the CPUs in sync */
455 	jackal_init_machine,
456 
457 	/* video hardware */
458 	32*8, 32*8, { 1*8, 31*8-1, 2*8, 30*8-1 },
459 	jackal_gfxdecodeinfo,
460 	512, 512+16*16+16*16,
461 	jackal_vh_convert_color_prom,
462 
463 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
464 	0,
465 	jackal_vh_start,
466 	jackal_vh_stop,
467 	jackal_vh_screenrefresh,
468 
469 	/* sound hardware */
470 	SOUND_SUPPORTS_STEREO,0,0,0,
471 	{
472 		{
473 			SOUND_YM2151,
474 			&ym2151_interface
475 		}
476 	}
477 };
478 
479 /* identical but different gfxdecode */
480 static struct MachineDriver machine_driver_topgunbl =
481 {
482 	/* basic machine hardware */
483 	{
484 		{
485 			CPU_M6809,
486 			2000000,	/* 2 MHz???? */
487 			jackal_readmem,jackal_writemem,0,0,
488 			jackal_interrupt,1
489 		},
490 		{
491 			CPU_M6809,
492 			2000000,	/* 2 MHz???? */
493 			jackal_sound_readmem,jackal_sound_writemem,0,0,
494 			ignore_interrupt,1
495 		}
496 	},
497 	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */
498 	10,	/* 10 CPU slices per frame - seems enough to keep the CPUs in sync */
499 	jackal_init_machine,
500 
501 	/* video hardware */
502 	32*8, 32*8, { 1*8, 31*8-1, 2*8, 30*8-1 },
503 	topgunbl_gfxdecodeinfo,
504 	512, 512,
505 	jackal_vh_convert_color_prom,
506 
507 	VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
508 	0,
509 	jackal_vh_start,
510 	jackal_vh_stop,
511 	jackal_vh_screenrefresh,
512 
513 	/* sound hardware */
514 	SOUND_SUPPORTS_STEREO,0,0,0,
515 	{
516 		{
517 			SOUND_YM2151,
518 			&ym2151_interface
519 		}
520 	}
521 };
522 
523 
524 
525 
526 /***************************************************************************
527 
528   Game driver(s)
529 
530 ***************************************************************************/
531 
532 ROM_START( jackal )
533 	ROM_REGION( 0x20000, REGION_CPU1 )	/* Banked 64k for 1st CPU */
534 	ROM_LOAD( "j-v02.rom",    0x04000, 0x8000, 0x0b7e0584 )
535 	ROM_CONTINUE(             0x14000, 0x8000 )
536 	ROM_LOAD( "j-v03.rom",    0x0c000, 0x4000, 0x3e0dfb83 )
537 
538 	ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for 2nd cpu (Graphics & Sound)*/
539 	ROM_LOAD( "631t01.bin",   0x8000, 0x8000, 0xb189af6a )
540 
541 	ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
542 	ROM_LOAD( "631t04.bin",   0x00000, 0x20000, 0x457f42f0 )
543 	ROM_LOAD( "631t06.bin",   0x20000, 0x20000, 0x2d10e56e )
544 	ROM_LOAD( "631t05.bin",   0x40000, 0x20000, 0x732b3fc1 )
545 	ROM_LOAD( "631t07.bin",   0x60000, 0x20000, 0x4961c397 )
546 
547 	ROM_REGION( 0x0200, REGION_PROMS )	/* color lookup tables */
548 	ROM_LOAD( "631r08.bpr",   0x0000, 0x0100, 0x7553a172 )
549 	ROM_LOAD( "631r09.bpr",   0x0100, 0x0100, 0xa74dd86c )
550 ROM_END
551 
552 ROM_START( topgunr )
553 	ROM_REGION( 0x20000, REGION_CPU1 )	/* Banked 64k for 1st CPU */
554 	ROM_LOAD( "tgnr15d.bin",  0x04000, 0x8000, 0xf7e28426 )
555 	ROM_CONTINUE(             0x14000, 0x8000 )
556 	ROM_LOAD( "tgnr16d.bin",  0x0c000, 0x4000, 0xc086844e )
557 
558 	ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for 2nd cpu (Graphics & Sound)*/
559 	ROM_LOAD( "631t01.bin",   0x8000, 0x8000, 0xb189af6a )
560 
561 	ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
562 	ROM_LOAD( "tgnr7h.bin",   0x00000, 0x20000, 0x50122a12 )
563 	ROM_LOAD( "tgnr12h.bin",  0x20000, 0x20000, 0x37dbbdb0 )
564 	ROM_LOAD( "tgnr8h.bin",   0x40000, 0x20000, 0x6943b1a4 )
565 	ROM_LOAD( "tgnr13h.bin",  0x60000, 0x20000, 0x22effcc8 )
566 
567 	ROM_REGION( 0x0200, REGION_PROMS )	/* color lookup tables */
568 	ROM_LOAD( "631r08.bpr",   0x0000, 0x0100, 0x7553a172 )
569 	ROM_LOAD( "631r09.bpr",   0x0100, 0x0100, 0xa74dd86c )
570 ROM_END
571 
572 ROM_START( jackalj )
573 	ROM_REGION( 0x20000, REGION_CPU1 )	/* Banked 64k for 1st CPU */
574 	ROM_LOAD( "631t02.bin",   0x04000, 0x8000, 0x14db6b1a )
575 	ROM_CONTINUE(             0x14000, 0x8000 )
576 	ROM_LOAD( "631t03.bin",   0x0c000, 0x4000, 0xfd5f9624 )
577 
578 	ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for 2nd cpu (Graphics & Sound)*/
579 	ROM_LOAD( "631t01.bin",   0x8000, 0x8000, 0xb189af6a )
580 
581 	ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
582 	ROM_LOAD( "631t04.bin",   0x00000, 0x20000, 0x457f42f0 )
583 	ROM_LOAD( "631t06.bin",   0x20000, 0x20000, 0x2d10e56e )
584 	ROM_LOAD( "631t05.bin",   0x40000, 0x20000, 0x732b3fc1 )
585 	ROM_LOAD( "631t07.bin",   0x60000, 0x20000, 0x4961c397 )
586 
587 	ROM_REGION( 0x0200, REGION_PROMS )	/* color lookup tables */
588 	ROM_LOAD( "631r08.bpr",   0x0000, 0x0100, 0x7553a172 )
589 	ROM_LOAD( "631r09.bpr",   0x0100, 0x0100, 0xa74dd86c )
590 ROM_END
591 
592 ROM_START( topgunbl )
593 	ROM_REGION( 0x20000, REGION_CPU1 )	/* Banked 64k for 1st CPU */
594 	ROM_LOAD( "t-3.c5",       0x04000, 0x8000, 0x7826ad38 )
595 	ROM_LOAD( "t-4.c4",       0x14000, 0x8000, 0x976c8431 )
596 	ROM_LOAD( "t-2.c6",       0x0c000, 0x4000, 0xd53172e5 )
597 
598 	ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for 2nd cpu (Graphics & Sound)*/
599 	ROM_LOAD( "t-1.c14",      0x8000, 0x8000, 0x54aa2d29 )
600 
601 	ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
602 	ROM_LOAD( "t-17.n12",     0x00000, 0x08000, 0xe8875110 )
603 	ROM_LOAD( "t-18.n13",     0x08000, 0x08000, 0xcf14471d )
604 	ROM_LOAD( "t-19.n14",     0x10000, 0x08000, 0x46ee5dd2 )
605 	ROM_LOAD( "t-20.n15",     0x18000, 0x08000, 0x3f472344 )
606 	ROM_LOAD( "t-13.n8",      0x20000, 0x08000, 0x5d669abb )
607 	ROM_LOAD( "t-14.n9",      0x28000, 0x08000, 0xf349369b )
608 	ROM_LOAD( "t-15.n10",     0x30000, 0x08000, 0x7c5a91dd )
609 	ROM_LOAD( "t-16.n11",     0x38000, 0x08000, 0x5ec46d8e )
610 	ROM_LOAD( "t-6.n1",       0x40000, 0x08000, 0x539cc48c )
611 	ROM_LOAD( "t-5.m1",       0x48000, 0x08000, 0x2dd9a5e9 )
612 	ROM_LOAD( "t-7.n2",       0x50000, 0x08000, 0x0ecd31b1 )
613 	ROM_LOAD( "t-8.n3",       0x58000, 0x08000, 0xf946ada7 )
614 	ROM_LOAD( "t-9.n4",       0x60000, 0x08000, 0x8269caca )
615 	ROM_LOAD( "t-10.n5",      0x68000, 0x08000, 0x25393e4f )
616 	ROM_LOAD( "t-11.n6",      0x70000, 0x08000, 0x7895c22d )
617 	ROM_LOAD( "t-12.n7",      0x78000, 0x08000, 0x15606dfc )
618 
619 	ROM_REGION( 0x0200, REGION_PROMS )	/* color lookup tables */
620 	ROM_LOAD( "631r08.bpr",   0x0000, 0x0100, 0x7553a172 )
621 	ROM_LOAD( "631r09.bpr",   0x0100, 0x0100, 0xa74dd86c )
622 ROM_END
623 
624 
625 
626 GAMEX( 1986, jackal,   0,      jackal,   jackal, 0, ROT90, "Konami", "Jackal (World)", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
627 GAMEX( 1986, topgunr,  jackal, jackal,   jackal, 0, ROT90, "Konami", "Top Gunner (US)", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
628 GAMEX( 1986, jackalj,  jackal, jackal,   jackal, 0, ROT90, "Konami", "Tokushu Butai Jackal (Japan)", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
629 GAMEX( 1987, topgunbl, jackal, topgunbl, jackal, 0, ROT90, "bootleg", "Top Gunner (bootleg)", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
630