bbusters: Update gun handling, fixes MT07333

- Use UPD7004 device
- Adjust gun limits to the factory defaults
- Remove no longer needed default eeproms

Calibration in service mode now also works and doesn't cause the game to 
refuse to boot.
This commit is contained in:
Dirk Best 2019-05-28 09:48:47 +02:00
parent 244b03bb52
commit 87d548d205
2 changed files with 32 additions and 61 deletions

View File

@ -182,9 +182,15 @@ If you calibrate the guns correctly the game runs as expected:
2) Using P2 controls fire at the indicated spots.
3) Using P3 controls fire at the indicated spots.
The locations of the shots fired in attract mode are defined by a table
starting at $65000. The value taken from there is combined with data from
the gun calibration to calculate the final position of the shots.
Unexpected calibration values will therefore cause the game to show the
shots in weird positions (see MT07333).
TODO: MT07333 - once the guns are calibrated, attract mode shows the 3 players only shooting at the bottom right
of the screen.
The EEPROM data starts with the 16 bit calibration values for all six axes
in the order: Minimum axis 0, middle axis 0, maximum axis 0 (repeat for
the other 5 axes).
***************************************************************************/
@ -194,6 +200,7 @@ of the screen.
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
#include "machine/nvram.h"
#include "machine/upd7004.h"
#include "sound/2608intf.h"
#include "sound/2610intf.h"
#include "emupal.h"
@ -240,8 +247,6 @@ void bbusters_state_base::machine_start()
void bbusters_state::machine_start()
{
bbusters_state_base::machine_start();
save_item(NAME(m_gun_select));
}
WRITE8_MEMBER(bbusters_state_base::sound_cpu_w)
@ -256,36 +261,12 @@ READ16_MEMBER(bbusters_state::eprom_r)
return (m_eprom_data[offset]&0xff) | 0xff00;
}
READ16_MEMBER(bbusters_state::control_3_r)
{
uint16_t retdata = m_gun_io[m_gun_select]->read();
retdata >>=1; // by lowering the precision of the gun reading hardware the game seems to work better
return retdata;
}
WRITE16_MEMBER(bbusters_state::gun_select_w)
{
//logerror("%08x: gun r\n",m_maincpu->pc());
m_maincpu->set_input_line(2, HOLD_LINE);
m_gun_select = data & 0xff;
}
WRITE16_MEMBER(bbusters_state::three_gun_output_w)
{
for (int i = 0; i < 3; i++)
m_gun_recoil[i] = BIT(data, i);
}
READ16_MEMBER(bbusters_state::kludge_r)
{
// might latch the gun value?
return 0x0000;
}
template<int Layer>
WRITE16_MEMBER(bbusters_state_base::pf_w)
{
@ -322,8 +303,7 @@ void bbusters_state::bbusters_map(address_map &map)
map(0x0e0008, 0x0e0009).portr("DSW1"); /* Dip 1 */
map(0x0e000a, 0x0e000b).portr("DSW2"); /* Dip 2 */
map(0x0e0019, 0x0e0019).r(m_soundlatch[1], FUNC(generic_latch_8_device::read));
map(0x0e8000, 0x0e8001).rw(FUNC(bbusters_state::kludge_r), FUNC(bbusters_state::gun_select_w));
map(0x0e8002, 0x0e8003).r(FUNC(bbusters_state::control_3_r));
map(0x0e8000, 0x0e8003).rw("adc", FUNC(upd7004_device::read), FUNC(upd7004_device::write)).umask16(0x00ff);
map(0x0f0000, 0x0f0001).w(FUNC(bbusters_state::coin_counter_w));
map(0x0f0008, 0x0f0009).w(FUNC(bbusters_state::three_gun_output_w));
map(0x0f0019, 0x0f0019).w(FUNC(bbusters_state::sound_cpu_w));
@ -481,20 +461,23 @@ static INPUT_PORTS_START( bbusters )
PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW2:7" ) /* Listed as "Unused" */
PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_LOW, "SW2:8" )
PORT_START("GUNX1")
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
PORT_START("GUNY1")
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
PORT_BIT(0x3ff, 0x1a6, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0x0e6, 0x272) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
PORT_START("GUNX1")
PORT_BIT(0x3ff, 0x23a, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0x136, 0x36a) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
PORT_START("GUNY2")
PORT_BIT(0x3ff, 0x1f6, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0x146, 0x2aa) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
PORT_START("GUNX2")
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2)
PORT_START("GUNY2")
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2)
PORT_BIT(0x3ff, 0x1de, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0x10e, 0x2e2) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
PORT_START("GUNY3")
PORT_BIT(0x3ff, 0x21e, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0x16e, 0x2f6) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(3)
PORT_START("GUNX3")
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(3)
PORT_START("GUNY3")
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(3)
PORT_BIT(0x3ff, 0x212, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0x14e, 0x33e) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(3)
INPUT_PORTS_END
static INPUT_PORTS_START( mechatt )
@ -652,7 +635,16 @@ void bbusters_state::bbusters(machine_config &config)
m_audiocpu->set_addrmap(AS_PROGRAM, &bbusters_state::sound_map);
m_audiocpu->set_addrmap(AS_IO, &bbusters_state::sound_portmap);
NVRAM(config, "eeprom", nvram_device::DEFAULT_ALL_0); // actually 28C04 parallel EEPROM
NVRAM(config, "eeprom", nvram_device::DEFAULT_ALL_1); // actually 28C04 parallel EEPROM
upd7004_device &adc(UPD7004(config, "adc", 8_MHz_XTAL / 2));
adc.eoc_ff_callback().set_inputline(m_maincpu, 2);
adc.in_callback<0>().set_ioport("GUNY1");
adc.in_callback<1>().set_ioport("GUNX1");
adc.in_callback<2>().set_ioport("GUNY2");
adc.in_callback<3>().set_ioport("GUNX2");
adc.in_callback<4>().set_ioport("GUNY3");
adc.in_callback<5>().set_ioport("GUNX3");
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -770,9 +762,6 @@ ROM_START( bbusters )
ROM_REGION( 0x80000, "ymsnd.deltat", 0 )
ROM_LOAD( "bb-pcmb.l3", 0x000000, 0x80000, CRC(c8d5dd53) SHA1(0f7e94532cc14852ca12c1b792e5479667af899e) )
ROM_REGION( 0x100, "eeprom", 0 )
ROM_LOAD( "bbusters-eeprom.bin", 0x00, 0x100, CRC(a52ebd66) SHA1(de04db6f1510700c61bf152799452a80220ae87c) )
ROM_END
ROM_START( bbustersu )
@ -818,9 +807,6 @@ ROM_START( bbustersu )
ROM_REGION( 0x80000, "ymsnd.deltat", 0 )
ROM_LOAD( "bb-pcma.l5", 0x000000, 0x80000, CRC(44cd5bfe) SHA1(26a612191a0aa614c090203485aba17c99c763ee) )
ROM_REGION( 0x100, "eeprom", 0 )
ROM_LOAD( "bbusters-eeprom.bin", 0x00, 0x100, CRC(a52ebd66) SHA1(de04db6f1510700c61bf152799452a80220ae87c) )
ROM_END
ROM_START( bbustersua )
@ -866,9 +852,6 @@ ROM_START( bbustersua )
ROM_REGION( 0x80000, "ymsnd.deltat", 0 )
ROM_LOAD( "bb-pcma.l5", 0x000000, 0x80000, CRC(44cd5bfe) SHA1(26a612191a0aa614c090203485aba17c99c763ee) )
ROM_REGION( 0x100, "eeprom", 0 )
ROM_LOAD( "bbusters-eeprom.bin", 0x00, 0x100, CRC(a52ebd66) SHA1(de04db6f1510700c61bf152799452a80220ae87c) )
ROM_END
ROM_START( bbustersj )
@ -914,9 +897,6 @@ ROM_START( bbustersj )
ROM_REGION( 0x80000, "ymsnd.deltat", 0 )
ROM_LOAD( "bb-pcmb.l3", 0x000000, 0x80000, CRC(c8d5dd53) SHA1(0f7e94532cc14852ca12c1b792e5479667af899e) )
ROM_REGION( 0x100, "eeprom", 0 )
ROM_LOAD( "bbusters-eeprom.bin", 0x00, 0x100, CRC(a52ebd66) SHA1(de04db6f1510700c61bf152799452a80220ae87c) )
ROM_END
ROM_START( bbustersja )
@ -962,9 +942,6 @@ ROM_START( bbustersja )
ROM_REGION( 0x80000, "ymsnd.deltat", 0 )
ROM_LOAD( "bb-pcmb.l3", 0x000000, 0x80000, CRC(c8d5dd53) SHA1(0f7e94532cc14852ca12c1b792e5479667af899e) )
ROM_REGION( 0x100, "eeprom", 0 )
ROM_LOAD( "bbusters-eeprom.bin", 0x00, 0x100, CRC(a52ebd66) SHA1(de04db6f1510700c61bf152799452a80220ae87c) )
ROM_END
@ -1140,7 +1117,6 @@ ROM_END
/******************************************************************************/
// as soon as you calibrate the guns in test mode the game refuses to boot
GAME( 1989, bbusters, 0, bbusters, bbusters, bbusters_state, empty_init, ROT0, "SNK", "Beast Busters (World)", MACHINE_SUPPORTS_SAVE )
GAME( 1989, bbustersu, bbusters, bbusters, bbusters, bbusters_state, empty_init, ROT0, "SNK", "Beast Busters (US, Version 3)", MACHINE_SUPPORTS_SAVE )
GAME( 1989, bbustersua, bbusters, bbusters, bbusters, bbusters_state, empty_init, ROT0, "SNK", "Beast Busters (US, Version 2)", MACHINE_SUPPORTS_SAVE )

View File

@ -82,13 +82,8 @@ protected:
private:
required_shared_ptr<uint16_t> m_eprom_data;
int m_gun_select;
DECLARE_READ16_MEMBER(eprom_r);
DECLARE_READ16_MEMBER(control_3_r);
DECLARE_WRITE16_MEMBER(gun_select_w);
DECLARE_WRITE16_MEMBER(three_gun_output_w);
DECLARE_READ16_MEMBER(kludge_r);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void bbusters_map(address_map &map);