summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <lordkale4@gmail.com>2025-10-28 20:48:41 +0100
committer angelosa <lordkale4@gmail.com>2025-10-28 20:49:13 +0100
commitce0d02baf671e0990a3166ed3a67fcebb6c0acce (patch)
tree7c7f5a7efd3140cfedd45f420662992b953caf92
parent487a9cfa535f87312aec6b69ccdde90fe311a5d1 (diff)
bus/pc8801/pc8801_31.cpp: pinpoint DMA enable bit
-rw-r--r--src/devices/bus/nscsi/pc8801_30.cpp44
-rw-r--r--src/devices/bus/nscsi/pc8801_30.h1
-rw-r--r--src/devices/bus/pc8801/pc8801_31.cpp9
-rw-r--r--src/devices/bus/pc8801/pc8801_31.h1
-rw-r--r--src/mame/nec/pc8801.cpp5
5 files changed, 37 insertions, 23 deletions
diff --git a/src/devices/bus/nscsi/pc8801_30.cpp b/src/devices/bus/nscsi/pc8801_30.cpp
index 9859a93713c..c4930597f1d 100644
--- a/src/devices/bus/nscsi/pc8801_30.cpp
+++ b/src/devices/bus/nscsi/pc8801_30.cpp
@@ -11,7 +11,7 @@
#define LOG_CDDA (1U << 2)
#define LOG_FADER (1U << 3)
-#define VERBOSE (LOG_GENERAL | LOG_CMD | LOG_FADER)
+#define VERBOSE (LOG_GENERAL | LOG_CMD | LOG_CDDA | LOG_FADER)
//#define LOG_OUTPUT_FUNC osd_printf_info
#include "logmacro.h"
@@ -19,6 +19,8 @@
#define LOGCDDA(...) LOGMASKED(LOG_CDDA, __VA_ARGS__)
#define LOGFADER(...) LOGMASKED(LOG_FADER, __VA_ARGS__)
+#define LIVE_SUBQ_VIEW 0
+
DEFINE_DEVICE_TYPE(NSCSI_CDROM_PC8801_30, nscsi_cdrom_pc8801_30_device, "scsi_pc8801_30", "SCSI NEC PC8801-30 CD-ROM")
nscsi_cdrom_pc8801_30_device::nscsi_cdrom_pc8801_30_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
@@ -84,6 +86,12 @@ bool nscsi_cdrom_pc8801_30_device::scsi_command_done(u8 command, u8 length)
}
}
+//attotime nscsi_cdrom_pc8801_30_device::scsi_data_command_delay()
+//{
+// return attotime::from_msec(1'000'000 / 44'150);
+//}
+//
+
void nscsi_cdrom_pc8801_30_device::nec_set_audio_start_position()
{
u32 frame = 0;
@@ -111,7 +119,6 @@ void nscsi_cdrom_pc8801_30_device::nec_set_audio_start_position()
const u8 f = bcd_2_dec(scsi_cmdbuf[4]);
frame = f + 75 * (s + m * 60);
-
const u32 pregap = toc.tracks[image->get_track(frame)].pregap;
LOGCMD("MSF=%d %02d:%02d:%02d (pregap = %d)\n", frame, m, s, f, pregap);
@@ -322,17 +329,15 @@ void nscsi_cdrom_pc8801_30_device::nec_get_subq()
return;
}
- frame = m_current_frame;
+ frame = cdda->get_audio_lba();
switch (m_cdda_status)
{
case PCE_CD_CDDA_PAUSED:
scsi_cmdbuf[0] = 2;
- frame = cdda->get_audio_lba();
break;
case PCE_CD_CDDA_PLAYING:
scsi_cmdbuf[0] = 0;
- frame = cdda->get_audio_lba();
break;
default:
scsi_cmdbuf[0] = 3;
@@ -343,11 +348,11 @@ void nscsi_cdrom_pc8801_30_device::nec_get_subq()
track = image->get_track(frame);
msf_rel = cdrom_file::lba_to_msf_alt(frame - image->get_track_start(track));
- scsi_cmdbuf[1] = 0x01 | ((image->get_track_type(image->get_track(track+1)) == cdrom_file::CD_TRACK_AUDIO) ? 0x00 : 0x40);
+ scsi_cmdbuf[1] = 0x01 | ((image->get_track_type(track+1) == cdrom_file::CD_TRACK_AUDIO) ? 0x00 : 0x40);
// track
scsi_cmdbuf[2] = dec_2_bcd(track+1);
// index
- scsi_cmdbuf[3] = 1;
+ scsi_cmdbuf[3] = std::max(image->get_track_index(frame), 1U);
// MSF (relative)
scsi_cmdbuf[4] = dec_2_bcd((msf_rel >> 16) & 0xFF);
scsi_cmdbuf[5] = dec_2_bcd((msf_rel >> 8) & 0xFF);
@@ -356,18 +361,18 @@ void nscsi_cdrom_pc8801_30_device::nec_get_subq()
scsi_cmdbuf[7] = dec_2_bcd((msf_abs >> 16) & 0xFF);
scsi_cmdbuf[8] = dec_2_bcd((msf_abs >> 8) & 0xFF);
scsi_cmdbuf[9] = dec_2_bcd(msf_abs & 0xFF);
- //if(LIVE_SUBQ_VIEW)
- //{
- // const std::vector<std::string> status_types = {"standby", "play", "pause"};
- // popmessage("SUBQ - status %s type %02x|track %d index %d| MSF rel %06x MSF abs %06x\n"
- // , status_types[m_cdda_status]
- // , m_data_buffer[1]
- // , track + 1
- // , 1
- // , msf_rel
- // , msf_abs
- // );
- //}
+ if(LIVE_SUBQ_VIEW)
+ {
+ const std::vector<std::string> status_types = {"standby", "play", "pause"};
+ popmessage("SUBQ - status %s type %02x|track %d index %d| MSF rel %06x MSF abs %06x\n"
+ , status_types[m_cdda_status]
+ , scsi_cmdbuf[1]
+ , track + 1
+ , scsi_cmdbuf[3]
+ , msf_rel
+ , msf_abs
+ );
+ }
scsi_data_in(SBUF_MAIN, 10);
scsi_status_complete(SS_GOOD);
@@ -527,6 +532,7 @@ void nscsi_cdrom_pc8801_30_device::cdda_end_mark_cb(int state)
LOGCDDA(" - No end mark encountered, check me\n");
}
+// TODO: emulated here for simplicity, but should be an external mixer chip
void nscsi_cdrom_pc8801_30_device::fader_control_w(u8 data)
{
if (data & 0xf8)
diff --git a/src/devices/bus/nscsi/pc8801_30.h b/src/devices/bus/nscsi/pc8801_30.h
index 1325100d80d..01903a81f07 100644
--- a/src/devices/bus/nscsi/pc8801_30.h
+++ b/src/devices/bus/nscsi/pc8801_30.h
@@ -29,6 +29,7 @@ protected:
virtual void scsi_command() override;
virtual bool scsi_command_done(u8 command, u8 length) override;
+// virtual attotime scsi_data_command_delay() override;
virtual TIMER_CALLBACK_MEMBER(cdda_fader_cb);
private:
diff --git a/src/devices/bus/pc8801/pc8801_31.cpp b/src/devices/bus/pc8801/pc8801_31.cpp
index 68dbd801de0..72c3d0657c6 100644
--- a/src/devices/bus/pc8801/pc8801_31.cpp
+++ b/src/devices/bus/pc8801/pc8801_31.cpp
@@ -135,9 +135,12 @@ void pc8801_31_device::amap(address_map &map)
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<1>));
map(0x0d, 0x0d).r(FUNC(pc8801_31_device::volume_meter_r<0>));
- // TODO: bit 6 also used at startup, what for?
map(0x0f, 0x0f).lw8(
- NAME([this](u8 data) { m_cddrive_enable = bool(BIT(data, 0)); })
+ NAME([this](u8 data) {
+ // takabako and dioscd disables DMA for SUBQ commands to work right
+ m_dma_enable = !!(BIT(data, 6));
+ m_cddrive_enable = !!(BIT(data, 0));
+ })
);
}
@@ -304,7 +307,7 @@ void pc8801_31_device::sasi_req_w(int state)
if (!m_sasi_req && state)
{
// IO needed otherwise it will keep running the DRQ
- if (!m_sasi->cd_r() && !m_sasi->msg_r() && m_sasi->io_r())
+ if (m_dma_enable && !m_sasi->cd_r() && !m_sasi->msg_r() && m_sasi->io_r())
{
m_drq_cb(1);
}
diff --git a/src/devices/bus/pc8801/pc8801_31.h b/src/devices/bus/pc8801/pc8801_31.h
index df99a8a7b22..e92aa111e4f 100644
--- a/src/devices/bus/pc8801/pc8801_31.h
+++ b/src/devices/bus/pc8801/pc8801_31.h
@@ -66,6 +66,7 @@ private:
bool m_clock_hb;
bool m_cddrive_enable;
+ bool m_dma_enable;
int m_sasi_sel;
int m_sasi_req;
diff --git a/src/mame/nec/pc8801.cpp b/src/mame/nec/pc8801.cpp
index 82cf9c3478d..eef6a12c9d9 100644
--- a/src/mame/nec/pc8801.cpp
+++ b/src/mame/nec/pc8801.cpp
@@ -281,6 +281,8 @@ uint32_t pc8801_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
uint8_t pc8801_state::dma_mem_r(offs_t offset)
{
// TODO: TVRAM readback
+ //if ((offset & 0xf000) == 0xf000)
+ // return m_hi_work_ram[offset & 0xfff];
return m_work_ram[offset & 0xffff];
}
@@ -1645,7 +1647,8 @@ void pc8801_state::pc8801(machine_config &config)
m_maincpu->set_irq_acknowledge_callback(FUNC(pc8801_state::int_ack_cb));
PC80S31(config, m_pc80s31, MASTER_CLOCK);
- config.set_perfect_quantum(m_maincpu);
+// config.set_perfect_quantum(m_maincpu);
+ // TODO: get rid of this
config.set_perfect_quantum("pc80s31:fdc_cpu");
// config.set_maximum_quantum(attotime::from_hz(MASTER_CLOCK/1024));