summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <lordkale4@gmail.com>2025-10-26 18:03:55 +0100
committer angelosa <lordkale4@gmail.com>2025-10-26 18:04:01 +0100
commit6e0e442a2d06596c1585e2c68392ec3fec0df392 (patch)
tree66c2843f2cc42b48a0b64f059d516533d64fc978
parenta0abcc95ae41ac22a706e978defcc569216af556 (diff)
bus/nscsi/pc8801_30.cpp: hookup end mark and volume metering
-rw-r--r--src/devices/bus/nscsi/pc8801_30.cpp47
-rw-r--r--src/devices/bus/nscsi/pc8801_30.h4
-rw-r--r--src/devices/bus/pc8801/pc8801_31.cpp19
-rw-r--r--src/devices/bus/pc8801/pc8801_31.h4
4 files changed, 64 insertions, 10 deletions
diff --git a/src/devices/bus/nscsi/pc8801_30.cpp b/src/devices/bus/nscsi/pc8801_30.cpp
index 06e79632812..310fa6fa684 100644
--- a/src/devices/bus/nscsi/pc8801_30.cpp
+++ b/src/devices/bus/nscsi/pc8801_30.cpp
@@ -24,6 +24,13 @@ nscsi_cdrom_pc8801_30_device::nscsi_cdrom_pc8801_30_device(const machine_config
{
}
+void nscsi_cdrom_pc8801_30_device::device_add_mconfig(machine_config &config)
+{
+ nscsi_cdrom_device::device_add_mconfig(config);
+ cdda->audio_end_cb().set(FUNC(nscsi_cdrom_pc8801_30_device::cdda_end_mark_cb));
+}
+
+
void nscsi_cdrom_pc8801_30_device::device_reset()
{
nscsi_cdrom_device::device_reset();
@@ -135,7 +142,7 @@ void nscsi_cdrom_pc8801_30_device::nec_set_audio_start_position()
// - manhole (fires this during Sunsoft logo but expects playback on successive
// credit sequence instead)
//if (m_end_frame > m_current_frame)
- // m_cdda->start_audio(m_current_frame, m_end_frame - m_current_frame);
+ // cdda->start_audio(m_current_frame, m_end_frame - m_current_frame);
// These ones additionally wants a CDDA pause issued:
// - audio CD player ("fade out" button trigger, otherwise will playback the
@@ -448,3 +455,41 @@ void nscsi_cdrom_pc8801_30_device::scsi_command()
}
}
+void nscsi_cdrom_pc8801_30_device::cdda_end_mark_cb(int state)
+{
+ if (state != ASSERT_LINE)
+ return;
+
+ LOGCDDA("CDDA end mark %d\n", m_cdda_play_mode & 3);
+
+ // handle end playback event
+ if (m_end_mark == 1)
+ {
+ switch (m_cdda_play_mode & 3)
+ {
+ case 1:
+ {
+ // TODO: should seek rather than be instant
+ LOGCDDA(" - Play with repeat %d %d\n", m_current_frame, m_end_frame);
+ cdda->start_audio(m_current_frame, m_end_frame - m_current_frame);
+ m_end_mark = 1;
+ break;
+ }
+ case 2:
+ LOGCDDA(" - IRQ when finished\n");
+ //set_irq_line(PCE_CD_IRQ_TRANSFER_DONE, ASSERT_LINE);
+ m_end_mark = 0;
+ break;
+ case 3:
+ LOGCDDA(" - Play without repeat\n");
+ // fzone2 / fzone2j wants a STOP thru SUBQ command during intro
+ m_cdda_status = PCE_CD_CDDA_OFF;
+ cdda->stop_audio();
+ m_end_mark = 0;
+ break;
+ }
+ }
+ else
+ LOGCDDA(" - No end mark encountered, check me\n");
+}
+
diff --git a/src/devices/bus/nscsi/pc8801_30.h b/src/devices/bus/nscsi/pc8801_30.h
index 47ea42e144f..2d6f3794d94 100644
--- a/src/devices/bus/nscsi/pc8801_30.h
+++ b/src/devices/bus/nscsi/pc8801_30.h
@@ -19,8 +19,11 @@ class nscsi_cdrom_pc8801_30_device : public nscsi_cdrom_device
public:
nscsi_cdrom_pc8801_30_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
+ int16_t get_channel_sample(offs_t offset) { return cdda->get_channel_sample(offset); };
+
protected:
virtual void device_reset() override ATTR_COLD;
+ virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
virtual void scsi_command() override;
virtual bool scsi_command_done(uint8_t command, uint8_t length) override;
@@ -45,6 +48,7 @@ private:
uint8_t m_end_mark = 0;
+ void cdda_end_mark_cb(int state);
};
DECLARE_DEVICE_TYPE(NSCSI_CDROM_PC8801_30, nscsi_cdrom_pc8801_30_device)
diff --git a/src/devices/bus/pc8801/pc8801_31.cpp b/src/devices/bus/pc8801/pc8801_31.cpp
index ed0d94e9939..f3a5614011c 100644
--- a/src/devices/bus/pc8801/pc8801_31.cpp
+++ b/src/devices/bus/pc8801/pc8801_31.cpp
@@ -39,6 +39,7 @@ DEFINE_DEVICE_TYPE(PC8801_31, pc8801_31_device, "pc8801_31", "NEC PC8801-31 CD-R
pc8801_31_device::pc8801_31_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, PC8801_31, tag, owner, clock)
, m_sasibus(*this, "sasi")
+ , m_cddrive(*this, "sasi:0:cdrom")
, m_sasi(*this, "sasi:7:sasicb")
, m_rom_bank_cb(*this)
, m_drq_cb(*this)
@@ -60,14 +61,14 @@ static void pc8801_scsi_devices(device_slot_interface &device)
void pc8801_31_device::device_add_mconfig(machine_config &config)
{
- SPEAKER(config, "speaker", 2).front_center();
+ SPEAKER(config, "headphone", 2).front_center();
NSCSI_BUS(config, m_sasibus);
NSCSI_CONNECTOR(config, "sasi:0").option_set("cdrom", NSCSI_CDROM_PC8801_30).machine_config(
[](device_t *device)
{
- device->subdevice<cdda_device>("cdda")->add_route(0, "^^speaker", 0.5, 0);
- device->subdevice<cdda_device>("cdda")->add_route(1, "^^speaker", 0.5, 1);
+ device->subdevice<cdda_device>("cdda")->add_route(0, "^^headphone", 0.5, 0);
+ device->subdevice<cdda_device>("cdda")->add_route(1, "^^headphone", 0.5, 1);
});
NSCSI_CONNECTOR(config, "sasi:1", pc8801_scsi_devices, nullptr);
NSCSI_CONNECTOR(config, "sasi:2", pc8801_scsi_devices, nullptr);
@@ -131,8 +132,8 @@ void pc8801_31_device::amap(address_map &map)
map(0x04, 0x04).w(FUNC(pc8801_31_device::scsi_reset_w));
map(0x08, 0x08).rw(FUNC(pc8801_31_device::clock_r), FUNC(pc8801_31_device::volume_control_w));
map(0x09, 0x09).rw(FUNC(pc8801_31_device::id_r), FUNC(pc8801_31_device::rom_bank_w));
- map(0x0b, 0x0b).r(FUNC(pc8801_31_device::volume_meter_r));
- map(0x0d, 0x0d).r(FUNC(pc8801_31_device::volume_meter_r));
+ map(0x0b, 0x0b).r(FUNC(pc8801_31_device::volume_meter_r<1>));
+ map(0x0d, 0x0d).r(FUNC(pc8801_31_device::volume_meter_r<0>));
map(0x0f, 0x0f).lw8(
NAME([this](u8 data) { m_cddrive_enable = bool(BIT(data, 0)); })
);
@@ -280,11 +281,13 @@ void pc8801_31_device::rom_bank_w(u8 data)
* i.e. a value of 0x70 will make the uppermost tick to flicker more than 0x74,
* while 0x7c won't flicker at all
*
+ * ? may just be sign, ignored by HW
+ *
*/
-// TODO: templatìze, measure via real HW tests
-u8 pc8801_31_device::volume_meter_r()
+// TODO: templatìze, measure via real HW tests, is $9c / $9e actually low port?
+template <unsigned N> u8 pc8801_31_device::volume_meter_r()
{
- return 0;
+ return m_cddrive->get_channel_sample(N) >> 8;
}
void pc8801_31_device::sasi_sel_w(int state)
diff --git a/src/devices/bus/pc8801/pc8801_31.h b/src/devices/bus/pc8801/pc8801_31.h
index 9c049800cfa..cfb42fcfd4b 100644
--- a/src/devices/bus/pc8801/pc8801_31.h
+++ b/src/devices/bus/pc8801/pc8801_31.h
@@ -13,6 +13,7 @@
#include "bus/nscsi/cd.h"
#include "bus/nscsi/devices.h"
+#include "bus/nscsi/pc8801_30.h"
#include "machine/nscsi_bus.h"
#include "machine/nscsi_cb.h"
@@ -45,6 +46,7 @@ protected:
private:
required_device<nscsi_bus_device> m_sasibus;
+ required_device<nscsi_cdrom_pc8801_30_device> m_cddrive;
required_device<nscsi_callback_device> m_sasi;
devcb_write_line m_rom_bank_cb;
@@ -61,7 +63,7 @@ private:
void volume_control_w(u8 data);
u8 id_r();
void rom_bank_w(u8 data);
- u8 volume_meter_r();
+ template <unsigned N> u8 volume_meter_r();
bool m_clock_hb;
bool m_cddrive_enable;