Skip to content

Commit

Permalink
- nmk/nmk16.cpp: improved controls and scrolling for tdragonb2. IRQs …
Browse files Browse the repository at this point in the history
…related problems remain.

- sunelectronics/shangha3.cpp: consolidated driver in single file
  • Loading branch information
Osso13 committed Jul 30, 2024
1 parent 1f89189 commit 4f73287
Show file tree
Hide file tree
Showing 7 changed files with 569 additions and 524 deletions.
70 changes: 61 additions & 9 deletions src/mame/nmk/nmk16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,15 +776,22 @@ void nmk16_state::tdragonb2_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x0b0000, 0x0bffff).ram().share("mainram");
map(0x08e294, 0x08e925).portr("IN1");
map(0x0c0000, 0x0c0001).portr("IN0");
map(0x0c0002, 0x0c0003).portr("IN1");
map(0x0c0008, 0x0c0009).portr("DSW1"); // .w TODO oki banking?
map(0x0c0002, 0x0c0003).nopr(); // leftover from the original?
map(0x0c0008, 0x0c0009).portr("DSW1");
map(0x0c0009, 0x0c0009).lw8(NAME([this] (uint8_t data) { m_okibank[0]->set_entry(data & 0x03); }));
map(0x0c000a, 0x0c000b).portr("DSW2");
//map(0x0c000e, 0x0c000f).r; TODO: what's this?
map(0x0c0015, 0x0c0015).w(FUNC(nmk16_state::flipscreen_w)); // Maybe
map(0x0c000e, 0x0c000f).nopr(); // ??
map(0x0c0015, 0x0c0015).w(FUNC(nmk16_state::flipscreen_w));
map(0x0c0018, 0x0c0019).nopr(); // ??
map(0x0c0019, 0x0c0019).w(FUNC(nmk16_state::tilebank_w)); // Tile Bank
map(0x0c001f, 0x0c001f).w("oki", FUNC(okim6295_device::write));
map(0x0c4000, 0x0c4007).ram().w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0x0c4000, 0x0c4001).lw16(NAME([this] (uint16_t data) { m_bg_tilemap[0]->set_scrollx(0, data); } ));
map(0x0c4002, 0x0c4003).nopw(); // duplicate value of the above
map(0x0c4004, 0x0c4005).lw16(NAME([this] (uint16_t data) { m_bg_tilemap[0]->set_scrolly(0, data); } ));
map(0x0c4006, 0x0c4007).nopw(); // duplicate value of the above
map(0x0c4018, 0x0c4019).nopr(); // ??
map(0x0c8000, 0x0c87ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x0cc000, 0x0cffff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x0d0000, 0x0d07ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
Expand Down Expand Up @@ -1107,6 +1114,12 @@ void nmk16_state::powerinsa_oki_map(address_map &map)
map(0x30000, 0x3ffff).bankr(m_okibank[0]);
}

void nmk16_state::tdragonb2_oki_map(address_map &map)
{
map(0x00000, 0x1ffff).rom().region("oki", 0);
map(0x20000, 0x3ffff).bankr(m_okibank[0]);
}

static INPUT_PORTS_START( vandyke )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
Expand Down Expand Up @@ -2287,6 +2300,38 @@ static INPUT_PORTS_START( tdragonb )
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END

static INPUT_PORTS_START( tdragonb2 )
PORT_INCLUDE(tdragon)

PORT_MODIFY("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )

PORT_MODIFY("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Up / P1 Start")
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Button 1 / P2 Start")
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END

static INPUT_PORTS_START( ssmissin )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
Expand Down Expand Up @@ -4684,7 +4729,7 @@ void nmk16_state::tdragonb3(machine_config &config)
void nmk16_state::tdragonb2(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 10000000);
M68000(config, m_maincpu, 10'000'000);
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::tdragonb2_map);
set_hacky_interrupt_timing(config);

Expand All @@ -4700,7 +4745,9 @@ void nmk16_state::tdragonb2(machine_config &config)
// sound hardware
SPEAKER(config, "mono").front_center();

OKIM6295(config, "oki", 1320000, okim6295_device::PIN7_LOW).add_route(ALL_OUTPUTS, "mono", 0.40);
okim6295_device &oki(OKIM6295(config, "oki", 1'320'000, okim6295_device::PIN7_LOW));
oki.set_addrmap(0, &nmk16_state::tdragonb2_oki_map);
oki.add_route(ALL_OUTPUTS, "mono", 0.40);
}

void nmk16_state::tdragon(machine_config &config)
Expand Down Expand Up @@ -5884,6 +5931,11 @@ void nmk16_state::init_tdragonb()
decode_tdragonb();
}

void nmk16_state::init_tdragonb2()
{
m_okibank[0]->configure_entries(0, 4, memregion("oki")->base(), 0x20000);
}

