1
/****************************************************************************
3
Gunbuster (c) 1992 Taito
5
Driver by Bryan McPhail & David Graves.
11
OSC. : 40.000MHz 16.000MHz 30.47618MHz
13
* This board (K11J0717A) uses following chips:
20
Gunbuster uses a slightly enhanced sprite system from the one
23
The key feature remains the use of a sprite map rom which allows
24
the sprite hardware to create many large zoomed sprites on screen
25
while minimizing the main cpu load.
27
This feature makes the SZ system complementary to the F3 system
28
which, owing to its F2 sprite hardware, is not very well suited to
29
3d games. (Taito abandoned the SZ system once better 3d hardware
30
platforms were available in the mid 1990s.)
32
Gunbuster also uses the TC0480SCP tilemap chip (like the last Taito
37
FLIPX support in taitoic.c is not quite correct - the Taito logo is wrong,
38
and the floor in the Doom levels has horizontal scrolling where it shouldn't.
40
No networked machine support
42
Coin lockout not working (see gunbustr_input_w): perhaps this
43
was a prototype version without proper coin handling?
45
***************************************************************************/
48
#include "cpu/m68000/m68000.h"
49
#include "video/taitoic.h"
50
#include "machine/eeprom.h"
51
#include "sound/es5506.h"
52
#include "audio/taito_en.h"
53
#include "includes/gunbustr.h"
56
/*********************************************************************/
58
static TIMER_CALLBACK( gunbustr_interrupt5 )
60
cputag_set_input_line(machine, "maincpu", 5, HOLD_LINE);
63
static INTERRUPT_GEN( gunbustr_interrupt )
65
device->machine().scheduler().timer_set(downcast<cpu_device *>(device)->cycles_to_attotime(200000-500), FUNC(gunbustr_interrupt5));
66
device_set_input_line(device, 4, HOLD_LINE);
69
static WRITE32_HANDLER( gunbustr_palette_w )
72
COMBINE_DATA(&space->machine().generic.paletteram.u32[offset]);
74
a = space->machine().generic.paletteram.u32[offset] >> 16;
75
palette_set_color_rgb(space->machine(),offset*2,pal5bit(a >> 10),pal5bit(a >> 5),pal5bit(a >> 0));
77
a = space->machine().generic.paletteram.u32[offset] &0xffff;
78
palette_set_color_rgb(space->machine(),offset*2+1,pal5bit(a >> 10),pal5bit(a >> 5),pal5bit(a >> 0));
81
static CUSTOM_INPUT( coin_word_r )
83
gunbustr_state *state = field.machine().driver_data<gunbustr_state>();
84
return state->m_coin_word;
87
static WRITE32_HANDLER( gunbustr_input_w )
89
gunbustr_state *state = space->machine().driver_data<gunbustr_state>();
94
COMBINE_DATA(&state->m_mem[offset]);
96
sprintf(t,"%08x %08x",state->m_mem[0],state->m_mem[1]);
105
if (ACCESSING_BITS_24_31) /* $400000 is watchdog */
107
watchdog_reset(space->machine());
110
if (ACCESSING_BITS_0_7)
112
eeprom_device *eeprom = space->machine().device<eeprom_device>("eeprom");
113
eeprom->set_clock_line((data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
114
eeprom->write_bit(data & 0x40);
115
eeprom->set_cs_line((data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
123
if (ACCESSING_BITS_24_31)
125
/* game does not write a separate counter for coin 2!
126
It should disable both coins when 9 credits reached
127
see code $1d8a-f6... but for some reason it's not */
128
coin_lockout_w(space->machine(), 0, data & 0x01000000);
129
coin_lockout_w(space->machine(), 1, data & 0x02000000);
130
coin_counter_w(space->machine(), 0, data & 0x04000000);
131
coin_counter_w(space->machine(), 1, data & 0x04000000);
132
state->m_coin_word = (data >> 16) &0xffff;
134
//logerror("CPU #0 PC %06x: write input %06x\n",cpu_get_pc(&space->device()),offset);
139
static WRITE32_HANDLER( motor_control_w )
142
Standard value poked into MSW is 0x3c00
143
(0x2000 and zero are written at startup)
146
if (data & 0x1000000)
148
output_set_value("Player1_Gun_Recoil",1);
152
output_set_value("Player1_Gun_Recoil",0);
157
output_set_value("Player2_Gun_Recoil",1);
161
output_set_value("Player2_Gun_Recoil",0);
166
output_set_value("Hit_lamp",1);
170
output_set_value("Hit_lamp",0);
177
static READ32_HANDLER( gunbustr_gun_r )
179
return ( input_port_read(space->machine(), "LIGHT0_X") << 24) | (input_port_read(space->machine(), "LIGHT0_Y") << 16) |
180
( input_port_read(space->machine(), "LIGHT1_X") << 8) | input_port_read(space->machine(), "LIGHT1_Y");
183
static WRITE32_HANDLER( gunbustr_gun_w )
185
/* 10000 cycle delay is arbitrary */
186
space->machine().scheduler().timer_set(downcast<cpu_device *>(&space->device())->cycles_to_attotime(10000), FUNC(gunbustr_interrupt5));
190
/***********************************************************
192
***********************************************************/
194
static ADDRESS_MAP_START( gunbustr_map, AS_PROGRAM, 32 )
195
AM_RANGE(0x000000, 0x0fffff) AM_ROM
196
AM_RANGE(0x200000, 0x21ffff) AM_RAM AM_BASE_MEMBER(gunbustr_state, m_ram) /* main CPUA ram */
197
AM_RANGE(0x300000, 0x301fff) AM_RAM AM_BASE_SIZE_MEMBER(gunbustr_state, m_spriteram, m_spriteram_size) /* Sprite ram */
198
AM_RANGE(0x380000, 0x380003) AM_WRITE(motor_control_w) /* motor, lamps etc. */
199
AM_RANGE(0x390000, 0x3907ff) AM_RAM AM_SHARE("f3_shared") /* Sound shared ram */
200
AM_RANGE(0x400000, 0x400003) AM_READ_PORT("P1_P2")
201
AM_RANGE(0x400004, 0x400007) AM_READ_PORT("SYSTEM")
202
AM_RANGE(0x400000, 0x400007) AM_WRITE(gunbustr_input_w) /* eerom etc. */
203
AM_RANGE(0x500000, 0x500003) AM_READWRITE(gunbustr_gun_r, gunbustr_gun_w) /* gun coord read */
204
AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE("tc0480scp", tc0480scp_long_r, tc0480scp_long_w)
205
AM_RANGE(0x830000, 0x83002f) AM_DEVREADWRITE("tc0480scp", tc0480scp_ctrl_long_r, tc0480scp_ctrl_long_w)
206
AM_RANGE(0x900000, 0x901fff) AM_RAM_WRITE(gunbustr_palette_w) AM_BASE_GENERIC(paletteram) /* Palette ram */
207
AM_RANGE(0xc00000, 0xc03fff) AM_RAM /* network ram ?? */
210
/***********************************************************
211
INPUT PORTS (dips in eprom)
212
***********************************************************/
214
static INPUT_PORTS_START( gunbustr )
216
PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) /* Freeze input */
217
PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_UNKNOWN )
218
PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_UNKNOWN )
219
PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_UNKNOWN )
220
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_UNKNOWN )
221
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNKNOWN )
222
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
223
PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
224
PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
225
PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
226
PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
227
PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
228
PORT_BIT( 0x00001000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
229
PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
230
PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
231
PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
233
PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_UNKNOWN )
234
PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_UNKNOWN )
235
PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_UNKNOWN )
236
PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_UNKNOWN )
237
PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_UNKNOWN )
238
PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_UNKNOWN )
239
PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_UNKNOWN )
240
PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNKNOWN )
241
PORT_BIT( 0x01000000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
242
PORT_BIT( 0x02000000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
243
PORT_BIT( 0x04000000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
244
PORT_BIT( 0x08000000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
245
PORT_BIT( 0x10000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
246
PORT_BIT( 0x20000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
247
PORT_BIT( 0x40000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
248
PORT_BIT( 0x80000000, IP_ACTIVE_LOW, IPT_UNKNOWN )
251
PORT_SERVICE_NO_TOGGLE( 0x00000001, IP_ACTIVE_LOW )
252
PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_SERVICE1 )
253
PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_COIN1 )
254
PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_COIN2 )
255
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_START1 )
256
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_START2 )
257
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
258
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN )
259
PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_UNKNOWN )
260
PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_UNKNOWN )
261
PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_UNKNOWN )
262
PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_UNKNOWN )
263
PORT_BIT( 0x00001000, IP_ACTIVE_LOW, IPT_UNKNOWN )
264
PORT_BIT( 0x00002000, IP_ACTIVE_LOW, IPT_UNKNOWN )
265
PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_UNKNOWN )
266
PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNKNOWN )
267
PORT_BIT( 0xffff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_word_r, NULL)
269
/* Light gun inputs */
271
PORT_START("LIGHT0_X")
272
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(1)
274
PORT_START("LIGHT0_Y")
275
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(1)
277
PORT_START("LIGHT1_X")
278
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(2)
280
PORT_START("LIGHT1_Y")
281
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(2)
285
/***********************************************************
287
**********************************************************/
289
static const gfx_layout tile16x16_layout =
291
16,16, /* 16*16 sprites */
293
4, /* 4 bits per pixel */
295
{ 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, 4, 5, 6, 7 },
296
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
297
8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
298
64*16 /* every sprite takes 128 consecutive bytes */
301
static const gfx_layout charlayout =
303
16,16, /* 16*16 characters */
305
4, /* 4 bits per pixel */
307
{ 1*4, 0*4, 5*4, 4*4, 3*4, 2*4, 7*4, 6*4, 9*4, 8*4, 13*4, 12*4, 11*4, 10*4, 15*4, 14*4 },
308
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
309
128*8 /* every sprite takes 128 consecutive bytes */
312
static GFXDECODE_START( gunbustr )
313
GFXDECODE_ENTRY( "gfx2", 0x0, tile16x16_layout, 0, 512 )
314
GFXDECODE_ENTRY( "gfx1", 0x0, charlayout, 0, 512 )
318
/***********************************************************
320
***********************************************************/
322
static const eeprom_interface gunbustr_eeprom_interface =
324
6, /* address bits */
326
"0110", /* read command */
327
"0101", /* write command */
328
"0111", /* erase command */
329
"0100000000", /* unlock command */
330
"0100110000", /* lock command */
333
static const tc0480scp_interface gunbustr_tc0480scp_intf =
335
1, 2, /* gfxnum, txnum */
337
0x20, 0x07, /* x_offset, y_offset */
338
-1, -1, /* text_xoff, text_yoff */
339
-1, 0, /* flip_xoff, flip_yoff */
343
static MACHINE_CONFIG_START( gunbustr, gunbustr_state )
345
/* basic machine hardware */
346
MCFG_CPU_ADD("maincpu", M68EC020, 16000000) /* 16 MHz */
347
MCFG_CPU_PROGRAM_MAP(gunbustr_map)
348
MCFG_CPU_VBLANK_INT("screen", gunbustr_interrupt) /* VBL */
350
MCFG_EEPROM_ADD("eeprom", gunbustr_eeprom_interface)
353
MCFG_SCREEN_ADD("screen", RASTER)
354
MCFG_SCREEN_REFRESH_RATE(60)
355
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
356
MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
357
MCFG_SCREEN_SIZE(40*8, 32*8)
358
MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 2*8, 32*8-1)
359
MCFG_SCREEN_UPDATE(gunbustr)
361
MCFG_GFXDECODE(gunbustr)
362
MCFG_PALETTE_LENGTH(8192)
364
MCFG_VIDEO_START(gunbustr)
366
MCFG_TC0480SCP_ADD("tc0480scp", gunbustr_tc0480scp_intf)
369
MCFG_FRAGMENT_ADD(taito_f3_sound)
372
/***************************************************************************/
374
ROM_START( gunbustr )
375
ROM_REGION( 0x100000, "maincpu", 0 ) /* 1024K for 68020 code (CPU A) */
376
ROM_LOAD32_BYTE( "d27-23.bin", 0x00000, 0x40000, CRC(cd1037cc) SHA1(8005a6a84081ce609e7a605ec8e00e740bfc6846) )
377
ROM_LOAD32_BYTE( "d27-22.bin", 0x00001, 0x40000, CRC(475949fc) SHA1(3d5aa3411d2618004902f9d05dff61d9af01ff35) )
378
ROM_LOAD32_BYTE( "d27-21.bin", 0x00002, 0x40000, CRC(60950a8a) SHA1(a0336bf6970baa6eaa998a112db840a7fd0452d7) )
379
ROM_LOAD32_BYTE( "d27-20.bin", 0x00003, 0x40000, CRC(13735c60) SHA1(65b762b28d51b295f6fe190420af566b1b3d4a82) )
381
ROM_REGION( 0x140000, "audiocpu", 0 ) /* Sound cpu */
382
ROM_LOAD16_BYTE( "d27-25.bin", 0x100000, 0x20000, CRC(c88203cf) SHA1(a918d395b471acdce56dacabd7a1e1e023948365) )
383
ROM_LOAD16_BYTE( "d27-24.bin", 0x100001, 0x20000, CRC(084bd8bd) SHA1(93229bc7de4550ead1bb12f666ddbacbe357488d) )
385
ROM_REGION( 0x100000, "gfx1", 0 )
386
ROM_LOAD16_BYTE( "d27-01.bin", 0x00000, 0x80000, CRC(f41759ce) SHA1(30789f43dd09b56399e1dfdb8c6a1e01a21562bd) ) /* SCR 16x16 tiles */
387
ROM_LOAD16_BYTE( "d27-02.bin", 0x00001, 0x80000, CRC(92ab6430) SHA1(28ed80391c732b09d10c74ed6b78ac76cb62e083) )
389
ROM_REGION( 0x400000, "gfx2", 0 )
390
ROM_LOAD32_BYTE( "d27-04.bin", 0x000003, 0x100000, CRC(ff8b9234) SHA1(6095b7daf9b7e9a22b0d44d9d6a642ddecb2bd29) ) /* OBJ 16x16 tiles: each rom has 1 bitplane */
391
ROM_LOAD32_BYTE( "d27-05.bin", 0x000002, 0x100000, CRC(96d7c1a5) SHA1(93b6a7aea397280a5a778e736d433a85cb7da52c) )
392
ROM_LOAD32_BYTE( "d27-06.bin", 0x000001, 0x100000, CRC(bbb934db) SHA1(9e9b5cf05b9275f1182f5b499b8ee897c4f25b96) )
393
ROM_LOAD32_BYTE( "d27-07.bin", 0x000000, 0x100000, CRC(8ab4854e) SHA1(bd2750cdaa2918e56f8aef3732875952a1eeafea) )
395
ROM_REGION16_LE( 0x80000, "user1", 0 )
396
ROM_LOAD16_WORD( "d27-03.bin", 0x00000, 0x80000, CRC(23bf2000) SHA1(49b29e771a47fcd7e6cd4e2704b217f9727f8299) ) /* STY, used to create big sprites on the fly */
398
ROM_REGION16_BE( 0x800000, "ensoniq.0" , ROMREGION_ERASE00 )
399
ROM_LOAD16_BYTE( "d27-08.bin", 0x000000, 0x100000, CRC(7c147e30) SHA1(b605045154967050ec06391798da4afe3686a6e1) ) // C8, C9
400
ROM_RELOAD(0x400000,0x100000)
401
ROM_LOAD16_BYTE( "d27-09.bin", 0x200000, 0x100000, CRC(3e060304) SHA1(c4da4a94c168c3a454409d758c3ed45babbab170) ) // CA, CB
402
ROM_LOAD16_BYTE( "d27-10.bin", 0x600000, 0x100000, CRC(ed894fe1) SHA1(5bf2fb6abdcf25bc525a2c3b29dbf7aca0b18fea) ) // -std-
404
ROM_REGION16_BE( 0x80, "eeprom", 0 )
405
ROM_LOAD16_WORD( "eeprom-gunbustr.bin", 0x0000, 0x0080, CRC(af7dc017) SHA1(5ff106cccd2679025cdd81fbc133d32148e2818c) )
408
static READ32_HANDLER( main_cycle_r )
410
gunbustr_state *state = space->machine().driver_data<gunbustr_state>();
411
if (cpu_get_pc(&space->device())==0x55a && (state->m_ram[0x3acc/4]&0xff000000)==0)
412
device_spin_until_interrupt(&space->device());
414
return state->m_ram[0x3acc/4];
417
static DRIVER_INIT( gunbustr )
419
/* Speedup handler */
420
machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x203acc, 0x203acf, FUNC(main_cycle_r));
423
GAME( 1992, gunbustr, 0, gunbustr, gunbustr, gunbustr, ORIENTATION_FLIP_X, "Taito Corporation", "Gunbuster (Japan)", 0 )