mirror of
https://github.com/holub/mame
synced 2025-07-03 00:56:03 +03:00
-cdicdic,cdislave: Modernized logging, nw
This commit is contained in:
parent
33fd2b6e1f
commit
70edd9cd45
@ -28,66 +28,21 @@ TODO:
|
||||
#include "romload.h"
|
||||
#include "sound/cdda.h"
|
||||
|
||||
#define LOG_DECODES (1 << 0)
|
||||
#define LOG_SAMPLES (1 << 1)
|
||||
#define LOG_COMMANDS (1 << 2)
|
||||
#define LOG_SECTORS (1 << 3)
|
||||
#define LOG_IRQS (1 << 4)
|
||||
#define LOG_READS (1 << 5)
|
||||
#define LOG_WRITES (1 << 6)
|
||||
#define LOG_UNKNOWNS (1 << 7)
|
||||
|
||||
/*----------- debug defines -----------*/
|
||||
|
||||
#define VERBOSE_LEVEL (1)
|
||||
|
||||
#define ENABLE_VERBOSE_LOG (0)
|
||||
|
||||
#define VERBOSE (0)
|
||||
#include "logmacro.h"
|
||||
|
||||
// device type definition
|
||||
DEFINE_DEVICE_TYPE(CDI_CDIC, cdicdic_device, "cdicdic", "CD-i CDIC")
|
||||
|
||||
#if ENABLE_VERBOSE_LOG
|
||||
static inline void ATTR_PRINTF(3,4) verboselog(device_t& device, int n_level, const char *s_fmt, ...)
|
||||
{
|
||||
if( VERBOSE_LEVEL >= n_level )
|
||||
{
|
||||
va_list v;
|
||||
char buf[ 32768 ];
|
||||
va_start( v, s_fmt );
|
||||
vsprintf( buf, s_fmt, v );
|
||||
va_end( v );
|
||||
device.logerror("%s: %s", device.machine().describe_context(), buf );
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define verboselog(x,y,z, ...)
|
||||
#endif
|
||||
|
||||
#define CDIC_SECTOR_SYNC 0
|
||||
|
||||
#define CDIC_SECTOR_HEADER 12
|
||||
|
||||
#define CDIC_SECTOR_MODE 15
|
||||
|
||||
#define CDIC_SECTOR_FILE1 16
|
||||
#define CDIC_SECTOR_CHAN1 17
|
||||
#define CDIC_SECTOR_SUBMODE1 18
|
||||
#define CDIC_SECTOR_CODING1 19
|
||||
|
||||
#define CDIC_SECTOR_FILE2 20
|
||||
#define CDIC_SECTOR_CHAN2 21
|
||||
#define CDIC_SECTOR_SUBMODE2 22
|
||||
#define CDIC_SECTOR_CODING2 23
|
||||
|
||||
#define CDIC_SECTOR_DATA 24
|
||||
|
||||
#define CDIC_SECTOR_SIZE 2352
|
||||
|
||||
#define CDIC_SECTOR_DATASIZE 2048
|
||||
#define CDIC_SECTOR_AUDIOSIZE 2304
|
||||
#define CDIC_SECTOR_VIDEOSIZE 2324
|
||||
|
||||
#define CDIC_SUBMODE_EOF 0x80
|
||||
#define CDIC_SUBMODE_RT 0x40
|
||||
#define CDIC_SUBMODE_FORM 0x20
|
||||
#define CDIC_SUBMODE_TRIG 0x10
|
||||
#define CDIC_SUBMODE_DATA 0x08
|
||||
#define CDIC_SUBMODE_AUDIO 0x04
|
||||
#define CDIC_SUBMODE_VIDEO 0x02
|
||||
#define CDIC_SUBMODE_EOR 0x01
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
@ -109,7 +64,7 @@ const int32_t cdicdic_device::s_cdic_adpcm_filter_coef[5][2] =
|
||||
int cdicdic_device::is_valid_sample_buf(uint16_t addr) const
|
||||
{
|
||||
const uint8_t *cdram8 = ((uint8_t*)m_ram.get()) + addr + 8;
|
||||
if(cdram8[2] != 0xff)
|
||||
if (cdram8[2] != 0xff)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -119,7 +74,7 @@ int cdicdic_device::is_valid_sample_buf(uint16_t addr) const
|
||||
double cdicdic_device::sample_buf_freq(uint16_t addr) const
|
||||
{
|
||||
const uint8_t *cdram8 = ((uint8_t*)m_ram.get()) + addr + 8;
|
||||
switch(cdram8[2] & 0x3f)
|
||||
switch (cdram8[2] & 0x3f)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
@ -139,7 +94,7 @@ double cdicdic_device::sample_buf_freq(uint16_t addr) const
|
||||
int cdicdic_device::sample_buf_size(uint16_t addr) const
|
||||
{
|
||||
const uint8_t *cdram8 = ((uint8_t*)m_ram.get()) + addr + 8;
|
||||
switch(cdram8[2] & 0x3f)
|
||||
switch (cdram8[2] & 0x3f)
|
||||
{
|
||||
case 0:
|
||||
case 4:
|
||||
@ -179,27 +134,27 @@ uint32_t cdicdic_device::increment_cdda_frame_bcd(uint32_t bcd)
|
||||
static_cast<uint8_t>((bcd & 0x00f00000) >> 20)
|
||||
};
|
||||
nybbles[0]++;
|
||||
if(nybbles[0] == 5 && nybbles[1] == 7)
|
||||
if (nybbles[0] == 5 && nybbles[1] == 7)
|
||||
{
|
||||
nybbles[0] = 0;
|
||||
nybbles[1] = 0;
|
||||
nybbles[2]++;
|
||||
}
|
||||
else if(nybbles[0] == 10)
|
||||
else if (nybbles[0] == 10)
|
||||
{
|
||||
nybbles[1]++;
|
||||
}
|
||||
if(nybbles[2] == 10)
|
||||
if (nybbles[2] == 10)
|
||||
{
|
||||
nybbles[3]++;
|
||||
nybbles[2] = 0;
|
||||
}
|
||||
if(nybbles[3] == 6)
|
||||
if (nybbles[3] == 6)
|
||||
{
|
||||
nybbles[4]++;
|
||||
nybbles[3] = 0;
|
||||
}
|
||||
if(nybbles[4] == 10)
|
||||
if (nybbles[4] == 10)
|
||||
{
|
||||
nybbles[5]++;
|
||||
nybbles[4] = 0;
|
||||
@ -219,17 +174,17 @@ uint32_t cdicdic_device::increment_cdda_sector_bcd(uint32_t bcd)
|
||||
static_cast<uint8_t>((bcd & 0x00f00000) >> 20)
|
||||
};
|
||||
nybbles[2]++;
|
||||
if(nybbles[2] == 10)
|
||||
if (nybbles[2] == 10)
|
||||
{
|
||||
nybbles[3]++;
|
||||
nybbles[2] = 0;
|
||||
}
|
||||
if(nybbles[3] == 6)
|
||||
if (nybbles[3] == 6)
|
||||
{
|
||||
nybbles[4]++;
|
||||
nybbles[3] = 0;
|
||||
}
|
||||
if(nybbles[4] == 10)
|
||||
if (nybbles[4] == 10)
|
||||
{
|
||||
nybbles[5]++;
|
||||
nybbles[4] = 0;
|
||||
@ -242,9 +197,9 @@ void cdicdic_device::decode_xa_mono(int32_t *cdic_xa_last, const uint8_t *xa, in
|
||||
int32_t l0 = cdic_xa_last[0];
|
||||
int32_t l1 = cdic_xa_last[1];
|
||||
|
||||
for(int32_t b = 0; b < 18; b++)
|
||||
for (int32_t b = 0; b < 18; b++)
|
||||
{
|
||||
for(int32_t s = 0; s < 4; s++)
|
||||
for (int32_t s = 0; s < 4; s++)
|
||||
{
|
||||
uint8_t flags = xa[(4 + (s << 1)) ^ 1];
|
||||
uint8_t shift = flags & 0xf;
|
||||
@ -252,7 +207,7 @@ void cdicdic_device::decode_xa_mono(int32_t *cdic_xa_last, const uint8_t *xa, in
|
||||
int32_t f0 = s_cdic_adpcm_filter_coef[filter][0];
|
||||
int32_t f1 = s_cdic_adpcm_filter_coef[filter][1];
|
||||
|
||||
for(int32_t i = 0; i < 28; i++)
|
||||
for (int32_t i = 0; i < 28; i++)
|
||||
{
|
||||
int16_t d = (xa[(16 + (i << 2) + s) ^ 1] & 0xf) << 12;
|
||||
d = clamp((d >> shift) + (((l0 * f0) + (l1 * f1) + 32) >> 6));
|
||||
@ -268,7 +223,7 @@ void cdicdic_device::decode_xa_mono(int32_t *cdic_xa_last, const uint8_t *xa, in
|
||||
f0 = s_cdic_adpcm_filter_coef[filter][0];
|
||||
f1 = s_cdic_adpcm_filter_coef[filter][1];
|
||||
|
||||
for(int32_t i = 0; i < 28; i++)
|
||||
for (int32_t i = 0; i < 28; i++)
|
||||
{
|
||||
int16_t d = (xa[(16 + (i << 2) + s) ^ 1] >> 4) << 12;
|
||||
d = clamp((d >> shift) + (((l0 * f0) + (l1 * f1) + 32) >> 6));
|
||||
@ -291,9 +246,9 @@ void cdicdic_device::decode_xa_mono8(int *cdic_xa_last, const unsigned char *xa,
|
||||
int32_t l0 = cdic_xa_last[0];
|
||||
int32_t l1 = cdic_xa_last[1];
|
||||
|
||||
for(int32_t b = 0; b < 18; b++)
|
||||
for (int32_t b = 0; b < 18; b++)
|
||||
{
|
||||
for(int32_t s = 0; s < 4; s++)
|
||||
for (int32_t s = 0; s < 4; s++)
|
||||
{
|
||||
uint8_t flags = xa[(4 + s) ^ 1];
|
||||
uint8_t shift = flags & 0xf;
|
||||
@ -301,7 +256,7 @@ void cdicdic_device::decode_xa_mono8(int *cdic_xa_last, const unsigned char *xa,
|
||||
int32_t f0 = s_cdic_adpcm_filter_coef[filter][0];
|
||||
int32_t f1 = s_cdic_adpcm_filter_coef[filter][1];
|
||||
|
||||
for(int32_t i = 0; i < 28; i++)
|
||||
for (int32_t i = 0; i < 28; i++)
|
||||
{
|
||||
int16_t d = (xa[(16 + (i << 2) + s) ^ 1] << 8);
|
||||
d = clamp((d >> shift) + (((l0 * f0) + (l1 * f1) + 32) >> 6));
|
||||
@ -321,14 +276,14 @@ void cdicdic_device::decode_xa_mono8(int *cdic_xa_last, const unsigned char *xa,
|
||||
|
||||
void cdicdic_device::decode_xa_stereo(int32_t *cdic_xa_last, const uint8_t *xa, int16_t *dp)
|
||||
{
|
||||
int32_t l0=cdic_xa_last[0];
|
||||
int32_t l1=cdic_xa_last[1];
|
||||
int32_t l2=cdic_xa_last[2];
|
||||
int32_t l3=cdic_xa_last[3];
|
||||
int32_t l0 = cdic_xa_last[0];
|
||||
int32_t l1 = cdic_xa_last[1];
|
||||
int32_t l2 = cdic_xa_last[2];
|
||||
int32_t l3 = cdic_xa_last[3];
|
||||
|
||||
for(int32_t b = 0; b < 18; b++)
|
||||
for (int32_t b = 0; b < 18; b++)
|
||||
{
|
||||
for(int32_t s = 0; s < 4; s++)
|
||||
for (int32_t s = 0; s < 4; s++)
|
||||
{
|
||||
uint8_t flags0 = xa[(4 + (s << 1)) ^ 1];
|
||||
uint8_t shift0 = flags0 & 0xf;
|
||||
@ -342,9 +297,9 @@ void cdicdic_device::decode_xa_stereo(int32_t *cdic_xa_last, const uint8_t *xa,
|
||||
int32_t f2 = s_cdic_adpcm_filter_coef[filter1][0];
|
||||
int32_t f3 = s_cdic_adpcm_filter_coef[filter1][1];
|
||||
|
||||
for(int32_t i = 0; i < 28; i++)
|
||||
for (int32_t i = 0; i < 28; i++)
|
||||
{
|
||||
int16_t d=xa[(16 + (i << 2) + s) ^ 1];
|
||||
int16_t d = xa[(16 + (i << 2) + s) ^ 1];
|
||||
int16_t d0 = (d & 0xf) << 12;
|
||||
int16_t d1 = (d >> 4) << 12;
|
||||
d0 = clamp((d0 >> shift0) + (((l0 * f0) + (l1 * f1) + 32) >> 6));
|
||||
@ -377,9 +332,9 @@ void cdicdic_device::decode_xa_stereo8(int32_t *cdic_xa_last, const uint8_t *xa,
|
||||
int32_t l2 = cdic_xa_last[2];
|
||||
int32_t l3 = cdic_xa_last[3];
|
||||
|
||||
for(int32_t b = 0; b < 18; b++)
|
||||
for (int32_t b = 0; b < 18; b++)
|
||||
{
|
||||
for(int32_t s = 0; s < 4; s += 2)
|
||||
for (int32_t s = 0; s < 4; s += 2)
|
||||
{
|
||||
uint8_t flags0 = xa[(4 + s) ^ 1];
|
||||
uint8_t shift0 = flags0 & 0xf;
|
||||
@ -392,7 +347,7 @@ void cdicdic_device::decode_xa_stereo8(int32_t *cdic_xa_last, const uint8_t *xa,
|
||||
int32_t f2 = s_cdic_adpcm_filter_coef[filter1][0];
|
||||
int32_t f3 = s_cdic_adpcm_filter_coef[filter1][1];
|
||||
|
||||
for(int32_t i = 0; i < 28; i++)
|
||||
for (int32_t i = 0; i < 28; i++)
|
||||
{
|
||||
int16_t d0 = (xa[(16 + (i << 2) + s + 0) ^ 1] << 8);
|
||||
int16_t d1 = (xa[(16 + (i << 2) + s + 1) ^ 1] << 8);
|
||||
@ -426,17 +381,16 @@ void cdicdic_device::decode_audio_sector(const uint8_t *xa, int32_t triggered)
|
||||
const uint8_t *hdr = xa + 4;
|
||||
int32_t channels;
|
||||
int32_t bits = 4;
|
||||
int32_t index = 0;
|
||||
int16_t samples[18*28*16+16];
|
||||
|
||||
if(hdr[2] == 0xff && triggered == 1)
|
||||
if (hdr[2] == 0xff && triggered == 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
verboselog(*this, 0, "decode_audio_sector, got header type %02x\n", hdr[2] );
|
||||
LOGMASKED(LOG_DECODES, "decode_audio_sector: got header type %02x\n", hdr[2]);
|
||||
|
||||
switch(hdr[2] & 0x3f) // ignore emphasis and reserved bits
|
||||
switch (hdr[2] & 0x3f) // ignore emphasis and reserved bits
|
||||
{
|
||||
case 0:
|
||||
channels = 1;
|
||||
@ -490,14 +444,14 @@ void cdicdic_device::decode_audio_sector(const uint8_t *xa, int32_t triggered)
|
||||
m_dmadac[1]->set_frequency(m_audio_sample_freq);
|
||||
m_dmadac[1]->enable(1);
|
||||
|
||||
switch(channels)
|
||||
switch (channels)
|
||||
{
|
||||
case 1:
|
||||
switch(bits)
|
||||
switch (bits)
|
||||
{
|
||||
case 4:
|
||||
decode_xa_mono(m_xa_last, hdr + 4, samples);
|
||||
for(index = 18*28*8 - 1; index >= 0; index--)
|
||||
for (int32_t index = 18*28*8 - 1; index >= 0; index--)
|
||||
{
|
||||
samples[index*2 + 1] = samples[index];
|
||||
samples[index*2 + 0] = samples[index];
|
||||
@ -507,7 +461,7 @@ void cdicdic_device::decode_audio_sector(const uint8_t *xa, int32_t triggered)
|
||||
break;
|
||||
case 8:
|
||||
decode_xa_mono8(m_xa_last, hdr + 4, samples);
|
||||
for(index = 18*28*8 - 1; index >= 0; index--)
|
||||
for (int32_t index = 18*28*8 - 1; index >= 0; index--)
|
||||
{
|
||||
samples[index*2 + 1] = samples[index];
|
||||
samples[index*2 + 0] = samples[index];
|
||||
@ -518,7 +472,7 @@ void cdicdic_device::decode_audio_sector(const uint8_t *xa, int32_t triggered)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch(bits)
|
||||
switch (bits)
|
||||
{
|
||||
case 4:
|
||||
decode_xa_stereo(m_xa_last, hdr + 4, samples);
|
||||
@ -550,21 +504,21 @@ TIMER_CALLBACK_MEMBER( cdicdic_device::audio_sample_trigger )
|
||||
|
||||
void cdicdic_device::sample_trigger()
|
||||
{
|
||||
if(m_decode_addr == 0xffff)
|
||||
if (m_decode_addr == 0xffff)
|
||||
{
|
||||
verboselog(*this, 0, "%s", "Decode stop requested, stopping playback\n" );
|
||||
LOGMASKED(LOG_SAMPLES, "Decode stop requested, stopping playback\n");
|
||||
m_audio_sample_timer->adjust(attotime::never);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!m_decode_delay)
|
||||
if (!m_decode_delay)
|
||||
{
|
||||
// Indicate that data has been decoded
|
||||
verboselog(*this, 0, "%s", "Flagging that audio data has been decoded\n" );
|
||||
LOGMASKED(LOG_SAMPLES, "Flagging that audio data has been decoded\n");
|
||||
m_audio_buffer |= 0x8000;
|
||||
|
||||
// Set the CDIC interrupt line
|
||||
verboselog(*this, 0, "%s", "Setting CDIC interrupt line for soundmap decode\n" );
|
||||
LOGMASKED(LOG_SAMPLES, "Setting CDIC interrupt line for soundmap decode\n");
|
||||
m_intreq_callback(ASSERT_LINE);
|
||||
}
|
||||
else
|
||||
@ -572,9 +526,9 @@ void cdicdic_device::sample_trigger()
|
||||
m_decode_delay = 0;
|
||||
}
|
||||
|
||||
if(is_valid_sample_buf(m_decode_addr & 0x3ffe))
|
||||
if (is_valid_sample_buf(m_decode_addr & 0x3ffe))
|
||||
{
|
||||
verboselog(*this, 0, "Hit audio_sample_trigger, with m_decode_addr == %04x, calling decode_audio_sector\n", m_decode_addr );
|
||||
LOGMASKED(LOG_SAMPLES, "Hit audio_sample_trigger, with m_decode_addr == %04x, calling decode_audio_sector\n", m_decode_addr);
|
||||
|
||||
// Decode the data at Z+4, the same offset as a normal CD sector.
|
||||
decode_audio_sector(((uint8_t*)m_ram.get()) + (m_decode_addr & 0x3ffe) + 4, 1);
|
||||
@ -582,10 +536,10 @@ void cdicdic_device::sample_trigger()
|
||||
// Swap buffer positions to indicate our new buffer position at the next read
|
||||
m_decode_addr ^= 0x1a00;
|
||||
|
||||
verboselog(*this, 0, "Updated m_decode_addr, new value is %04x\n", m_decode_addr );
|
||||
LOGMASKED(LOG_SAMPLES, "Updated m_decode_addr, new value is %04x\n", m_decode_addr);
|
||||
|
||||
//// Delay for Frequency * (18*28*2*size in bytes) before requesting more data
|
||||
verboselog(*this, 0, "%s", "Data is valid, setting up a new callback\n" );
|
||||
LOGMASKED(LOG_SAMPLES, "Data is valid, setting up a new callback\n");
|
||||
m_decode_period = attotime::from_hz(sample_buf_freq(m_decode_addr & 0x3ffe)) * (18*28*2*sample_buf_size(m_decode_addr & 0x3ffe));
|
||||
m_audio_sample_timer->adjust(m_decode_period);
|
||||
//dmadac_enable(&dmadac[0], 2, 0);
|
||||
@ -595,7 +549,7 @@ void cdicdic_device::sample_trigger()
|
||||
// Swap buffer positions to indicate our new buffer position at the next read
|
||||
m_decode_addr ^= 0x1a00;
|
||||
|
||||
verboselog(*this, 0, "%s", "Data is not valid, indicating to shut down on the next audio sample\n" );
|
||||
LOGMASKED(LOG_SAMPLES, "Data is not valid, indicating to shut down on the next audio sample\n");
|
||||
m_decode_addr = 0xffff;
|
||||
m_audio_sample_timer->adjust(m_decode_period);
|
||||
}
|
||||
@ -608,18 +562,23 @@ TIMER_CALLBACK_MEMBER( cdicdic_device::trigger_readback_int )
|
||||
|
||||
void cdicdic_device::process_delayed_command()
|
||||
{
|
||||
switch(m_command)
|
||||
switch (m_command)
|
||||
{
|
||||
case 0x23: // Reset Mode 1
|
||||
case 0x24: // Reset Mode 2
|
||||
case 0x29: // Read Mode 1
|
||||
case 0x2a: // Read Mode 2
|
||||
//case 0x2c: // Seek
|
||||
{
|
||||
static const char* const s_cmds[8] =
|
||||
{
|
||||
"Reset Mode 1",
|
||||
"Reset Mode 2", 0, 0, 0, 0,
|
||||
"Read Mode 1",
|
||||
"Read Mode 2"
|
||||
};
|
||||
LOGMASKED(LOG_COMMANDS, "Command: %s\n", s_cmds[m_command - 0x23]);
|
||||
uint8_t buffer[2560] = { 0 };
|
||||
uint32_t msf = m_time >> 8;
|
||||
uint32_t lba = 0;
|
||||
int index = 0;
|
||||
uint8_t nybbles[6] =
|
||||
{
|
||||
static_cast<uint8_t>(msf & 0x0000000f),
|
||||
@ -629,27 +588,27 @@ void cdicdic_device::process_delayed_command()
|
||||
static_cast<uint8_t>((msf & 0x000f0000) >> 16),
|
||||
static_cast<uint8_t>((msf & 0x00f00000) >> 20)
|
||||
};
|
||||
if(msf & 0x000080)
|
||||
if (msf & 0x000080)
|
||||
{
|
||||
msf &= 0xffff00;
|
||||
nybbles[0] = 0;
|
||||
nybbles[1] = 0;
|
||||
}
|
||||
if(nybbles[2] >= 2)
|
||||
if (nybbles[2] >= 2)
|
||||
{
|
||||
nybbles[2] -= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
nybbles[2] = 8 + nybbles[2];
|
||||
if(nybbles[3] > 0)
|
||||
if (nybbles[3] > 0)
|
||||
{
|
||||
nybbles[3]--;
|
||||
}
|
||||
else
|
||||
{
|
||||
nybbles[3] = 5;
|
||||
if(nybbles[4] > 0)
|
||||
if (nybbles[4] > 0)
|
||||
{
|
||||
nybbles[4]--;
|
||||
}
|
||||
@ -660,34 +619,33 @@ void cdicdic_device::process_delayed_command()
|
||||
}
|
||||
}
|
||||
}
|
||||
lba = nybbles[0] + nybbles[1]*10 + ((nybbles[2] + nybbles[3]*10)*75) + ((nybbles[4] + nybbles[5]*10)*75*60);
|
||||
uint32_t lba = nybbles[0] + nybbles[1]*10 + ((nybbles[2] + nybbles[3]*10)*75) + ((nybbles[4] + nybbles[5]*10)*75*60);
|
||||
|
||||
//printf( "Reading Mode %d sector from MSF location %06x\n", m_command - 0x28, m_time | 2 );
|
||||
verboselog(*this, 0, "Reading Mode %d sector from MSF location %06x\n", m_command - 0x28, m_time | 2 );
|
||||
LOGMASKED(LOG_COMMANDS, "Reading Mode %d sector from MSF location %06x\n", m_command - 0x28, m_time | 2);
|
||||
|
||||
cdrom_read_data(m_cd, lba, buffer, CD_TRACK_RAW_DONTCARE);
|
||||
|
||||
m_time += 0x100;
|
||||
if((m_time & 0x00000f00) == 0x00000a00)
|
||||
if ((m_time & 0x00000f00) == 0x00000a00)
|
||||
{
|
||||
m_time &= 0xfffff0ff;
|
||||
m_time += 0x00001000;
|
||||
}
|
||||
if((m_time & 0x0000ff00) == 0x00007500)
|
||||
if ((m_time & 0x0000ff00) == 0x00007500)
|
||||
{
|
||||
m_time &= 0xffff00ff;
|
||||
m_time += 0x00010000;
|
||||
if((m_time & 0x000f0000) == 0x000a0000)
|
||||
if ((m_time & 0x000f0000) == 0x000a0000)
|
||||
{
|
||||
m_time &= 0xfff0ffff;
|
||||
m_time += 0x00100000;
|
||||
}
|
||||
}
|
||||
if((m_time & 0x00ff0000) == 0x00600000)
|
||||
if ((m_time & 0x00ff0000) == 0x00600000)
|
||||
{
|
||||
m_time &= 0xff00ffff;
|
||||
m_time += 0x01000000;
|
||||
if((m_time & 0x0f000000) == 0x0a000000)
|
||||
if ((m_time & 0x0f000000) == 0x0a000000)
|
||||
{
|
||||
m_time &= 0xf0ffffff;
|
||||
m_time += 0x10000000;
|
||||
@ -697,49 +655,47 @@ void cdicdic_device::process_delayed_command()
|
||||
m_data_buffer &= ~0x0004;
|
||||
m_data_buffer ^= 0x0001;
|
||||
|
||||
if((buffer[CDIC_SECTOR_FILE2] << 8) == m_file)
|
||||
if ((buffer[CDIC_SECTOR_FILE2] << 8) == m_file)
|
||||
{
|
||||
if(((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_FORM | CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == (CDIC_SUBMODE_FORM | CDIC_SUBMODE_AUDIO)) &&
|
||||
if (((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_FORM | CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == (CDIC_SUBMODE_FORM | CDIC_SUBMODE_AUDIO)) &&
|
||||
(m_channel & m_audio_channel & (1 << buffer[CDIC_SECTOR_CHAN2])))
|
||||
{
|
||||
verboselog(*this, 0, "%s", "Audio sector\n" );
|
||||
LOGMASKED(LOG_SECTORS, "Audio sector\n");
|
||||
|
||||
m_x_buffer |= 0x8000;
|
||||
//m_data_buffer |= 0x4000;
|
||||
m_data_buffer |= 0x0004;
|
||||
|
||||
for(index = 6; index < 2352/2; index++)
|
||||
for (int index = 6; index < 2352/2; index++)
|
||||
{
|
||||
m_ram[(m_data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
|
||||
}
|
||||
|
||||
decode_audio_sector(((uint8_t*)m_ram.get()) + ((m_data_buffer & 5) * 0xa00 + 4), 0);
|
||||
|
||||
//printf( "Setting CDIC interrupt line\n" );
|
||||
verboselog(*this, 0, "%s", "Setting CDIC interrupt line for audio sector\n" );
|
||||
LOGMASKED(LOG_IRQS, "Setting CDIC interrupt line for audio sector\n");
|
||||
m_intreq_callback(ASSERT_LINE);
|
||||
}
|
||||
else if((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == 0x00)
|
||||
else if ((buffer[CDIC_SECTOR_SUBMODE2] & (CDIC_SUBMODE_DATA | CDIC_SUBMODE_AUDIO | CDIC_SUBMODE_VIDEO)) == 0x00)
|
||||
{
|
||||
m_x_buffer |= 0x8000;
|
||||
//m_data_buffer |= 0x4000;
|
||||
|
||||
for(index = 6; index < 2352/2; index++)
|
||||
for (int index = 6; index < 2352/2; index++)
|
||||
{
|
||||
m_ram[(m_data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
|
||||
}
|
||||
|
||||
if((buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_TRIG) == CDIC_SUBMODE_TRIG ||
|
||||
if ((buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_TRIG) == CDIC_SUBMODE_TRIG ||
|
||||
(buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOR) == CDIC_SUBMODE_EOR ||
|
||||
(buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == CDIC_SUBMODE_EOF)
|
||||
{
|
||||
//printf( "Setting CDIC interrupt line\n" );
|
||||
verboselog(*this, 0, "%s", "Setting CDIC interrupt line for message sector\n" );
|
||||
LOGMASKED(LOG_IRQS, "Setting CDIC interrupt line for message sector\n");
|
||||
m_intreq_callback(ASSERT_LINE);
|
||||
}
|
||||
else
|
||||
{
|
||||
verboselog(*this, 0, "%s", "Message sector, ignored\n" );
|
||||
LOGMASKED(LOG_SECTORS, "Message sector, ignored\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -747,46 +703,40 @@ void cdicdic_device::process_delayed_command()
|
||||
m_x_buffer |= 0x8000;
|
||||
//m_data_buffer |= 0x4000;
|
||||
|
||||
for(index = 6; index < 2352/2; index++)
|
||||
for (int index = 6; index < 2352/2; index++)
|
||||
{
|
||||
m_ram[(m_data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
|
||||
}
|
||||
|
||||
//printf( "Setting CDIC interrupt line\n" );
|
||||
verboselog(*this, 0, "%s", "Setting CDIC interrupt line for data sector\n" );
|
||||
LOGMASKED(LOG_IRQS, "Setting CDIC interrupt line for data sector\n");
|
||||
m_intreq_callback(ASSERT_LINE);
|
||||
}
|
||||
|
||||
if((buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == 0 && m_command != 0x23)
|
||||
if ((buffer[CDIC_SECTOR_SUBMODE2] & CDIC_SUBMODE_EOF) == 0 && m_command != 0x23)
|
||||
{
|
||||
m_interrupt_timer->adjust(attotime::from_hz(75)); // 75Hz = 1x CD-ROM speed
|
||||
}
|
||||
else
|
||||
else if (m_command == 0x23) // Mode 1 Reset
|
||||
{
|
||||
if(m_command == 0x23) // Mode 1 Reset
|
||||
{
|
||||
m_interrupt_timer->adjust(attotime::never);
|
||||
}
|
||||
m_interrupt_timer->adjust(attotime::never);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x2e: // Abort
|
||||
LOGMASKED(LOG_COMMANDS, "Command: Abort\n");
|
||||
m_interrupt_timer->adjust(attotime::never);
|
||||
//m_data_buffer &= ~4;
|
||||
break;
|
||||
|
||||
case 0x28: // Play CDDA audio
|
||||
{
|
||||
LOGMASKED(LOG_COMMANDS, "Command: Play CDDA Audio\n");
|
||||
uint8_t buffer[2560] = { 0 };
|
||||
int index = 0;
|
||||
uint32_t msf = (m_time & 0xffff7f00) >> 8;
|
||||
uint32_t next_msf = increment_cdda_frame_bcd((m_time & 0xffff7f00) >> 8);
|
||||
uint32_t rounded_next_msf = increment_cdda_sector_bcd((m_time & 0xffff0000) >> 8);
|
||||
uint32_t lba = 0;
|
||||
// uint32_t next_lba = 0;
|
||||
uint8_t nybbles[6] =
|
||||
{
|
||||
static_cast<uint8_t>(msf & 0x0000000f),
|
||||
@ -796,28 +746,17 @@ void cdicdic_device::process_delayed_command()
|
||||
static_cast<uint8_t>((msf & 0x000f0000) >> 16),
|
||||
static_cast<uint8_t>((msf & 0x00f00000) >> 20)
|
||||
};
|
||||
/* uint8_t next_nybbles[6] =
|
||||
{
|
||||
rounded_next_msf & 0x0000000f,
|
||||
(rounded_next_msf & 0x000000f0) >> 4,
|
||||
(rounded_next_msf & 0x00000f00) >> 8,
|
||||
(rounded_next_msf & 0x0000f000) >> 12,
|
||||
(rounded_next_msf & 0x000f0000) >> 16,
|
||||
(rounded_next_msf & 0x00f00000) >> 20
|
||||
};*/
|
||||
|
||||
lba = nybbles[0] + nybbles[1]*10 + ((nybbles[2] + nybbles[3]*10)*75) + ((nybbles[4] + nybbles[5]*10)*75*60);
|
||||
uint32_t lba = nybbles[0] + nybbles[1]*10 + ((nybbles[2] + nybbles[3]*10)*75) + ((nybbles[4] + nybbles[5]*10)*75*60);
|
||||
|
||||
if(!cdrom_read_data(m_cd, lba, buffer, CD_TRACK_RAW_DONTCARE))
|
||||
if (!cdrom_read_data(m_cd, lba, buffer, CD_TRACK_RAW_DONTCARE))
|
||||
{
|
||||
osd_printf_verbose("Unable to read CD-ROM data.\n");
|
||||
}
|
||||
|
||||
if(!(msf & 0x0000ff))
|
||||
if (!(msf & 0x0000ff))
|
||||
{
|
||||
// next_lba = next_nybbles[0] + next_nybbles[1]*10 + ((next_nybbles[2] + next_nybbles[3]*10)*75) + ((next_nybbles[4] + next_nybbles[5]*10)*75*60);
|
||||
verboselog(*this, 0, "Playing CDDA sector from MSF location %06x\n", m_time | 2 );
|
||||
|
||||
LOGMASKED(LOG_COMMANDS, "Playing CDDA sector from MSF location %06x\n", m_time | 2);
|
||||
m_cdda->start_audio(lba, rounded_next_msf);
|
||||
}
|
||||
|
||||
@ -842,22 +781,21 @@ void cdicdic_device::process_delayed_command()
|
||||
m_x_buffer |= 0x8000;
|
||||
//m_data_buffer |= 0x4000;
|
||||
|
||||
for(index = 6; index < 2352/2; index++)
|
||||
for (int index = 6; index < 2352/2; index++)
|
||||
{
|
||||
m_ram[(m_data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
|
||||
}
|
||||
|
||||
verboselog(*this, 0, "%s", "Setting CDIC interrupt line for CDDA sector\n" );
|
||||
LOGMASKED(LOG_IRQS, "Setting CDIC interrupt line for CDDA sector\n");
|
||||
m_intreq_callback(ASSERT_LINE);
|
||||
break;
|
||||
}
|
||||
case 0x2c: // Seek
|
||||
{
|
||||
LOGMASKED(LOG_COMMANDS, "Command: Seek\n");
|
||||
uint8_t buffer[2560] = { 0 };
|
||||
int index = 0;
|
||||
uint32_t msf = (m_time & 0xffff7f00) >> 8;
|
||||
uint32_t next_msf = increment_cdda_frame_bcd((m_time & 0xffff7f00) >> 8);
|
||||
uint32_t lba = 0;
|
||||
uint8_t nybbles[6] =
|
||||
{
|
||||
static_cast<uint8_t>(msf & 0x0000000f),
|
||||
@ -867,7 +805,7 @@ void cdicdic_device::process_delayed_command()
|
||||
static_cast<uint8_t>((msf & 0x000f0000) >> 16),
|
||||
static_cast<uint8_t>((msf & 0x00f00000) >> 20)
|
||||
};
|
||||
lba = nybbles[0] + nybbles[1]*10 + ((nybbles[2] + nybbles[3]*10)*75) + ((nybbles[4] + nybbles[5]*10)*75*60);
|
||||
uint32_t lba = nybbles[0] + nybbles[1]*10 + ((nybbles[2] + nybbles[3]*10)*75) + ((nybbles[4] + nybbles[5]*10)*75*60);
|
||||
|
||||
m_interrupt_timer->adjust(attotime::from_hz(75));
|
||||
|
||||
@ -877,7 +815,7 @@ void cdicdic_device::process_delayed_command()
|
||||
m_x_buffer |= 0x8000;
|
||||
m_data_buffer |= 0x4000;
|
||||
|
||||
for(index = 6; index < 2352/2; index++)
|
||||
for (int index = 6; index < 2352/2; index++)
|
||||
{
|
||||
m_ram[(m_data_buffer & 5) * (0xa00/2) + (index - 6)] = (buffer[index*2] << 8) | buffer[index*2 + 1];
|
||||
}
|
||||
@ -897,7 +835,7 @@ void cdicdic_device::process_delayed_command()
|
||||
|
||||
m_time = next_msf << 8;
|
||||
|
||||
verboselog(*this, 0, "%s", "Setting CDIC interrupt line for Seek sector\n" );
|
||||
LOGMASKED(LOG_IRQS, "Setting CDIC interrupt line for Seek sector\n");
|
||||
m_intreq_callback(ASSERT_LINE);
|
||||
break;
|
||||
}
|
||||
@ -908,81 +846,79 @@ READ16_MEMBER( cdicdic_device::regs_r )
|
||||
{
|
||||
uint32_t addr = offset + 0x3c00/2;
|
||||
|
||||
switch(addr)
|
||||
switch (addr)
|
||||
{
|
||||
case 0x3c00/2: // Command register
|
||||
verboselog(*this, 0, "cdic_r: Command Register = %04x & %04x\n", m_command, mem_mask);
|
||||
LOGMASKED(LOG_READS, "cdic_r: Command Register = %04x & %04x\n", m_command, mem_mask);
|
||||
return m_command;
|
||||
|
||||
case 0x3c02/2: // Time register (MSW)
|
||||
verboselog(*this, 0, "cdic_r: Time Register (MSW) = %04x & %04x\n", m_time >> 16, mem_mask);
|
||||
LOGMASKED(LOG_READS, "cdic_r: Time Register (MSW) = %04x & %04x\n", m_time >> 16, mem_mask);
|
||||
return m_time >> 16;
|
||||
|
||||
case 0x3c04/2: // Time register (LSW)
|
||||
verboselog(*this, 0, "cdic_r: Time Register (LSW) = %04x & %04x\n", (uint16_t)(m_time & 0x0000ffff), mem_mask);
|
||||
LOGMASKED(LOG_READS, "cdic_r: Time Register (LSW) = %04x & %04x\n", (uint16_t)(m_time & 0x0000ffff), mem_mask);
|
||||
return m_time & 0x0000ffff;
|
||||
|
||||
case 0x3c06/2: // File register
|
||||
verboselog(*this, 0, "cdic_r: File Register = %04x & %04x\n", m_file, mem_mask);
|
||||
LOGMASKED(LOG_READS, "cdic_r: File Register = %04x & %04x\n", m_file, mem_mask);
|
||||
return m_file;
|
||||
|
||||
case 0x3c08/2: // Channel register (MSW)
|
||||
verboselog(*this, 0, "cdic_r: Channel Register (MSW) = %04x & %04x\n", m_channel >> 16, mem_mask);
|
||||
LOGMASKED(LOG_READS, "cdic_r: Channel Register (MSW) = %04x & %04x\n", m_channel >> 16, mem_mask);
|
||||
return m_channel >> 16;
|
||||
|
||||
case 0x3c0a/2: // Channel register (LSW)
|
||||
verboselog(*this, 0, "cdic_r: Channel Register (LSW) = %04x & %04x\n", m_channel & 0x0000ffff, mem_mask);
|
||||
LOGMASKED(LOG_READS, "cdic_r: Channel Register (LSW) = %04x & %04x\n", m_channel & 0x0000ffff, mem_mask);
|
||||
return m_channel & 0x0000ffff;
|
||||
|
||||
case 0x3c0c/2: // Audio Channel register
|
||||
verboselog(*this, 0, "cdic_r: Audio Channel Register = %04x & %04x\n", m_audio_channel, mem_mask);
|
||||
LOGMASKED(LOG_READS, "cdic_r: Audio Channel Register = %04x & %04x\n", m_audio_channel, mem_mask);
|
||||
return m_audio_channel;
|
||||
|
||||
case 0x3ff4/2: // ABUF
|
||||
{
|
||||
uint16_t temp = m_audio_buffer;
|
||||
LOGMASKED(LOG_READS, "cdic_r: Audio Buffer Register = %04x & %04x\n", temp, mem_mask);
|
||||
m_audio_buffer &= 0x7fff;
|
||||
if(!((m_audio_buffer | m_x_buffer) & 0x8000))
|
||||
if (!((m_audio_buffer | m_x_buffer) & 0x8000))
|
||||
{
|
||||
m_intreq_callback(CLEAR_LINE);
|
||||
verboselog(*this, 0, "%s", "Clearing CDIC interrupt line\n" );
|
||||
////printf("Clearing CDIC interrupt line\n" );
|
||||
LOGMASKED(LOG_IRQS, "Clearing CDIC interrupt line\n");
|
||||
}
|
||||
verboselog(*this, 0, "cdic_r: Audio Buffer Register = %04x & %04x\n", temp, mem_mask);
|
||||
return temp;
|
||||
}
|
||||
|
||||
case 0x3ff6/2: // XBUF
|
||||
{
|
||||
uint16_t temp = m_x_buffer;
|
||||
LOGMASKED(LOG_READS, "cdic_r: X-Buffer Register = %04x & %04x\n", temp, mem_mask);
|
||||
m_x_buffer &= 0x7fff;
|
||||
if(!((m_audio_buffer | m_x_buffer) & 0x8000))
|
||||
if (!((m_audio_buffer | m_x_buffer) & 0x8000))
|
||||
{
|
||||
m_intreq_callback(CLEAR_LINE);
|
||||
verboselog(*this, 0, "%s", "Clearing CDIC interrupt line\n" );
|
||||
////printf("Clearing CDIC interrupt line\n" );
|
||||
LOGMASKED(LOG_IRQS, "Clearing CDIC interrupt line\n");
|
||||
}
|
||||
verboselog(*this, 0, "cdic_r: X-Buffer Register = %04x & %04x\n", temp, mem_mask);
|
||||
return temp;
|
||||
}
|
||||
|
||||
case 0x3ffa/2: // AUDCTL
|
||||
{
|
||||
if(m_audio_sample_timer->remaining().is_never())
|
||||
LOGMASKED(LOG_READS, "cdic_r: Z-Buffer Register = %04x & %04x\n", m_z_buffer, mem_mask);
|
||||
if (m_audio_sample_timer->remaining().is_never())
|
||||
{
|
||||
m_z_buffer ^= 0x0001;
|
||||
}
|
||||
verboselog(*this, 0, "cdic_r: Z-Buffer Register = %04x & %04x\n", m_z_buffer, mem_mask);
|
||||
return m_z_buffer;
|
||||
}
|
||||
|
||||
case 0x3ffe/2:
|
||||
{
|
||||
verboselog(*this, 0, "cdic_r: Data buffer Register = %04x & %04x\n", m_data_buffer, mem_mask);
|
||||
LOGMASKED(LOG_READS, "cdic_r: Data buffer Register = %04x & %04x\n", m_data_buffer, mem_mask);
|
||||
return m_data_buffer;
|
||||
}
|
||||
default:
|
||||
verboselog(*this, 0, "cdic_r: UNIMPLEMENTED: Unknown address: %04x & %04x\n", addr*2, mem_mask);
|
||||
LOGMASKED(LOG_READS | LOG_UNKNOWNS, "cdic_r: Unknown address: %04x & %04x\n", addr*2, mem_mask);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -991,54 +927,54 @@ WRITE16_MEMBER( cdicdic_device::regs_w )
|
||||
{
|
||||
uint32_t addr = offset + 0x3c00/2;
|
||||
|
||||
switch(addr)
|
||||
switch (addr)
|
||||
{
|
||||
case 0x3c00/2: // Command register
|
||||
verboselog(*this, 0, "cdic_w: Command Register = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: Command Register = %04x & %04x\n", data, mem_mask);
|
||||
COMBINE_DATA(&m_command);
|
||||
break;
|
||||
|
||||
case 0x3c02/2: // Time register (MSW)
|
||||
m_time &= ~(mem_mask << 16);
|
||||
m_time |= (data & mem_mask) << 16;
|
||||
verboselog(*this, 0, "cdic_w: Time Register (MSW) = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: Time Register (MSW) = %04x & %04x\n", data, mem_mask);
|
||||
break;
|
||||
|
||||
case 0x3c04/2: // Time register (LSW)
|
||||
m_time &= ~mem_mask;
|
||||
m_time |= data & mem_mask;
|
||||
verboselog(*this, 0, "cdic_w: Time Register (LSW) = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: Time Register (LSW) = %04x & %04x\n", data, mem_mask);
|
||||
break;
|
||||
|
||||
case 0x3c06/2: // File register
|
||||
verboselog(*this, 0, "cdic_w: File Register = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: File Register = %04x & %04x\n", data, mem_mask);
|
||||
COMBINE_DATA(&m_file);
|
||||
break;
|
||||
|
||||
case 0x3c08/2: // Channel register (MSW)
|
||||
m_channel &= ~(mem_mask << 16);
|
||||
m_channel |= (data & mem_mask) << 16;
|
||||
verboselog(*this, 0, "cdic_w: Channel Register (MSW) = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: Channel Register (MSW) = %04x & %04x\n", data, mem_mask);
|
||||
break;
|
||||
|
||||
case 0x3c0a/2: // Channel register (LSW)
|
||||
m_channel &= ~mem_mask;
|
||||
m_channel |= data & mem_mask;
|
||||
verboselog(*this, 0, "cdic_w: Channel Register (LSW) = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: Channel Register (LSW) = %04x & %04x\n", data, mem_mask);
|
||||
break;
|
||||
|
||||
case 0x3c0c/2: // Audio Channel register
|
||||
verboselog(*this, 0, "cdic_w: Audio Channel Register = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: Audio Channel Register = %04x & %04x\n", data, mem_mask);
|
||||
COMBINE_DATA(&m_audio_channel);
|
||||
break;
|
||||
|
||||
case 0x3ff4/2:
|
||||
verboselog(*this, 0, "cdic_w: Audio Buffer Register = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: Audio Buffer Register = %04x & %04x\n", data, mem_mask);
|
||||
COMBINE_DATA(&m_audio_buffer);
|
||||
break;
|
||||
|
||||
case 0x3ff6/2:
|
||||
verboselog(*this, 0, "cdic_w: X Buffer Register = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: X Buffer Register = %04x & %04x\n", data, mem_mask);
|
||||
COMBINE_DATA(&m_x_buffer);
|
||||
break;
|
||||
|
||||
@ -1046,15 +982,13 @@ WRITE16_MEMBER( cdicdic_device::regs_w )
|
||||
{
|
||||
uint32_t start = m_scc->dma().channel[0].memory_address_counter;
|
||||
uint32_t count = m_scc->dma().channel[0].transfer_counter;
|
||||
uint32_t index = 0;
|
||||
uint32_t device_index = (data & 0x3fff) >> 1;
|
||||
verboselog(*this, 0, "memory address counter: %08x\n", m_scc->dma().channel[0].memory_address_counter);
|
||||
verboselog(*this, 0, "cdic_w: DMA Control Register = %04x & %04x\n", data, mem_mask);
|
||||
verboselog(*this, 0, "Doing copy, transferring %04x bytes\n", count * 2 );
|
||||
////printf("Doing copy, transferring %04x bytes\n", count * 2 );
|
||||
for(index = start / 2; index < (start / 2 + count); index++)
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: DMA Control Register = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "Memory address counter: %08x\n", m_scc->dma().channel[0].memory_address_counter);
|
||||
LOGMASKED(LOG_WRITES, "Doing copy, transferring %04x bytes\n", count * 2 );
|
||||
for (uint32_t index = start / 2; index < (start / 2 + count); index++)
|
||||
{
|
||||
if(m_scc->dma().channel[0].operation_control & OCR_D)
|
||||
if (m_scc->dma().channel[0].operation_control & OCR_D)
|
||||
{
|
||||
m_memory_space->write_word(index * 2, m_ram[device_index++]);
|
||||
}
|
||||
@ -1069,12 +1003,11 @@ WRITE16_MEMBER( cdicdic_device::regs_w )
|
||||
|
||||
case 0x3ffa/2:
|
||||
{
|
||||
verboselog(*this, 0, "cdic_w: Z-Buffer Register = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: Z-Buffer Register = %04x & %04x\n", data, mem_mask);
|
||||
COMBINE_DATA(&m_z_buffer);
|
||||
if(m_z_buffer & 0x2000)
|
||||
if (m_z_buffer & 0x2000)
|
||||
{
|
||||
attotime period = m_audio_sample_timer->remaining();
|
||||
if(period.is_never())
|
||||
if (m_audio_sample_timer->remaining().is_never())
|
||||
{
|
||||
m_decode_addr = m_z_buffer & 0x3a00;
|
||||
m_decode_delay = 1;
|
||||
@ -1088,17 +1021,19 @@ WRITE16_MEMBER( cdicdic_device::regs_w )
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x3ffc/2:
|
||||
verboselog(*this, 0, "cdic_w: Interrupt Vector Register = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: Interrupt Vector Register = %04x & %04x\n", data, mem_mask);
|
||||
COMBINE_DATA(&m_interrupt_vector);
|
||||
break;
|
||||
|
||||
case 0x3ffe/2:
|
||||
{
|
||||
verboselog(*this, 0, "cdic_w: Data Buffer Register = %04x & %04x\n", data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES, "cdic_w: Data Buffer Register = %04x & %04x\n", data, mem_mask);
|
||||
COMBINE_DATA(&m_data_buffer);
|
||||
if(m_data_buffer & 0x8000)
|
||||
if (m_data_buffer & 0x8000)
|
||||
{
|
||||
switch(m_command)
|
||||
switch (m_command)
|
||||
{
|
||||
//case 0x24: // Reset Mode 2
|
||||
case 0x2e: // Abort
|
||||
@ -1120,13 +1055,13 @@ WRITE16_MEMBER( cdicdic_device::regs_w )
|
||||
case 0x2c: // Seek
|
||||
{
|
||||
attotime period = m_interrupt_timer->remaining();
|
||||
if(!period.is_never())
|
||||
if (!period.is_never())
|
||||
{
|
||||
m_interrupt_timer->adjust(period);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_command != 0x23 && m_command != 0x24)
|
||||
if (m_command != 0x23 && m_command != 0x24)
|
||||
{
|
||||
m_interrupt_timer->adjust(attotime::from_hz(75));
|
||||
}
|
||||
@ -1134,7 +1069,7 @@ WRITE16_MEMBER( cdicdic_device::regs_w )
|
||||
break;
|
||||
}
|
||||
default:
|
||||
verboselog(*this, 0, "Unknown CDIC command: %02x\n", m_command );
|
||||
LOGMASKED(LOG_COMMANDS, "Unknown CDIC command: %02x\n", m_command );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1142,7 +1077,7 @@ WRITE16_MEMBER( cdicdic_device::regs_w )
|
||||
break;
|
||||
}
|
||||
default:
|
||||
verboselog(*this, 0, "cdic_w: UNIMPLEMENTED: Unknown address: %04x = %04x & %04x\n", addr*2, data, mem_mask);
|
||||
LOGMASKED(LOG_WRITES | LOG_UNKNOWNS, "cdic_w: Unknown address: %04x = %04x & %04x\n", addr*2, data, mem_mask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,42 @@ protected:
|
||||
TIMER_CALLBACK_MEMBER( trigger_readback_int );
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
CDIC_SECTOR_SYNC = 0,
|
||||
|
||||
CDIC_SECTOR_HEADER = 12,
|
||||
|
||||
CDIC_SECTOR_MODE = 15,
|
||||
|
||||
CDIC_SECTOR_FILE1 = 16,
|
||||
CDIC_SECTOR_CHAN1 = 17,
|
||||
CDIC_SECTOR_SUBMODE1 = 18,
|
||||
CDIC_SECTOR_CODING1 = 19,
|
||||
|
||||
CDIC_SECTOR_FILE2 = 20,
|
||||
CDIC_SECTOR_CHAN2 = 21,
|
||||
CDIC_SECTOR_SUBMODE2 = 22,
|
||||
CDIC_SECTOR_CODING2 = 23,
|
||||
|
||||
CDIC_SECTOR_DATA = 24,
|
||||
|
||||
CDIC_SECTOR_SIZE = 2352,
|
||||
|
||||
CDIC_SECTOR_DATASIZE = 2048,
|
||||
CDIC_SECTOR_AUDIOSIZE = 2304,
|
||||
CDIC_SECTOR_VIDEOSIZE = 2324,
|
||||
|
||||
CDIC_SUBMODE_EOF = 0x80,
|
||||
CDIC_SUBMODE_RT = 0x40,
|
||||
CDIC_SUBMODE_FORM = 0x20,
|
||||
CDIC_SUBMODE_TRIG = 0x10,
|
||||
CDIC_SUBMODE_DATA = 0x08,
|
||||
CDIC_SUBMODE_AUDIO = 0x04,
|
||||
CDIC_SUBMODE_VIDEO = 0x02,
|
||||
CDIC_SUBMODE_EOR = 0x01
|
||||
};
|
||||
|
||||
int is_valid_sample_buf(uint16_t addr) const;
|
||||
double sample_buf_freq(uint16_t addr) const;
|
||||
int sample_buf_size(uint16_t addr) const;
|
||||
|
@ -24,42 +24,26 @@ TODO:
|
||||
#include "emu.h"
|
||||
#include "machine/cdislave.h"
|
||||
|
||||
#define LOG_IRQS (1 << 0)
|
||||
#define LOG_COMMANDS (1 << 1)
|
||||
#define LOG_READS (1 << 2)
|
||||
#define LOG_WRITES (1 << 3)
|
||||
#define LOG_UNKNOWNS (1 << 4)
|
||||
|
||||
/*----------- debug defines -----------*/
|
||||
|
||||
#define VERBOSE_LEVEL (1)
|
||||
|
||||
#define ENABLE_VERBOSE_LOG (0)
|
||||
|
||||
#define VERBOSE (0)
|
||||
#include "logmacro.h"
|
||||
|
||||
// device type definition
|
||||
DEFINE_DEVICE_TYPE(CDI_SLAVE, cdislave_device, "cdislave", "CD-i Mono-I Slave")
|
||||
|
||||
|
||||
#if ENABLE_VERBOSE_LOG
|
||||
static inline void ATTR_PRINTF(3,4) verboselog(device_t& device, int n_level, const char *s_fmt, ...)
|
||||
{
|
||||
if( VERBOSE_LEVEL >= n_level )
|
||||
{
|
||||
va_list v;
|
||||
char buf[ 32768 ];
|
||||
va_start( v, s_fmt );
|
||||
vsprintf( buf, s_fmt, v );
|
||||
va_end( v );
|
||||
device.logerror("%s: %s", device.machine().describe_context(), buf );
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define verboselog(x,y,z, ...)
|
||||
#endif
|
||||
|
||||
//**************************************************************************
|
||||
// MEMBER FUNCTIONS
|
||||
//**************************************************************************
|
||||
|
||||
TIMER_CALLBACK_MEMBER( cdislave_device::trigger_readback_int )
|
||||
{
|
||||
verboselog(*this, 0, "%s", "Asserting IRQ2\n" );
|
||||
LOGMASKED(LOG_IRQS, "Asserting IRQ2\n");
|
||||
m_int_callback(ASSERT_LINE);
|
||||
m_interrupt_timer->adjust(attotime::never);
|
||||
}
|
||||
@ -86,7 +70,7 @@ void cdislave_device::perform_mouse_update()
|
||||
uint16_t old_mouse_x = m_real_mouse_x;
|
||||
uint16_t old_mouse_y = m_real_mouse_y;
|
||||
|
||||
if(m_real_mouse_x == 0xffff)
|
||||
if (m_real_mouse_x == 0xffff)
|
||||
{
|
||||
old_mouse_x = x & 0x3ff;
|
||||
old_mouse_y = y & 0x3ff;
|
||||
@ -98,12 +82,12 @@ void cdislave_device::perform_mouse_update()
|
||||
m_fake_mouse_x += (m_real_mouse_x - old_mouse_x);
|
||||
m_fake_mouse_y += (m_real_mouse_y - old_mouse_y);
|
||||
|
||||
while(m_fake_mouse_x > 0x3ff)
|
||||
while (m_fake_mouse_x > 0x3ff)
|
||||
{
|
||||
m_fake_mouse_x += 0x400;
|
||||
}
|
||||
|
||||
while(m_fake_mouse_y > 0x3ff)
|
||||
while (m_fake_mouse_y > 0x3ff)
|
||||
{
|
||||
m_fake_mouse_y += 0x400;
|
||||
}
|
||||
@ -111,7 +95,7 @@ void cdislave_device::perform_mouse_update()
|
||||
x = m_fake_mouse_x;
|
||||
y = m_fake_mouse_y;
|
||||
|
||||
if(m_polling_active)
|
||||
if (m_polling_active)
|
||||
{
|
||||
prepare_readback(attotime::zero, 0, 4, ((x & 0x380) >> 7) | (buttons << 4), x & 0x7f, (y & 0x380) >> 7, y & 0x7f, 0xf7);
|
||||
}
|
||||
@ -142,13 +126,13 @@ ioport_constructor cdislave_device::device_input_ports() const
|
||||
|
||||
READ16_MEMBER( cdislave_device::slave_r )
|
||||
{
|
||||
if(m_channel[offset].m_out_count)
|
||||
if (m_channel[offset].m_out_count)
|
||||
{
|
||||
uint8_t ret = m_channel[offset].m_out_buf[m_channel[offset].m_out_index];
|
||||
verboselog(*this, 0, "slave_r: Channel %d: %d, %02x\n", offset, m_channel[offset].m_out_index, ret );
|
||||
if(m_channel[offset].m_out_index == 0)
|
||||
LOGMASKED(LOG_READS, "slave_r: Channel %d: %d, %02x\n", offset, m_channel[offset].m_out_index, ret);
|
||||
if (m_channel[offset].m_out_index == 0)
|
||||
{
|
||||
switch(m_channel[offset].m_out_cmd)
|
||||
switch (m_channel[offset].m_out_cmd)
|
||||
{
|
||||
case 0xb0:
|
||||
case 0xb1:
|
||||
@ -156,13 +140,14 @@ READ16_MEMBER( cdislave_device::slave_r )
|
||||
case 0xf3:
|
||||
case 0xf4:
|
||||
case 0xf7:
|
||||
verboselog(*this, 0, "%s", "slave_r: De-asserting IRQ2\n" );
|
||||
m_int_callback(CLEAR_LINE); break;
|
||||
LOGMASKED(LOG_IRQS, "slave_r: De-asserting IRQ2\n");
|
||||
m_int_callback(CLEAR_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_channel[offset].m_out_index++;
|
||||
m_channel[offset].m_out_count--;
|
||||
if(!m_channel[offset].m_out_count)
|
||||
if (!m_channel[offset].m_out_count)
|
||||
{
|
||||
m_channel[offset].m_out_index = 0;
|
||||
m_channel[offset].m_out_cmd = 0;
|
||||
@ -170,7 +155,7 @@ READ16_MEMBER( cdislave_device::slave_r )
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
verboselog(*this, 0, "slave_r: Channel %d: %d\n", offset, m_channel[offset].m_out_index );
|
||||
LOGMASKED(LOG_READS, "slave_r: Channel %d: %d (nothing to output)\n", offset, m_channel[offset].m_out_index);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
@ -186,7 +171,7 @@ void cdislave_device::set_mouse_position()
|
||||
// x = m_fake_mouse_x;
|
||||
// y = m_fake_mouse_y;
|
||||
|
||||
if(m_polling_active)
|
||||
if (m_polling_active)
|
||||
{
|
||||
//prepare_readback(attotime::zero, 0, 4, (x & 0x380) >> 7, x & 0x7f, (y & 0x380) >> 7, y & 0x7f, 0xf7);
|
||||
}
|
||||
@ -194,17 +179,17 @@ void cdislave_device::set_mouse_position()
|
||||
|
||||
WRITE16_MEMBER( cdislave_device::slave_w )
|
||||
{
|
||||
switch(offset)
|
||||
LOGMASKED(LOG_WRITES, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff);
|
||||
switch (offset)
|
||||
{
|
||||
case 0:
|
||||
if(m_in_index)
|
||||
if (m_in_index)
|
||||
{
|
||||
verboselog(*this, 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
|
||||
m_in_buf[m_in_index] = data & 0x00ff;
|
||||
m_in_index++;
|
||||
if(m_in_index == m_in_count)
|
||||
if (m_in_index == m_in_count)
|
||||
{
|
||||
switch(m_in_buf[0])
|
||||
switch (m_in_buf[0])
|
||||
{
|
||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7:
|
||||
case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf:
|
||||
@ -226,7 +211,7 @@ WRITE16_MEMBER( cdislave_device::slave_w )
|
||||
{
|
||||
m_in_buf[m_in_index] = data & 0x00ff;
|
||||
m_in_index++;
|
||||
switch(data & 0x00ff)
|
||||
switch (data & 0x00ff)
|
||||
{
|
||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7:
|
||||
case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf:
|
||||
@ -236,25 +221,24 @@ WRITE16_MEMBER( cdislave_device::slave_w )
|
||||
case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef:
|
||||
case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
|
||||
case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff:
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Update Mouse Position (0x%02x)\n", offset, data & 0x00ff );
|
||||
LOGMASKED(LOG_COMMANDS, "slave_w: Channel %d: Update Mouse Position (0x%02x)\n", offset, data & 0x00ff);
|
||||
m_in_count = 3;
|
||||
break;
|
||||
default:
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_UNKNOWNS, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff);
|
||||
m_in_index = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(m_in_index)
|
||||
if (m_in_index)
|
||||
{
|
||||
verboselog(*this, 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
|
||||
m_in_buf[m_in_index] = data & 0x00ff;
|
||||
m_in_index++;
|
||||
if(m_in_index == m_in_count)
|
||||
if (m_in_index == m_in_count)
|
||||
{
|
||||
switch(m_in_buf[0])
|
||||
switch (m_in_buf[0])
|
||||
{
|
||||
case 0xf0: // Set Front Panel LCD
|
||||
memcpy(m_lcd_state, m_in_buf + 1, 16);
|
||||
@ -272,10 +256,10 @@ WRITE16_MEMBER( cdislave_device::slave_w )
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(data & 0x00ff)
|
||||
switch (data & 0x00ff)
|
||||
{
|
||||
default:
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_UNKNOWNS, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff);
|
||||
memset(m_in_buf, 0, 17);
|
||||
m_in_index = 0;
|
||||
m_in_count = 0;
|
||||
@ -284,14 +268,13 @@ WRITE16_MEMBER( cdislave_device::slave_w )
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(m_in_index)
|
||||
if (m_in_index)
|
||||
{
|
||||
verboselog(*this, 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
|
||||
m_in_buf[m_in_index] = data & 0x00ff;
|
||||
m_in_index++;
|
||||
if(m_in_index == m_in_count)
|
||||
if (m_in_index == m_in_count)
|
||||
{
|
||||
switch(m_in_buf[0])
|
||||
switch (m_in_buf[0])
|
||||
{
|
||||
case 0xf0: // Set Front Panel LCD
|
||||
memset(m_in_buf + 1, 0, 16);
|
||||
@ -309,10 +292,10 @@ WRITE16_MEMBER( cdislave_device::slave_w )
|
||||
{
|
||||
m_in_buf[m_in_index] = data & 0x00ff;
|
||||
m_in_index++;
|
||||
switch(data & 0x00ff)
|
||||
switch (data & 0x00ff)
|
||||
{
|
||||
case 0x82: // Mute Audio
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Mute Audio (0x82)\n", offset );
|
||||
LOGMASKED(LOG_COMMANDS, "slave_w: Channel %d: Mute Audio (0x82)\n", offset);
|
||||
m_dmadac[0]->enable(0);
|
||||
m_dmadac[1]->enable(0);
|
||||
m_in_index = 0;
|
||||
@ -320,18 +303,18 @@ WRITE16_MEMBER( cdislave_device::slave_w )
|
||||
//cdic->audio_sample_timer->adjust(attotime::never);
|
||||
break;
|
||||
case 0x83: // Unmute Audio
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Unmute Audio (0x83)\n", offset );
|
||||
LOGMASKED(LOG_COMMANDS, "slave_w: Channel %d: Unmute Audio (0x83)\n", offset);
|
||||
m_dmadac[0]->enable(1);
|
||||
m_dmadac[1]->enable(1);
|
||||
m_in_index = 0;
|
||||
m_in_count = 0;
|
||||
break;
|
||||
case 0xf0: // Set Front Panel LCD
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Set Front Panel LCD (0xf0)\n", offset );
|
||||
LOGMASKED(LOG_COMMANDS, "slave_w: Channel %d: Set Front Panel LCD (0xf0)\n", offset);
|
||||
m_in_count = 17;
|
||||
break;
|
||||
default:
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_UNKNOWNS, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff);
|
||||
memset(m_in_buf, 0, 17);
|
||||
m_in_index = 0;
|
||||
m_in_count = 0;
|
||||
@ -340,14 +323,13 @@ WRITE16_MEMBER( cdislave_device::slave_w )
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(m_in_index)
|
||||
if (m_in_index)
|
||||
{
|
||||
verboselog(*this, 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
|
||||
m_in_buf[m_in_index] = data & 0x00ff;
|
||||
m_in_index++;
|
||||
if(m_in_index == m_in_count)
|
||||
if (m_in_index == m_in_count)
|
||||
{
|
||||
switch(m_in_buf[0])
|
||||
switch (m_in_buf[0])
|
||||
{
|
||||
case 0xb0: // Request Disc Status
|
||||
memset(m_in_buf, 0, 17);
|
||||
@ -373,48 +355,48 @@ WRITE16_MEMBER( cdislave_device::slave_w )
|
||||
{
|
||||
m_in_buf[m_in_index] = data & 0x00ff;
|
||||
m_in_index++;
|
||||
switch(data & 0x00ff)
|
||||
switch (data & 0x00ff)
|
||||
{
|
||||
case 0xb0: // Request Disc Status
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Request Disc Status (0xb0)\n", offset );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_WRITES, "slave_w: Channel %d: Request Disc Status (0xb0)\n", offset);
|
||||
m_in_count = 4;
|
||||
break;
|
||||
case 0xb1: // Request Disc Base
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Request Disc Base (0xb1)\n", offset );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_WRITES, "slave_w: Channel %d: Request Disc Base (0xb1)\n", offset);
|
||||
m_in_count = 4;
|
||||
break;
|
||||
case 0xf0: // Request SLAVE Revision
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Request SLAVE Revision (0xf0)\n", offset );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_WRITES, "slave_w: Channel %d: Request SLAVE Revision (0xf0)\n", offset);
|
||||
prepare_readback(attotime::from_hz(10000), 2, 2, 0xf0, 0x32, 0x31, 0, 0xf0);
|
||||
m_in_index = 0;
|
||||
break;
|
||||
case 0xf3: // Request Pointer Type
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Request Pointer Type (0xf3)\n", offset );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_WRITES, "slave_w: Channel %d: Request Pointer Type (0xf3)\n", offset);
|
||||
m_in_index = 0;
|
||||
prepare_readback(attotime::from_hz(10000), 2, 2, 0xf3, 1, 0, 0, 0xf3);
|
||||
break;
|
||||
case 0xf4: // Request Test Plug Status
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Request Test Plug Status (0xf4)\n", offset );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_WRITES, "slave_w: Channel %d: Request Test Plug Status (0xf4)\n", offset);
|
||||
m_in_index = 0;
|
||||
prepare_readback(attotime::from_hz(10000), 2, 2, 0xf4, 0, 0, 0, 0xf4);
|
||||
break;
|
||||
case 0xf6: // Request NTSC/PAL Status
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Request NTSC/PAL Status (0xf6)\n", offset );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_WRITES, "slave_w: Channel %d: Request NTSC/PAL Status (0xf6)\n", offset);
|
||||
prepare_readback(attotime::never, 2, 2, 0xf6, 2, 0, 0, 0xf6);
|
||||
m_in_index = 0;
|
||||
break;
|
||||
case 0xf7: // Enable Input Polling
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Activate Input Polling (0xf7)\n", offset );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_WRITES, "slave_w: Channel %d: Activate Input Polling (0xf7)\n", offset);
|
||||
m_polling_active = 1;
|
||||
m_in_index = 0;
|
||||
break;
|
||||
case 0xfa: // Enable X-Bus Interrupts
|
||||
verboselog(*this, 0, "slave_w: Channel %d: X-Bus Interrupt Enable (0xfa)\n", offset );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_WRITES, "slave_w: Channel %d: X-Bus Interrupt Enable (0xfa)\n", offset);
|
||||
m_xbus_interrupt_enable = 1;
|
||||
m_in_index = 0;
|
||||
break;
|
||||
default:
|
||||
verboselog(*this, 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
|
||||
LOGMASKED(LOG_COMMANDS | LOG_UNKNOWNS, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff);
|
||||
memset(m_in_buf, 0, 17);
|
||||
m_in_index = 0;
|
||||
m_in_count = 0;
|
||||
@ -515,7 +497,7 @@ void cdislave_device::device_start()
|
||||
|
||||
void cdislave_device::device_reset()
|
||||
{
|
||||
for(auto & elem : m_channel)
|
||||
for (auto & elem : m_channel)
|
||||
{
|
||||
elem.m_out_buf[0] = 0;
|
||||
elem.m_out_buf[1] = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user