1
/***************************************************************************
3
Tank Busters memory map
5
driver by Jaroslaw Burczynski
9
To enter the test mode:
10
reset the game and keep start1 and start2 buttons pressed.
13
- verify colors: prom to output mapping is unknown, resistor values are guess
14
- remove the 'some_changing_input' hack (see below)
15
- from time to time the game just hangs
17
***************************************************************************/
20
#include "cpu/z80/z80.h"
21
#include "sound/ay8910.h"
22
#include "includes/tankbust.h"
27
static TIMER_CALLBACK( soundlatch_callback )
29
tankbust_state *state = machine.driver_data<tankbust_state>();
30
state->m_latch = param;
33
static WRITE8_HANDLER( tankbust_soundlatch_w )
35
space->machine().scheduler().synchronize(FUNC(soundlatch_callback), data);
38
static READ8_DEVICE_HANDLER( tankbust_soundlatch_r )
40
tankbust_state *state = device->machine().driver_data<tankbust_state>();
41
return state->m_latch;
45
static READ8_DEVICE_HANDLER( tankbust_soundtimer_r )
47
tankbust_state *state = device->machine().driver_data<tankbust_state>();
51
ret = state->m_timer1;
55
static TIMER_CALLBACK( soundirqline_callback )
57
//logerror("sound_irq_line write = %2x (after CPUs synced) \n",param);
60
cputag_set_input_line(machine, "sub", 0, HOLD_LINE);
65
static WRITE8_HANDLER( tankbust_e0xx_w )
67
tankbust_state *state = space->machine().driver_data<tankbust_state>();
68
state->m_e0xx_data[offset] = data;
71
popmessage("e0: %x %x (%x cnt) %x %x %x %x",
72
state->m_e0xx_data[0], state->m_e0xx_data[1],
73
state->m_e0xx_data[2], state->m_e0xx_data[3],
74
state->m_e0xx_data[4], state->m_e0xx_data[5],
75
state->m_e0xx_data[6] );
80
case 0: /* 0xe000 interrupt enable */
81
interrupt_enable_w(space, 0, data);
84
case 1: /* 0xe001 (value 0 then 1) written right after the soundlatch_w */
85
space->machine().scheduler().synchronize(FUNC(soundirqline_callback), data);
88
case 2: /* 0xe002 coin counter */
89
coin_counter_w(space->machine(), 0, data&1);
92
case 6: /* 0xe006 screen disable ?? or disable screen update */
93
/* program sets this to 0,
100
case 7: /* 0xe007 bankswitch */
101
/* bank 1 at 0x6000-9fff = from 0x10000 when bit0=0 else from 0x14000 */
102
/* bank 2 at 0xa000-bfff = from 0x18000 when bit0=0 else from 0x1a000 */
103
memory_set_bankptr(space->machine(), "bank1", space->machine().region("maincpu")->base() + 0x10000 + ((data&1) * 0x4000) );
104
memory_set_bankptr(space->machine(), "bank2", space->machine().region("maincpu")->base() + 0x18000 + ((data&1) * 0x2000) ); /* verified (the game will reset after the "game over" otherwise) */
109
static READ8_HANDLER( debug_output_area_r )
111
tankbust_state *state = space->machine().driver_data<tankbust_state>();
112
return state->m_e0xx_data[offset];
118
static PALETTE_INIT( tankbust )
122
for (i = 0; i < 128; i++)
124
int bit0,bit1,bit2,r,g,b;
127
//bb r r r g g g - bad (for sure - no green for tank)
128
//bb g g g r r r - bad (for sure - no yellow, no red)
129
//gg r r r b b b - bad
130
//gg b b b r r r - bad
131
//rr b b b g g g - bad
133
//rr g g g b b b - very close (green,yellow,red present)
135
//rr r g g g b b - bad
136
//rr r g g b b b - bad
137
//rr g g g b b r - bad
139
//rr g g b b x x - bad (x: unused)
140
//rr g g x x b b - bad but still close
141
//rr g g r g b b - bad but still close
142
//rr g g g r b b - bad but still close
147
bit0 = (color_prom[i] >> 0) & 0x01;
148
bit1 = (color_prom[i] >> 1) & 0x01;
149
bit2 = (color_prom[i] >> 2) & 0x01;
150
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
152
/* green component */
153
bit0 = (color_prom[i] >> 3) & 0x01;
154
bit1 = (color_prom[i] >> 4) & 0x01;
155
bit2 = (color_prom[i] >> 5) & 0x01;
156
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
159
bit0 = (color_prom[i] >> 6) & 0x01;
160
bit1 = (color_prom[i] >> 7) & 0x01;
161
r = 0x55 * bit0 + 0xaa * bit1;
164
palette_set_color(machine,i,MAKE_RGB(r,g,b));
169
static READ8_HANDLER( read_from_unmapped_memory )
175
static READ8_HANDLER( some_changing_input )
177
tankbust_state *state = space->machine().driver_data<tankbust_state>();
178
state->m_variable_data += 8;
179
return state->m_variable_data;
182
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 )
183
AM_RANGE(0x0000, 0x5fff) AM_ROM
184
AM_RANGE(0x6000, 0x9fff) AM_ROMBANK("bank1")
185
AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank2")
186
AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(tankbust_background_videoram_r, tankbust_background_videoram_w) AM_BASE_MEMBER(tankbust_state, m_videoram)
187
AM_RANGE(0xc800, 0xcfff) AM_READWRITE(tankbust_background_colorram_r, tankbust_background_colorram_w) AM_BASE_MEMBER(tankbust_state, m_colorram)
188
AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(tankbust_txtram_r, tankbust_txtram_w) AM_BASE_MEMBER(tankbust_state, m_txtram)
189
AM_RANGE(0xd800, 0xd8ff) AM_RAM AM_BASE_SIZE_MEMBER(tankbust_state, m_spriteram, m_spriteram_size)
190
AM_RANGE(0xe000, 0xe007) AM_READWRITE(debug_output_area_r, tankbust_e0xx_w)
191
AM_RANGE(0xe800, 0xe800) AM_READ_PORT("INPUTS") AM_WRITE(tankbust_yscroll_w)
192
AM_RANGE(0xe801, 0xe801) AM_READ_PORT("SYSTEM")
193
AM_RANGE(0xe802, 0xe802) AM_READ_PORT("DSW")
194
AM_RANGE(0xe801, 0xe802) AM_WRITE(tankbust_xscroll_w)
195
AM_RANGE(0xe803, 0xe803) AM_READWRITE(some_changing_input, tankbust_soundlatch_w) /*unknown. Game expects this to change so this is not player input */
196
AM_RANGE(0xe804, 0xe804) AM_WRITENOP /* watchdog ? ; written in long-lasting loops */
197
AM_RANGE(0xf000, 0xf7ff) AM_RAM
198
//AM_RANGE(0xf800, 0xffff) AM_READ(read_from_unmapped_memory) /* a bug in game code ? */
201
static ADDRESS_MAP_START( port_map_cpu2, AS_IO, 8 )
202
ADDRESS_MAP_GLOBAL_MASK(0xff)
203
AM_RANGE(0x10, 0x10) AM_DEVWRITE("ay2", ay8910_data_w)
204
AM_RANGE(0x30, 0x30) AM_DEVREADWRITE("ay2", ay8910_r, ay8910_address_w)
205
AM_RANGE(0x40, 0x40) AM_DEVWRITE("ay1", ay8910_data_w)
206
AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("ay1", ay8910_r, ay8910_address_w)
210
static ADDRESS_MAP_START( map_cpu2, AS_PROGRAM, 8 )
211
AM_RANGE(0x0000, 0x1fff) AM_ROM
212
AM_RANGE(0x2000, 0x3fff) AM_WRITENOP /* garbage, written in initialization loop */
213
//0x4000 and 0x4040-0x4045 seem to be used (referenced in the code)
214
AM_RANGE(0x4000, 0x7fff) AM_WRITENOP /* garbage, written in initialization loop */
215
AM_RANGE(0x8000, 0x87ff) AM_READONLY
216
AM_RANGE(0x8000, 0x87ff) AM_WRITEONLY
220
static INPUT_PORTS_START( tankbust )
222
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
223
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
224
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
225
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
226
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
227
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
228
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
229
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
232
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
233
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
234
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
235
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 )
236
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
237
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
238
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
239
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
242
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
243
PORT_DIPSETTING( 0x03, DEF_STR( Easy ) )
244
PORT_DIPSETTING( 0x02, DEF_STR( Hard ) )
245
PORT_DIPSETTING( 0x01, DEF_STR( Normal ) )
246
PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) )
247
PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
248
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
249
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
250
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Language ) )
251
PORT_DIPSETTING( 0x08, DEF_STR( English ) )
252
PORT_DIPSETTING( 0x00, DEF_STR( French ) )
253
PORT_DIPNAME( 0x10, 0x00, DEF_STR( Bonus_Life ) )
254
PORT_DIPSETTING( 0x10, "No Bonus" )
255
PORT_DIPSETTING( 0x00, "60000" )
256
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Coinage ) )
257
PORT_DIPSETTING( 0x20, "1C/1C 1C/2C 1C/6C 1C/14C" )
258
PORT_DIPSETTING( 0x00, "2C/1C 1C/1C 1C/3C 1C/7C" )
259
PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Lives ) )
260
PORT_DIPSETTING( 0xc0, "1" )
261
PORT_DIPSETTING( 0x80, "2" )
262
PORT_DIPSETTING( 0x40, "3" )
263
PORT_DIPSETTING( 0x00, "4" )
266
static const gfx_layout spritelayout =
268
32,32, /* 32*32 pixels */
270
4, /* 4 bits per pixel */
271
{ 0, 8192*8*1, 8192*8*2, 8192*8*3 },
272
{ 0, 1, 2, 3, 4, 5, 6, 7,
273
8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7,
274
32*8+0, 32*8+1, 32*8+2, 32*8+3, 32*8+4, 32*8+5, 32*8+6, 32*8+7,
275
40*8+0, 40*8+1, 40*8+2, 40*8+3, 40*8+4, 40*8+5, 40*8+6, 40*8+7 },
276
{ 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8,
277
23*8, 22*8, 21*8, 20*8, 19*8, 18*8, 17*8, 16*8,
278
71*8, 70*8, 69*8, 68*8, 67*8, 66*8, 65*8, 64*8,
279
87*8, 86*8, 85*8, 84*8, 83*8, 82*8, 81*8, 80*8 },
280
128*8 /* every sprite takes 128 consecutive bytes */
283
static const gfx_layout charlayout =
285
8,8, /* 8*8 pixels */
286
2048, /* 2048 characters */
287
3, /* 3 bits per pixel */
288
{ 0, 16384*8*1, 16384*8*2 },
289
{ 0, 1, 2, 3, 4, 5, 6, 7 },
290
{ 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
291
8*8 /* every char takes 8 consecutive bytes */
294
static const gfx_layout charlayout2 =
296
8,8, /* 8*8 pixels */
297
256, /* 256 characters */
298
1, /* 1 bit per pixel - the data repeats 4 times within one ROM */
299
{ 0 }, /* , 2048*8*1, 2048*8*2, 2048*8*3 },*/
300
{ 0, 1, 2, 3, 4, 5, 6, 7 },
301
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
302
8*8 /* every char takes 8 consecutive bytes */
305
static GFXDECODE_START( tankbust )
306
GFXDECODE_ENTRY( "gfx1", 0, spritelayout, 0x00, 2 ) /* sprites 32x32 (2 * 16 colors) */
307
GFXDECODE_ENTRY( "gfx2", 0, charlayout, 0x20, 8 ) /* bg tilemap characters */
308
GFXDECODE_ENTRY( "gfx3", 0, charlayout2, 0x60, 16 ) /* txt tilemap characters*/
311
static const ay8910_interface ay8910_config =
313
AY8910_LEGACY_OUTPUT,
314
AY8910_DEFAULT_LOADS,
315
DEVCB_HANDLER(tankbust_soundlatch_r),
316
DEVCB_HANDLER(tankbust_soundtimer_r),
321
static MACHINE_RESET( tankbust )
323
tankbust_state *state = machine.driver_data<tankbust_state>();
324
state->m_variable_data = 0x11;
328
static MACHINE_CONFIG_START( tankbust, tankbust_state )
330
/* basic machine hardware */
331
MCFG_CPU_ADD("maincpu", Z80, XTAL_14_31818MHz/2) /* Verified on PCB */
332
MCFG_CPU_PROGRAM_MAP(main_map)
333
MCFG_CPU_VBLANK_INT("screen", irq0_line_hold)
335
MCFG_CPU_ADD("sub", Z80, XTAL_14_31818MHz/4) /* Verified on PCB */
336
// MCFG_CPU_ADD("sub", Z80, XTAL_14_31818MHz/3) /* Accurate to audio recording, but apparently incorrect clock */
338
MCFG_CPU_PROGRAM_MAP(map_cpu2)
339
MCFG_CPU_IO_MAP(port_map_cpu2)
341
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
343
MCFG_MACHINE_RESET( tankbust )
346
MCFG_SCREEN_ADD("screen", RASTER)
347
MCFG_SCREEN_REFRESH_RATE(60)
348
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
349
MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
350
MCFG_SCREEN_SIZE ( 64*8, 32*8 )
351
MCFG_SCREEN_VISIBLE_AREA ( 16*8, 56*8-1, 1*8, 31*8-1 )
352
// MCFG_SCREEN_VISIBLE_AREA ( 0*8, 64*8-1, 1*8, 31*8-1 )
353
MCFG_SCREEN_UPDATE ( tankbust )
355
MCFG_GFXDECODE( tankbust )
357
MCFG_PALETTE_LENGTH( 128 )
358
MCFG_PALETTE_INIT ( tankbust )
360
MCFG_VIDEO_START ( tankbust )
363
MCFG_SPEAKER_STANDARD_MONO("mono")
365
MCFG_SOUND_ADD("ay1", AY8910, XTAL_14_31818MHz/16) /* Verified on PCB */
366
MCFG_SOUND_CONFIG(ay8910_config)
367
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
369
MCFG_SOUND_ADD("ay2", AY8910, XTAL_14_31818MHz/16) /* Verified on PCB */
370
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
374
/***************************************************************************
378
***************************************************************************/
380
ROM_START( tankbust )
381
ROM_REGION( 0x1c000, "maincpu", 0 )
382
ROM_LOAD( "a-s4-6.bin", 0x00000, 0x4000, CRC(8ebe7317) SHA1(bc45d530ad6335312c9c3efdcedf7acd2cdeeb55) )
383
ROM_LOAD( "a-s7-9.bin", 0x04000, 0x2000, CRC(047aee33) SHA1(62ee776c403b228e065baa9218f32597951ca935) )
385
ROM_LOAD( "a-s5_7.bin", 0x12000, 0x2000, CRC(dd4800ca) SHA1(73a6caa029c27fb45217f9372d9541c6fe206f08) ) /* banked at 0x6000-0x9fff */
386
ROM_CONTINUE( 0x10000, 0x2000)
388
ROM_LOAD( "a-s6-8.bin", 0x16000, 0x2000, CRC(f8801238) SHA1(fd3abe18542660a8c31dc316012a99d48c9bb5aa) ) /* banked at 0x6000-0x9fff */
389
ROM_CONTINUE( 0x14000, 0x2000)
391
// ROM_LOAD( "a-s5_7.bin", 0x10000, 0x4000, CRC(dd4800ca) SHA1(73a6caa029c27fb45217f9372d9541c6fe206f08) ) /* banked at 0x6000-0x9fff */
392
// ROM_LOAD( "a-s6-8.bin", 0x14000, 0x4000, CRC(f8801238) SHA1(fd3abe18542660a8c31dc316012a99d48c9bb5aa) ) /* banked at 0x6000-0x9fff */
394
ROM_LOAD( "a-s8-10.bin", 0x18000, 0x4000, CRC(9e826faa) SHA1(6a252428c69133d3e9d7a9938140d5ae37fb0c7d) ) /* banked at 0xa000-0xbfff */
396
ROM_REGION( 0x10000, "sub", 0 )
397
ROM_LOAD( "a-b3-1.bin", 0x0000, 0x2000, CRC(b0f56102) SHA1(4f427c3bd6131b7cba42a0e24a69bd1b6a1b0a3c) )
399
ROM_REGION( 0x8000, "gfx1", 0 )
400
ROM_LOAD( "a-d5-2.bin", 0x0000, 0x2000, CRC(0bbf3fdb) SHA1(035c2db6eca701be690042e006c0d07c90d752f1) ) /* sprites 32x32 */
401
ROM_LOAD( "a-d6-3.bin", 0x2000, 0x2000, CRC(4398dc21) SHA1(3b23433d0c9daa554ad6615af2fdec715e4e3794) )
402
ROM_LOAD( "a-d7-4.bin", 0x4000, 0x2000, CRC(aca197fc) SHA1(03ecd94b84a31389539074079ed7f2a500e588ab) )
403
ROM_LOAD( "a-d8-5.bin", 0x6000, 0x2000, CRC(1e6edc17) SHA1(4dbc91938c999348bcbd5f960fc3bb49f3174059) )
405
ROM_REGION( 0xc000, "gfx2", ROMREGION_INVERT )
406
ROM_LOAD( "b-m4-11.bin", 0x0000, 0x4000, CRC(eb88ee1f) SHA1(60ec2d77186c196a27278b0639cbfa838986e2e2) ) /* background tilemap characters 8x8 */
407
ROM_LOAD( "b-m5-12.bin", 0x4000, 0x4000, CRC(4c65f399) SHA1(72db15884f346c001d3b86cb33e3f6d339eedb56) )
408
ROM_LOAD( "b-m6-13.bin", 0x8000, 0x4000, CRC(a5baa413) SHA1(dc772042706c3a92594ee8422aafed77375c0632) )
410
ROM_REGION( 0x2000, "gfx3", 0 )
411
ROM_LOAD( "b-r3-14.bin", 0x0000, 0x2000, CRC(4310a815) SHA1(bf58a7a8d3f82fcaa0c46d9ebb13cac1231b80ad) ) /* text tilemap characters 8x8 */
413
ROM_REGION( 0x0080, "proms", 0 )
414
ROM_LOAD( "tb-prom.1s8", 0x0000, 0x0020, CRC(dfaa086c) SHA1(f534aedddd18addd0833a3a28a4297689c4a46ac) ) //sprites
415
ROM_LOAD( "tb-prom.2r8", 0x0020, 0x0020, CRC(ec50d674) SHA1(64c8961eca33b23e14b7383eb7e64fcac8772ee7) ) //background
416
ROM_LOAD( "tb-prom.3p8", 0x0040, 0x0020, CRC(3e70eafd) SHA1(b200350a3f6c166228706734419dd3ef1207eeef) ) //background palette 2 ??
417
ROM_LOAD( "tb-prom.4k8", 0x0060, 0x0020, CRC(624f40d2) SHA1(8421f1d774afc72e0817d41edae74a2837021a5f) ) //text
421
GAME( 1985, tankbust, 0, tankbust, tankbust, 0, ROT90, "Valadon Automation", "Tank Busters", 0 )