Skip to content

Commit fa87a0a

Browse files
committed
taito/tnzs.cpp: removed kageki sample playback HLE
1 parent 5a02f7b commit fa87a0a

File tree

1 file changed

+26
-67
lines changed

1 file changed

+26
-67
lines changed

src/mame/taito/tnzs.cpp

+26-67
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,6 @@ d23f=input port 1 value
673673
#include "machine/gen_latch.h"
674674
#include "machine/upd4701.h"
675675
#include "sound/dac.h"
676-
#include "sound/samples.h"
677676
#include "sound/ymopm.h"
678677
#include "sound/ymopn.h"
679678

@@ -825,10 +824,10 @@ class kageki_state : public insectx_state
825824
public:
826825
kageki_state(const machine_config &mconfig, device_type type, const char *tag)
827826
: insectx_state(mconfig, type, tag)
828-
, m_samples(*this, "samples")
829827
, m_dswa(*this, "DSWA")
830828
, m_dswb(*this, "DSWB")
831829
, m_csport_sel(0)
830+
, m_scpu(*this, "samples")
832831
{ }
833832

834833
void kageki(machine_config &config) ATTR_COLD;
@@ -847,20 +846,15 @@ class kageki_state : public insectx_state
847846
uint8_t csport_r();
848847
void csport_w(uint8_t data);
849848

850-
SAMPLES_START_CB_MEMBER(init_samples);
851-
852849
void kageki_sub_map(address_map &map) ATTR_COLD;
853-
854-
required_device<samples_device> m_samples;
850+
void scpu_map(address_map& map) ATTR_COLD;
851+
void scpu_io_map(address_map& map) ATTR_COLD;
855852

856853
required_ioport m_dswa;
857854
required_ioport m_dswb;
858855

859-
// sound-related
860-
std::unique_ptr<int16_t[]> m_sampledata[MAX_SAMPLES];
861-
int m_samplesize[MAX_SAMPLES]{};
862-
863856
int m_csport_sel;
857+
required_device<cpu_device> m_scpu;
864858
};
865859

866860

@@ -1422,46 +1416,14 @@ void kabukiz_state::sound_bank_w(uint8_t data)
14221416
}
14231417

14241418

1425-
SAMPLES_START_CB_MEMBER(kageki_state::init_samples)
1426-
{
1427-
uint8_t *src = memregion("samples")->base() + 0x0090;
1428-
for (int i = 0; i < MAX_SAMPLES; i++)
1429-
{
1430-
int start = (src[(i * 2) + 1] * 256) + src[(i * 2)];
1431-
uint8_t *scan = &src[start];
1432-
int size = 0;
1433-
1434-
// check sample length
1435-
while (*scan++ != 0x00)
1436-
size++;
1437-
1438-
/* 2009-11 FP: should these be saved? */
1439-
m_sampledata[i] = std::make_unique<int16_t[]>(size);
1440-
m_samplesize[i] = size;
1441-
1442-
if (start < 0x100)
1443-
start = size = 0;
1444-
1445-
// signed 8-bit sample to unsigned 8-bit sample convert
1446-
int16_t *dest = m_sampledata[i].get();
1447-
scan = &src[start];
1448-
for (int n = 0; n < size; n++)
1449-
{
1450-
*dest++ = (int8_t)((*scan++) ^ 0x80) * 256;
1451-
}
1452-
// logerror("samples num:%02X ofs:%04X lng:%04X\n", i, start, size);
1453-
}
1454-
}
1455-
1456-
14571419
uint8_t kageki_state::csport_r()
14581420
{
14591421
int dsw, dsw1, dsw2;
14601422

14611423
dsw1 = m_dswa->read();
14621424
dsw2 = m_dswb->read();
14631425

1464-
switch (m_csport_sel)
1426+
switch (m_csport_sel & 3)
14651427
{
14661428
case 0x00: // DSW2 5,1 / DSW1 5,1
14671429
dsw = (((dsw2 & 0x10) >> 1) | ((dsw2 & 0x01) << 2) | ((dsw1 & 0x10) >> 3) | ((dsw1 & 0x01) >> 0));
@@ -1485,26 +1447,10 @@ uint8_t kageki_state::csport_r()
14851447

14861448
void kageki_state::csport_w(uint8_t data)
14871449
{
1488-
if (data > 0x3f)
1489-
{
1490-
// read dipsw port
1491-
m_csport_sel = (data & 0x03);
1492-
}
1493-
else
1494-
{
1495-
if (data < MAX_SAMPLES)
1496-
{
1497-
// play samples
1498-
m_samples->start_raw(0, m_sampledata[data].get(), m_samplesize[data], 7000);
1499-
LOG("VOICE:%02X PLAY", data);
1500-
}
1501-
else
1502-
{
1503-
// stop samples
1504-
m_samples->stop(0);
1505-
LOG("VOICE:%02X STOP", data);
1506-
}
1507-
}
1450+
m_csport_sel = data;
1451+
1452+
if (!BIT(data, 6))
1453+
m_scpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
15081454
}
15091455

15101456
void insectx_state::prompal_main_map(address_map &map)
@@ -1590,6 +1536,18 @@ void kageki_state::kageki_sub_map(address_map &map)
15901536
map(0xc002, 0xc002).portr("IN2");
15911537
}
15921538

1539+
void kageki_state::scpu_map(address_map& map)
1540+
{
1541+
map(0x0000, 0xffff).rom();
1542+
}
1543+
1544+
void kageki_state::scpu_io_map(address_map& map)
1545+
{
1546+
map.global_mask(0xff);
1547+
map(0x00, 0xff).w("dac", FUNC(dac_byte_interface::data_w));
1548+
map(0x00, 0xff).lr8(NAME([this]() { return m_csport_sel; }));
1549+
}
1550+
15931551
void insectx_state::insectx_sub_map(address_map &map)
15941552
{
15951553
base_sub_map(map);
@@ -2415,6 +2373,10 @@ void kageki_state::kageki(machine_config &config)
24152373
/* basic machine hardware */
24162374
m_subcpu->set_addrmap(AS_PROGRAM, &kageki_state::kageki_sub_map);
24172375

2376+
Z80(config, m_scpu, XTAL(12'000'000) / 4);
2377+
m_scpu->set_addrmap(AS_PROGRAM, &kageki_state::scpu_map);
2378+
m_scpu->set_addrmap(AS_IO, &kageki_state::scpu_io_map);
2379+
24182380
/* sound hardware */
24192381
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000)/4)); /* verified on pcb */
24202382
ymsnd.port_a_read_callback().set(FUNC(kageki_state::csport_r));
@@ -2424,10 +2386,7 @@ void kageki_state::kageki(machine_config &config)
24242386
ymsnd.add_route(2, "speaker", 0.15);
24252387
ymsnd.add_route(3, "speaker", 0.35);
24262388

2427-
SAMPLES(config, m_samples);
2428-
m_samples->set_channels(1);
2429-
m_samples->set_samples_start_callback(FUNC(kageki_state::init_samples));
2430-
m_samples->add_route(ALL_OUTPUTS, "speaker", 1.0);
2389+
DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // HA17408P R2R DAC, TODO: check levels
24312390
}
24322391

24332392
void tnzsb_state::tnzsb(machine_config &config)

0 commit comments

Comments
 (0)