66
63
device_set_input_line(device, 4, HOLD_LINE);
69
static WRITE32_HANDLER( gunbustr_palette_w )
66
WRITE32_MEMBER(gunbustr_state::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]);
69
COMBINE_DATA(&m_generic_paletteram_32[offset]);
71
a = m_generic_paletteram_32[offset] >> 16;
72
palette_set_color_rgb(machine(),offset*2,pal5bit(a >> 10),pal5bit(a >> 5),pal5bit(a >> 0));
74
a = m_generic_paletteram_32[offset] &0xffff;
75
palette_set_color_rgb(machine(),offset*2+1,pal5bit(a >> 10),pal5bit(a >> 5),pal5bit(a >> 0));
78
CUSTOM_INPUT_MEMBER(gunbustr_state::coin_word_r)
83
WRITE32_MEMBER(gunbustr_state::gunbustr_input_w)
105
if (ACCESSING_BITS_24_31) /* $400000 is watchdog */
89
if (ACCESSING_BITS_24_31)
107
watchdog_reset(space->machine());
91
/* $400000 is watchdog */
92
machine().watchdog_reset();
110
95
if (ACCESSING_BITS_0_7)
112
eeprom_device *eeprom = space->machine().device<eeprom_device>("eeprom");
97
eeprom_device *eeprom = machine().device<eeprom_device>("eeprom");
113
98
eeprom->set_clock_line((data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
114
99
eeprom->write_bit(data & 0x40);
115
100
eeprom->set_cs_line((data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
123
107
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;
111
coin_lockout_w(machine(), 0, ~data & 0x01000000);
112
coin_lockout_w(machine(), 1, ~data & 0x02000000);
115
// game does not write a separate counter for coin 2! maybe in linked mode?
116
coin_counter_w(machine(), 0, data & 0x04000000);
117
coin_counter_w(machine(), 1, data & 0x04000000);
118
m_coin_word = (data >> 16) &0xffff;
134
//logerror("CPU #0 PC %06x: write input %06x\n",cpu_get_pc(&space->device()),offset);
120
//logerror("CPU #0 PC %06x: write input %06x\n",cpu_get_pc(&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 )
126
WRITE32_MEMBER(gunbustr_state::motor_control_w)
128
// Standard value poked into MSW is 0x3c00
129
// (0x2000 and zero are written at startup)
130
output_set_value("Player1_Gun_Recoil", (data & 0x1000000) ? 1 : 0);
131
output_set_value("Player2_Gun_Recoil", (data & 0x10000) ? 1 : 0);
132
output_set_value("Hit_lamp", (data & 0x40000) ? 1 : 0);
137
READ32_MEMBER(gunbustr_state::gunbustr_gun_r)
139
return ( ioport("LIGHT0_X")->read() << 24) | (ioport("LIGHT0_Y")->read() << 16) |
140
( ioport("LIGHT1_X")->read() << 8) | ioport("LIGHT1_Y")->read();
143
WRITE32_MEMBER(gunbustr_state::gunbustr_gun_w)
185
145
/* 10000 cycle delay is arbitrary */
186
space->machine().scheduler().timer_set(downcast<cpu_device *>(&space->device())->cycles_to_attotime(10000), FUNC(gunbustr_interrupt5));
146
machine().scheduler().timer_set(downcast<cpu_device *>(&space.device())->cycles_to_attotime(10000), FUNC(gunbustr_interrupt5));
191
151
MEMORY STRUCTURES
192
152
***********************************************************/
194
static ADDRESS_MAP_START( gunbustr_map, AS_PROGRAM, 32 )
154
static ADDRESS_MAP_START( gunbustr_map, AS_PROGRAM, 32, gunbustr_state )
195
155
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 */
156
AM_RANGE(0x200000, 0x21ffff) AM_RAM AM_SHARE("ram") /* main CPUA ram */
157
AM_RANGE(0x300000, 0x301fff) AM_RAM AM_SHARE("spriteram") /* Sprite ram */
198
158
AM_RANGE(0x380000, 0x380003) AM_WRITE(motor_control_w) /* motor, lamps etc. */
199
159
AM_RANGE(0x390000, 0x3907ff) AM_RAM AM_SHARE("f3_shared") /* Sound shared ram */
200
160
AM_RANGE(0x400000, 0x400003) AM_READ_PORT("P1_P2")
201
161
AM_RANGE(0x400004, 0x400007) AM_READ_PORT("SYSTEM")
202
162
AM_RANGE(0x400000, 0x400007) AM_WRITE(gunbustr_input_w) /* eerom etc. */
203
163
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 */
164
AM_RANGE(0x800000, 0x80ffff) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_long_r, tc0480scp_long_w)
165
AM_RANGE(0x830000, 0x83002f) AM_DEVREADWRITE_LEGACY("tc0480scp", tc0480scp_ctrl_long_r, tc0480scp_ctrl_long_w)
166
AM_RANGE(0x900000, 0x901fff) AM_RAM_WRITE(gunbustr_palette_w) AM_SHARE("paletteram") /* Palette ram */
207
167
AM_RANGE(0xc00000, 0xc03fff) AM_RAM /* network ram ?? */
333
293
static const tc0480scp_interface gunbustr_tc0480scp_intf =
335
1, 2, /* gfxnum, txnum */
295
1, 2, /* gfxnum, txnum */
337
297
0x20, 0x07, /* x_offset, y_offset */
338
-1, -1, /* text_xoff, text_yoff */
339
-1, 0, /* flip_xoff, flip_yoff */
298
-1, -1, /* text_xoff, text_yoff */
299
-1, 0, /* flip_xoff, flip_yoff */
343
303
static MACHINE_CONFIG_START( gunbustr, gunbustr_state )
345
305
/* basic machine hardware */
346
MCFG_CPU_ADD("maincpu", M68EC020, 16000000) /* 16 MHz */
306
MCFG_CPU_ADD("maincpu", M68EC020, XTAL_16MHz)
347
307
MCFG_CPU_PROGRAM_MAP(gunbustr_map)
348
308
MCFG_CPU_VBLANK_INT("screen", gunbustr_interrupt) /* VBL */
469
429
ROM_LOAD16_BYTE( "d27-10.bin", 0x600000, 0x100000, CRC(ed894fe1) SHA1(5bf2fb6abdcf25bc525a2c3b29dbf7aca0b18fea) ) // -std-
471
431
ROM_REGION16_BE( 0x80, "eeprom", 0 )
472
ROM_LOAD16_WORD( "eeprom-gunbustr.bin", 0x0000, 0x0080, CRC(af7dc017) SHA1(5ff106cccd2679025cdd81fbc133d32148e2818c) )
432
ROM_LOAD16_WORD( "eeprom-gunbustr.bin", 0x0000, 0x0080, CRC(ef3685a1) SHA1(899b4b6dd2fd78be3a2ce00a2ef1840de9f122c3) )
475
static READ32_HANDLER( main_cycle_r )
435
READ32_MEMBER(gunbustr_state::main_cycle_r)
477
gunbustr_state *state = space->machine().driver_data<gunbustr_state>();
478
if (cpu_get_pc(&space->device())==0x55a && (state->m_ram[0x3acc/4]&0xff000000)==0)
479
device_spin_until_interrupt(&space->device());
437
if (cpu_get_pc(&space.device())==0x55a && (m_ram[0x3acc/4]&0xff000000)==0)
438
device_spin_until_interrupt(&space.device());
481
return state->m_ram[0x3acc/4];
440
return m_ram[0x3acc/4];
484
443
static DRIVER_INIT( gunbustr )
486
445
/* Speedup handler */
487
machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x203acc, 0x203acf, FUNC(main_cycle_r));
446
gunbustr_state *state = machine.driver_data<gunbustr_state>();
447
state->m_maincpu->memory().space(AS_PROGRAM)->install_read_handler(0x203acc, 0x203acf, read32_delegate(FUNC(gunbustr_state::main_cycle_r),state));
450
static DRIVER_INIT( gunbustrj )
452
DRIVER_INIT_CALL(gunbustr);
454
// no coin lockout, perhaps this was a prototype version without proper coin handling?
455
gunbustr_state *state = machine.driver_data<gunbustr_state>();
456
state->m_coin_lockout = false;
490
459
GAME( 1992, gunbustr, 0, gunbustr, gunbustr, gunbustr, ORIENTATION_FLIP_X, "Taito Corporation Japan", "Gunbuster (World)", 0 )
491
460
GAME( 1992, gunbustru, gunbustr, gunbustr, gunbustr, gunbustr, ORIENTATION_FLIP_X, "Taito America Corporation", "Gunbuster (US)", 0 )
492
GAME( 1992, gunbustrj, gunbustr, gunbustr, gunbustr, gunbustr, ORIENTATION_FLIP_X, "Taito Corporation", "Gunbuster (Japan)", 0 )
461
GAME( 1992, gunbustrj, gunbustr, gunbustr, gunbustr, gunbustrj,ORIENTATION_FLIP_X, "Taito Corporation", "Gunbuster (Japan)", 0 )