void nmk16_state::init_ssmissin()
{
decode_ssmissin();
Expand Down Expand Up @@ -10356,10 +10408,10 @@ GAME( 1990, mustangb3, mustang, mustangb3, mustang, nmk16_state, empty
GAME( 1989, tharrierb, tharrier, tharrier, tharrier, nmk16_state, init_tharrier, ROT270, "bootleg (Lettering)", "Task Force Harrier (Lettering bootleg)", 0 )

// bootleg with no audio CPU and only 1 Oki
GAME( 1991, tdragonb2, tdragon, tdragonb2, tdragon, nmk16_state, empty_init, ROT270, "bootleg", "Thunder Dragon (bootleg with reduced sound system)", MACHINE_NOT_WORKING ) // GFX and input problems. IRQs related?
GAME( 1991, tdragonb2, tdragon, tdragonb2, tdragonb2, nmk16_state, init_tdragonb2, ROT270, "bootleg", "Thunder Dragon (bootleg with reduced sound system)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // runs too quickly, Oki sounds terrible (IRQ problems? works better commenting out IRQ1_SCANLINE_2)

// bootleg with cloned airbustr sound hardware
GAME( 1992, gunnailb, gunnail, gunnailb, gunnail, nmk16_state, init_gunnailb, ROT270, "bootleg", "GunNail (bootleg)", MACHINE_IMPERFECT_SOUND ) // crappy sound, unknown how much of it is incomplete emulation and how much bootleg quality
GAME( 1992, gunnailb, gunnail, gunnailb, gunnail, nmk16_state, init_gunnailb, ROT270, "bootleg", "GunNail (bootleg)", MACHINE_IMPERFECT_SOUND ) // crappy sound, unknown how much of it is incomplete emulation and how much bootleg quality

// these are from Comad, based on the Thunder Dragon code?
GAME( 1992, ssmissin, 0, ssmissin, ssmissin, nmk16_state, init_ssmissin, ROT270, "Comad", "S.S. Mission", 0 )
Expand Down
2 changes: 2 additions & 0 deletions src/mame/nmk/nmk16.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class nmk16_state : public driver_device, public seibu_sound_common
void init_tharrier();
void init_vandykeb();
void init_tdragonb();
void init_tdragonb2();
void init_ssmissin();
void init_twinactn();
void init_banked_audiocpu();
Expand Down Expand Up @@ -257,6 +258,7 @@ class nmk16_state : public driver_device, public seibu_sound_common
void tdragon_map(address_map &map);
void tdragonb_map(address_map &map);
void tdragonb2_map(address_map &map);
void tdragonb2_oki_map(address_map &map);
void tdragonb3_map(address_map &map);
void tharrier_map(address_map &map);
void tharrier_sound_io_map(address_map &map);
Expand Down
3 changes: 2 additions & 1 deletion src/mame/sega/model1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ MODEL-1 SOUND BD 837-8679 (C) SEGA 1992
TMP68000N-10- Toshiba TMP68000N-10 CPU, running at 10.000MHz (SDIP64, clock 20 / 2)
82C51 - Toshiba 82C51AM-10 Programmable 8-bit I/O Serial Interface (SOP28)
DSW1 - 4 position Dip Switch
MB8464 - Fujitsu MB8464 8k x8 SRAM (DIP28)
MB8464 - Fujitsu MB8464 8k x8 SRAM (DIP28). Jumpers JP5 and JP6 next to the RAMs are tied to A13 and A14 on the CPU
buffers to allow larger RAMs to be used but both jumpers are set to VCC so only 8kB RAMs are actually used on the sound board.
3771 - Fujitsu MB3771 Master Reset IC (DIP8)
TL062 - ST Microelectronics Dual Low Power Operational Amplifier (DIP8)
PC910 - Sharp PC910 opto-isolator (DIP8)
Expand Down
2 changes: 1 addition & 1 deletion src/mame/shared/segam1audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void segam1audio_device::segam1audio_map(address_map &map)
map(0xc60000, 0xc60007).rw(m_multipcm_2, FUNC(multipcm_device::read), FUNC(multipcm_device::write)).umask16(0x00ff);
map(0xc70000, 0xc70001).w(FUNC(segam1audio_device::m1_snd_mpcm_bnk2_w));
map(0xd00000, 0xd00007).rw(m_ym, FUNC(ym3438_device::read), FUNC(ym3438_device::write)).umask16(0x00ff);
map(0xf00000, 0xf0ffff).ram();
map(0xf00000, 0xf0ffff).ram(); // real PCB actually has 2x 8kBx8-bit SRAMs (16kB total)
}

void segam1audio_device::mpcm1_map(address_map &map)
Expand Down
Loading

0 comments on commit 4f73287

Please sign in to comment.