summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2022-01-24 13:51:58 -0600
committer cracyc <cracyc@users.noreply.github.com>2022-01-24 13:51:58 -0600
commit9ac4ce07cc5f0b9821bb614b797aea60884cb007 (patch)
tree3f84f6d3ce487e3c1d6a0adeb1979278df4101b8 /src/devices/bus
parent6abe0764f1c1f945d36688e47444e64b0acea2a6 (diff)
vis: fix cd audio, add yuv422 and fix controls
Diffstat (limited to 'src/devices/bus')
-rw-r--r--src/devices/bus/isa/mcd.cpp81
-rw-r--r--src/devices/bus/isa/mcd.h9
2 files changed, 51 insertions, 39 deletions
diff --git a/src/devices/bus/isa/mcd.cpp b/src/devices/bus/isa/mcd.cpp
index a06e269302c..484e07d8ff4 100644
--- a/src/devices/bus/isa/mcd.cpp
+++ b/src/devices/bus/isa/mcd.cpp
@@ -4,6 +4,7 @@
#include "emu.h"
#include "mcd.h"
#include "coreutil.h"
+#include "speaker.h"
void mcd_isa_device::map(address_map &map)
{
@@ -11,35 +12,33 @@ void mcd_isa_device::map(address_map &map)
map(0x1, 0x1).rw(FUNC(mcd_isa_device::flag_r), FUNC(mcd_isa_device::reset_w));
}
-static INPUT_PORTS_START( ide )
-INPUT_PORTS_END
-
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
DEFINE_DEVICE_TYPE(ISA16_MCD, mcd_isa_device, "mcd_isa", "Mitsumi ISA CD-ROM Adapter")
-//-------------------------------------------------
-// input_ports - device-specific input ports
-//-------------------------------------------------
-
-ioport_constructor mcd_isa_device::device_input_ports() const
-{
- return INPUT_PORTS_NAME( ide );
-}
-
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
+void mcd_isa_device::device_add_mconfig(machine_config &config)
+{
+ SPEAKER(config, "lheadphone").front_left();
+ SPEAKER(config, "rheadphone").front_right();
+ CDDA(config, m_cdda);
+ m_cdda->add_route(0, "lheadphone", 1.0);
+ m_cdda->add_route(1, "rheadphone", 1.0);
+}
+
//-------------------------------------------------
// mcd_isa_device - constructor
//-------------------------------------------------
mcd_isa_device::mcd_isa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
cdrom_image_device(mconfig, ISA16_MCD, tag, owner, clock),
- device_isa16_card_interface( mconfig, *this )
+ device_isa16_card_interface( mconfig, *this ),
+ m_cdda(*this, "cdda")
{
}
@@ -65,7 +64,7 @@ void mcd_isa_device::device_reset()
m_cmdrd_count = 0;
m_cmdbuf_count = 0;
m_buf_count = 0;
- m_curtoctrk = 1;
+ m_curtoctrk = 0;
m_dma = 0;
m_irq = 0;
m_conf = 0;
@@ -78,6 +77,19 @@ void mcd_isa_device::device_reset()
bool mcd_isa_device::read_sector(bool first)
{
+ uint32_t lba = msf_to_lba(m_readmsf);
+ if(m_drvmode == DRV_MODE_CDDA)
+ {
+ if(cdrom_get_track_type(m_cdrom_handle, cdrom_get_track(m_cdrom_handle, lba - 150)) == CD_TRACK_AUDIO)
+ {
+ m_cdda->stop_audio();
+ m_cdda->set_cdrom(m_cdrom_handle);
+ m_cdda->start_audio(lba - 150, m_readcount);
+ return true;
+ }
+ else
+ m_drvmode = DRV_MODE_READ;
+ }
if((m_irq & IRQ_DATACOMP) && !first)
m_isa->irq5_w(ASSERT_LINE);
if(!m_readcount)
@@ -86,7 +98,7 @@ bool mcd_isa_device::read_sector(bool first)
m_data = false;
return false;
}
- uint32_t lba = msf_to_lba(m_readmsf);
+ m_cdda->stop_audio();
cdrom_read_data(m_cdrom_handle, lba - 150, m_buf, m_mode & 0x40 ? CD_TRACK_MODE1_RAW : CD_TRACK_MODE1);
if(m_mode & 0x40)
{
@@ -262,12 +274,12 @@ void mcd_isa_device::cmd_w(uint8_t data)
uint32_t first = lba_to_msf(150), last = lba_to_msf(cdrom_get_track_start(m_cdrom_handle, 0xaa));
m_cmdbuf[1] = 1;
m_cmdbuf[2] = dec_2_bcd(cdrom_get_last_track(m_cdrom_handle));
- m_cmdbuf[3] = dec_2_bcd((last >> 16) & 0xff);
- m_cmdbuf[4] = dec_2_bcd((last >> 8) & 0xff);
- m_cmdbuf[5] = dec_2_bcd(last & 0xff);
- m_cmdbuf[6] = dec_2_bcd((first >> 16) & 0xff);
- m_cmdbuf[7] = dec_2_bcd((first >> 8) & 0xff);
- m_cmdbuf[8] = dec_2_bcd(first & 0xff);
+ m_cmdbuf[3] = (last >> 16) & 0xff;
+ m_cmdbuf[4] = (last >> 8) & 0xff;
+ m_cmdbuf[5] = last & 0xff;
+ m_cmdbuf[6] = (first >> 16) & 0xff;
+ m_cmdbuf[7] = (first >> 8) & 0xff;
+ m_cmdbuf[8] = first & 0xff;
m_cmdbuf[9] = 0;
m_cmdbuf_count = 10;
m_readcount = 0;
@@ -283,19 +295,21 @@ void mcd_isa_device::cmd_w(uint8_t data)
{
int tracks = cdrom_get_last_track(m_cdrom_handle);
uint32_t start = lba_to_msf(cdrom_get_track_start(m_cdrom_handle, m_curtoctrk));
- uint32_t end = lba_to_msf(cdrom_get_track_start(m_cdrom_handle, m_curtoctrk < tracks ? m_curtoctrk + 1 : 0xaa));
+ uint32_t end = lba_to_msf(cdrom_get_track_start(m_cdrom_handle, m_curtoctrk < (tracks - 1) ? m_curtoctrk + 1 : 0xaa));
m_cmdbuf[1] = (cdrom_get_adr_control(m_cdrom_handle, m_curtoctrk) << 4) & 0xf0;
m_cmdbuf[2] = 0; // track num except when reading toc
- m_cmdbuf[3] = dec_2_bcd(m_curtoctrk); // index
- m_cmdbuf[4] = dec_2_bcd((start >> 16) & 0xff);
- m_cmdbuf[5] = dec_2_bcd((start >> 8) & 0xff);
- m_cmdbuf[6] = dec_2_bcd(start & 0xff);
+ m_cmdbuf[3] = dec_2_bcd(m_curtoctrk + 1); // index
+ m_cmdbuf[4] = (start >> 16) & 0xff;
+ m_cmdbuf[5] = (start >> 8) & 0xff;
+ m_cmdbuf[6] = start & 0xff;
m_cmdbuf[7] = 0;
- m_cmdbuf[8] = dec_2_bcd((end >> 16) & 0xff);
- m_cmdbuf[9] = dec_2_bcd((end >> 8) & 0xff);
- m_cmdbuf[10] = dec_2_bcd(end & 0xff);
- if(m_curtoctrk >= tracks)
- m_curtoctrk = 1;
+ m_cmdbuf[8] = (end >> 16) & 0xff;
+ m_cmdbuf[9] = (end >> 8) & 0xff;
+ m_cmdbuf[10] = end & 0xff;
+ if(m_curtoctrk > tracks)
+ m_curtoctrk = 0;
+ else if(m_mode & MODE_GET_TOC)
+ m_curtoctrk++;
m_cmdbuf_count = 11;
m_readcount = 0;
}
@@ -313,8 +327,9 @@ void mcd_isa_device::cmd_w(uint8_t data)
break;
case CMD_STOPCDDA:
case CMD_STOP:
+ m_cdda->stop_audio();
m_drvmode = DRV_MODE_STOP;
- m_curtoctrk = 1;
+ m_curtoctrk = 0;
break;
case CMD_CONFIG:
m_cmdrd_count = 2;
@@ -324,7 +339,7 @@ void mcd_isa_device::cmd_w(uint8_t data)
if(m_cdrom_handle)
{
m_readcount = 0;
- m_drvmode = DRV_MODE_READ;
+ m_drvmode = data == CMD_READ1X ? DRV_MODE_CDDA : DRV_MODE_READ;
m_cmdrd_count = 6;
}
else
diff --git a/src/devices/bus/isa/mcd.h b/src/devices/bus/isa/mcd.h
index d5a7e8b2955..4c2b7a0e636 100644
--- a/src/devices/bus/isa/mcd.h
+++ b/src/devices/bus/isa/mcd.h
@@ -7,6 +7,7 @@
#include "isa.h"
#include "imagedev/chd_cd.h"
+#include "sound/cdda.h"
//**************************************************************************
// TYPE DEFINITIONS
@@ -22,17 +23,13 @@ public:
mcd_isa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
- // optional information overrides
- virtual ioport_constructor device_input_ports() const override;
-
virtual uint16_t dack16_r(int line) override;
-
-protected:
- // device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
+ virtual void device_add_mconfig(machine_config &config) override;
private:
+ required_device<cdda_device> m_cdda;
uint8_t data_r();
uint8_t flag_r();
void cmd_w(uint8_t data);