machine/stvcd.cpp: better split LOG calls to areas of interest

This commit is contained in:
angelosa 2023-05-17 23:00:29 +02:00
parent a6ec7a7bd2
commit 81bd070bf8

View File

@ -45,10 +45,23 @@ DASM notes:
#include "coreutil.h"
// super-verbose
//#define VERBOSE 1
#define LOG_WARN (1U << 1)
#define LOG_CMD (1U << 2)
#define LOG_SEEK (1U << 3)
#define LOG_XFER (1U << 4)
#define VERBOSE (LOG_CMD | LOG_WARN)
//#define LOG_OUTPUT_FUNC osd_printf_info
#include "logmacro.h"
#define LOGWARN(...) LOGMASKED(LOG_WARN, __VA_ARGS__)
#define LOGCMD(...) LOGMASKED(LOG_CMD, __VA_ARGS__)
#define LOGSEEK(...) LOGMASKED(LOG_SEEK, __VA_ARGS__)
#define LOGXFER(...) LOGMASKED(LOG_XFER, __VA_ARGS__)
#define LIVE_CD_VIEW 0
// HIRQ definitions
#define CMOK 0x0001 // command dispatch possible
#define DRDY 0x0002 // data transfer preparations complete
@ -159,7 +172,7 @@ u32 stvcd_device::datatrns_r(offs_t offset, uint32_t mem_mask)
}
else
{
printf("CD: Unknown data buffer read with mask = %08x\n", mem_mask);
LOGWARN("CD: Unknown data buffer read with mask = %08x\n", mem_mask);
rv = 0;
}
return rv;
@ -170,7 +183,7 @@ void stvcd_device::datatrns_w(offs_t offset, uint32_t data, uint32_t mem_mask)
if (mem_mask == 0xffffffff)
dataxfer_long_w(data);
else
printf("CD: Unknown data buffer write with mask = %08x\n", mem_mask);
LOGWARN("CD: Unknown data buffer write with mask = %08x\n", mem_mask);
}
inline u32 stvcd_device::dataxfer_long_r()
@ -232,7 +245,7 @@ inline u32 stvcd_device::dataxfer_long_r()
break;
default:
osd_printf_error("CD: unhandled 32-bit transfer type %d\n", (int)xfertype32);
LOGWARN("CD: unhandled 32-bit transfer type %d\n", (int)xfertype32);
break;
}
@ -273,7 +286,7 @@ inline void stvcd_device::dataxfer_long_w(u32 data)
break;
default:
printf("CD: unhandled 32-bit transfer type write %d\n", (int)xfertype32);
LOGWARN("CD: unhandled 32-bit transfer type write %d\n", (int)xfertype32);
break;
}
}
@ -371,7 +384,7 @@ inline u16 stvcd_device::dataxfer_word_r()
break;
default:
osd_printf_error("STVCD: Unhandled xfer type %d\n", (int)xfertype);
LOGWARN("STVCD: Unhandled xfer type %d\n", (int)xfertype);
rv = 0;
break;
}
@ -403,13 +416,13 @@ void stvcd_device::hirq_w(uint16_t data) { hirqreg &= data; }
// TODO: these two are actually never read or written to by host?
uint16_t stvcd_device::hirqmask_r()
{
printf("RW HIRM: %04x\n", hirqmask);
LOGWARN("RW HIRM: %04x\n", hirqmask);
return hirqmask;
}
void stvcd_device::hirqmask_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
printf("WW HIRM: %04x => %04x\n", hirqmask, data);
LOGWARN("WW HIRM: %04x => %04x\n", hirqmask, data);
COMBINE_DATA(&hirqmask);
}
@ -538,7 +551,7 @@ void stvcd_device::mpeg_standard_return(uint16_t cur_status)
void stvcd_device::cmd_get_status()
{
//LOG("%s: Get Status\n", machine().describe_context();
//LOGCMD("%s: Get Status\n", machine().describe_context();
hirqreg |= CMOK;
if(status_type == 0)
cr_standard_return(cd_stat);
@ -555,7 +568,7 @@ void stvcd_device::cmd_get_status()
void stvcd_device::cmd_get_hw_info()
{
LOG("%s: Get Hardware Info\n", machine().describe_context());
LOGCMD("%s: Get Hardware Info\n", machine().describe_context());
hirqreg |= CMOK;
cr1 = cd_stat;
cr2 = 0x0201;
@ -566,7 +579,7 @@ void stvcd_device::cmd_get_hw_info()
void stvcd_device::cmd_get_toc()
{
LOG("%s: Get TOC\n", machine().describe_context());
LOGCMD("%s: Get TOC\n", machine().describe_context());
cd_readTOC();
cd_stat = CD_STAT_TRANS|CD_STAT_PAUSE;
cr1 = cd_stat;
@ -584,7 +597,8 @@ void stvcd_device::cmd_get_session_info()
// bios is interested in returns in cr3 and cr4
// cr3 should be data track #
// cr4 must be > 1 and < 100 or bios gets angry.
LOG("%s: Get Session Info\n", machine().describe_context());
LOGCMD("%s: Get Session Info\n", machine().describe_context());
// TODO: shouldn't really read from TOC
cd_readTOC();
switch (cr1 & 0xff)
{
@ -605,7 +619,7 @@ void stvcd_device::cmd_get_session_info()
break;
default:
osd_printf_error("CD: Unknown request to Get Session Info %x\n", cr1 & 0xff);
LOGWARN("CD: Unknown request to Get Session Info %x\n", cr1 & 0xff);
cr1 = cd_stat;
cr2 = 0;
cr3 = 0;
@ -627,7 +641,7 @@ void stvcd_device::cmd_init_cdsystem()
// CR1 & 8 = retry reading mode 2 sectors
// CR1 & 10 = force single-speed
// CR1 & 80 = no change flag (done by Assault Suit Leynos 2)
LOG("%s: Initialize CD system\n", machine().describe_context());
LOGCMD("%s: Initialize CD system\n", machine().describe_context());
//if((cr1 & 0x81) == 0x00) //guess TODO: nope, Choice Cuts doesn't like it, it crashes if you try to skip the FMV otherwise.
{
if(((cd_stat & 0x0f00) != CD_STAT_NODISC) && ((cd_stat & 0x0f00) != CD_STAT_OPEN))
@ -674,7 +688,7 @@ void stvcd_device::cmd_end_data_transfer()
// end data transfer (TODO: needs to be worked on!)
// returns # of bytes transferred (24 bits) in
// low byte of cr1 (MSB) and cr2 (middle byte, LSB)
LOG("%s: End data transfer (%d bytes xfer'd)\n", machine().describe_context(), xferdnum);
LOGXFER("%s: End data transfer (%d bytes xfer'd)\n", machine().describe_context(), xferdnum);
// clear the "transfer" flag
cd_stat &= ~CD_STAT_TRANS;
@ -688,7 +702,7 @@ void stvcd_device::cmd_end_data_transfer()
}
else
{
logerror("No xferdnum error\n");
LOGWARN("No xferdnum error\n");
cr1 = (cd_stat) | (0xff); // is this right?
cr2 = 0xffff;
cr3 = 0;
@ -742,17 +756,17 @@ void stvcd_device::cmd_end_data_transfer()
xferdnum = 0;
hirqreg |= CMOK;
LOG(" = %04x %04x %04x %04x %04x\n", hirqreg, cr1, cr2, cr3, cr4);
LOGXFER("\t%04x %04x %04x %04x %04x\n", hirqreg, cr1, cr2, cr3, cr4);
status_type = 1;
}
void stvcd_device::cmd_play_disc()
{
// Play Disc. FAD is in lowest 7 bits of cr1 and all of cr2.
// Play Disc. FAD is in lowest 7 bits of cr1 and all of cr2.
uint32_t start_pos, end_pos;
uint8_t play_mode;
LOG("%s: Play Disc\n", machine().describe_context());
LOGCMD("%s: Play Disc\n", machine().describe_context());
cd_stat = CD_STAT_PLAY;
play_mode = (cr3 >> 8) & 0x7f;
@ -767,7 +781,7 @@ void stvcd_device::cmd_play_disc()
if (start_pos != 0xffffff)
cd_curfad = start_pos & 0xfffff;
logerror("fad mode\n");
LOGCMD("\tFAD mode\n");
cur_track = m_cdrom_image->get_track(cd_curfad-150);
}
else
@ -789,7 +803,7 @@ void stvcd_device::cmd_play_disc()
return;
}
printf("track mode %d\n",cur_track);
LOGCMD("\ttrack mode %d\n",cur_track);
}
if (end_pos & 0x800000)
@ -822,7 +836,7 @@ void stvcd_device::cmd_play_disc()
else
fadstoplay = (m_cdrom_image->get_track_start((end_pos & 0xff00) >> 8)) - cd_curfad;
}
logerror("track mode %08x %08x\n",cd_curfad,fadstoplay);
LOGCMD("\ttrack mode %08x %08x\n", cd_curfad, fadstoplay);
}
else
{
@ -838,11 +852,11 @@ void stvcd_device::cmd_play_disc()
cd_curfad = m_cdrom_image->get_track_start(cur_track-1);
fadstoplay = m_cdrom_image->get_track_start(cur_track) - cd_curfad;
}
logerror("track resume %08x %08x\n",cd_curfad,fadstoplay);
LOGCMD("\ttrack resume %08x %08x\n",cd_curfad,fadstoplay);
}
}
LOG("Play Disc: start %x length %x\n", cd_curfad, fadstoplay);
LOGCMD("\tPlay Disc: start %x length %x\n", cd_curfad, fadstoplay);
cr_standard_return(cd_stat);
hirqreg |= (CMOK);
@ -872,8 +886,8 @@ void stvcd_device::cmd_seek_disc()
{
uint32_t temp;
LOG("%s: Disc seek\n", machine().describe_context());
//printf("%08x %08x %08x %08x\n",cr1,cr2,cr3,cr4);
LOGCMD("%s: Disc seek\n", machine().describe_context());
LOGCMD("\t%08x %08x %08x %08x\n",cr1,cr2,cr3,cr4);
if (cr1 & 0x80)
{
temp = (cr1&0xff)<<16; // get FAD to seek to
@ -889,7 +903,7 @@ void stvcd_device::cmd_seek_disc()
else
{
cd_curfad = ((cr1&0x7f)<<16) | cr2;
printf("disc seek with params %04x %04x\n",cr1,cr2); //Area 51 sets this up
LOGCMD("\tdisc seek with params %04x %04x\n",cr1,cr2); //Area 51 sets this up
}
}
else
@ -1008,7 +1022,7 @@ void stvcd_device::cmd_set_cddevice_connection()
// get operation
parm = cr3>>8;
LOG("%s: Set CD Device Connection filter # %x\n", machine().describe_context(), parm);
LOGCMD("%s: Set CD Device Connection filter # %x\n", machine().describe_context(), parm);
cddevicenum = parm;
@ -1053,12 +1067,12 @@ void stvcd_device::cmd_set_filter_range()
// cr3 hi = filter num.
uint8_t fnum = (cr3>>8)&0xff;
LOG("%s: Set Filter Range\n", machine().describe_context());
LOGCMD("%s: Set Filter Range\n", machine().describe_context());
filters[fnum].fad = ((cr1 & 0xff)<<16) | cr2;
filters[fnum].range = ((cr3 & 0xff)<<16) | cr4;
printf("%08x %08x %d\n",filters[fnum].fad,filters[fnum].range,fnum);
LOGCMD("\t%08x %08x %d\n",filters[fnum].fad,filters[fnum].range,fnum);
hirqreg |= (CMOK|ESEL);
cr_standard_return(cd_stat);
@ -1076,7 +1090,7 @@ void stvcd_device::cmd_set_filter_subheader_conditions()
// Set Filter Subheader conditions
uint8_t fnum = (cr3>>8)&0xff;
LOG("%s: Set Filter Subheader conditions %x => chan %x masks %x fid %x vals %x\n", machine().describe_context(), fnum, cr1&0xff, cr2, cr3&0xff, cr4);
LOGCMD("%s: Set Filter Subheader conditions %x => chan %x masks %x fid %x vals %x\n", machine().describe_context(), fnum, cr1&0xff, cr2, cr3&0xff, cr4);
filters[fnum].chan = cr1 & 0xff;
filters[fnum].smmask = (cr2>>8)&0xff;
@ -1096,7 +1110,7 @@ void stvcd_device::cmd_get_filter_subheader_conditions()
// Get Filter Subheader conditions
uint8_t fnum = (cr3>>8)&0xff;
LOG("%s: Set Filter Subheader conditions %x => chan %x masks %x fid %x vals %x\n", machine().describe_context(), fnum, cr1&0xff, cr2, cr3&0xff, cr4);
LOGCMD("%s: Set Filter Subheader conditions %x => chan %x masks %x fid %x vals %x\n", machine().describe_context(), fnum, cr1&0xff, cr2, cr3&0xff, cr4);
cr1 = cd_stat | (filters[fnum].chan & 0xff);
cr2 = (filters[fnum].smmask << 8) | (filters[fnum].cimask & 0xff);
@ -1123,7 +1137,7 @@ void stvcd_device::cmd_set_filter_mode()
filters[fnum].mode = mode;
}
LOG("%s: Set Filter Mode filt %x mode %x\n", machine().describe_context(), fnum, mode);
LOGCMD("%s: Set Filter Mode filt %x mode %x\n", machine().describe_context(), fnum, mode);
hirqreg |= (CMOK|ESEL);
cr_standard_return(cd_stat);
status_type = 0;
@ -1150,7 +1164,7 @@ void stvcd_device::cmd_set_filter_connection()
// (false condition?)
uint8_t fnum = (cr3>>8)&0xff;
LOG("%s:CD: Set Filter Connection %x => mode %x parm %04x\n", machine().describe_context(), fnum, cr1 & 0xf, cr2);
LOGCMD("%s: Set Filter Connection %x => mode %x parm %04x\n", machine().describe_context(), fnum, cr1 & 0xf, cr2);
if (cr1 & 1) // set true condition
filters[fnum].condtrue = (cr2>>8)&0xff;
@ -1168,7 +1182,7 @@ void stvcd_device::cmd_reset_selector()
int i,j;
// Reset Selector
LOG("%s: Reset Selector\n", machine().describe_context());
LOGCMD("%s: Reset Selector\n", machine().describe_context());
if((cr1 & 0xff) == 0x00)
{
@ -1271,12 +1285,12 @@ void stvcd_device::cmd_get_buffer_partition_sector_number()
uint32_t bufnum = cr3>>8;
LOG("%s: Get Sector Number (bufno %d) = %d blocks\n", machine().describe_context(), bufnum, cr4);
LOGCMD("%s: Get Sector Number (bufno %d) = %d blocks\n", machine().describe_context(), bufnum, cr4);
cr1 = cd_stat;
cr2 = 0;
cr3 = 0;
if(cr1 & 0xff || cr2 || cr3 & 0xff || cr4)
printf("Get # sectors used with params %04x %04x %04x %04x\n",cr1,cr2,cr3,cr4);
LOGWARN("Get # sectors used with params %04x %04x %04x %04x\n",cr1,cr2,cr3,cr4);
// is the partition empty?
if (partitions[bufnum].size == -1)
@ -1286,10 +1300,10 @@ void stvcd_device::cmd_get_buffer_partition_sector_number()
else
{
cr4 = partitions[bufnum].numblks;
//printf("Partition %08x %04x\n",bufnum,cr4);
//LOGWARN("Partition %08x %04x\n",bufnum,cr4);
}
//printf("%04x\n",cr4);
//LOGWARN("%04x\n",cr4);
if(cr4 == 0)
hirqreg |= (CMOK);
else
@ -1304,7 +1318,7 @@ void stvcd_device::cmd_calculate_actual_data_size()
uint32_t sectoffs = cr2;
uint32_t numsect = cr4;
LOG("%s: Calculate actual size: buf %x offs %x numsect %x\n", machine().describe_context(), bufnum, sectoffs, numsect);
LOGCMD("%s: Calculate actual size: buf %x offs %x numsect %x\n", machine().describe_context(), bufnum, sectoffs, numsect);
calcsize = 0;
if (partitions[bufnum].size != -1)
@ -1328,7 +1342,7 @@ void stvcd_device::cmd_calculate_actual_data_size()
void stvcd_device::cmd_get_actual_data_size()
{
// get actual block size
LOG("%s: Get actual block size\n", machine().describe_context());
LOGCMD("%s: Get actual block size\n", machine().describe_context());
cr1 = cd_stat | ((calcsize>>16)&0xff);
cr2 = (calcsize & 0xffff);
cr3 = 0;
@ -1347,7 +1361,7 @@ void stvcd_device::cmd_get_sector_information()
{
cr1 |= CD_STAT_REJECT & 0xff00;
hirqreg |= (CMOK|ESEL);
printf("Get sector info reject\n");
LOGWARN("Get sector info reject\n");
}
else
{
@ -1364,7 +1378,7 @@ void stvcd_device::cmd_get_sector_information()
void stvcd_device::cmd_set_sector_length()
{
// set sector length
LOG("%s: Set sector length\n", machine().describe_context());
LOGCMD("%s: Set sector length\n", machine().describe_context());
switch (cr1 & 0xff)
{
@ -1409,13 +1423,13 @@ void stvcd_device::cmd_get_sector_data()
uint32_t sectofs = cr2;
uint32_t bufnum = cr3>>8;
LOG("%s: Get sector data (SN %d SO %d BN %d)\n", machine().describe_context(), sectnum, sectofs, bufnum);
LOGCMD("%s: Get sector data (SN %d SO %d BN %d)\n", machine().describe_context(), sectnum, sectofs, bufnum);
if (bufnum >= MAX_FILTERS)
{
// TODO: find actual SW that does this
// (may conceal a bigger issue)
osd_printf_error("CD: invalid buffer number\n");
LOGWARN("CD: invalid buffer number\n");
cr_standard_return(CD_STAT_REJECT);
hirqreg |= (CMOK|EHST);
return;
@ -1423,7 +1437,7 @@ void stvcd_device::cmd_get_sector_data()
if (partitions[bufnum].numblks < sectnum)
{
osd_printf_error("CD: buffer is not full %08x %08x\n",partitions[bufnum].numblks,sectnum);
LOGWARN("CD: buffer is not full %08x %08x\n",partitions[bufnum].numblks,sectnum);
cr_standard_return(CD_STAT_REJECT);
hirqreg |= (CMOK|EHST);
return;
@ -1453,12 +1467,12 @@ void stvcd_device::cmd_delete_sector_data()
uint32_t bufnum = cr3>>8;
int32_t i;
LOG("%s: Delete sector data (SN %d SO %d BN %d)\n", machine().describe_context(), sectnum, sectofs, bufnum);
LOGCMD("%s: Delete sector data (SN %d SO %d BN %d)\n", machine().describe_context(), sectnum, sectofs, bufnum);
if (bufnum >= MAX_FILTERS)
{
// TODO: mustn't happen
osd_printf_error("CD: invalid buffer number\n");
LOGWARN("CD: invalid buffer number\n");
cr_standard_return(CD_STAT_REJECT);
hirqreg |= (CMOK|EHST);
return;
@ -1468,7 +1482,7 @@ void stvcd_device::cmd_delete_sector_data()
// TODO: verify if implementation is correct
if (partitions[bufnum].numblks == 0)
{
osd_printf_error("CD: buffer is already empty\n");
LOGWARN("CD: buffer is already empty\n");
cr_standard_return(CD_STAT_REJECT);
hirqreg |= (CMOK|EHST);
return;
@ -1512,12 +1526,12 @@ void stvcd_device::cmd_get_and_delete_sector_data()
uint32_t sectofs = cr2;
uint32_t bufnum = cr3>>8;
LOG("%s: Get and delete sector data (SN %d SO %d BN %d)\n", machine().describe_context(), sectnum, sectofs, bufnum);
LOGCMD("%s: Get and delete sector data (SN %d SO %d BN %d)\n", machine().describe_context(), sectnum, sectofs, bufnum);
if (bufnum >= MAX_FILTERS)
{
// TODO: mustn't happen
osd_printf_error("CD: invalid buffer number\n");
LOGWARN("CD: invalid buffer number\n");
cr_standard_return(CD_STAT_REJECT);
hirqreg |= (CMOK|EHST);
return;
@ -1527,7 +1541,7 @@ void stvcd_device::cmd_get_and_delete_sector_data()
// TODO: verify again if it's really REJECT or something else
if (partitions[bufnum].numblks < sectnum)
{
osd_printf_error("CD: buffer is not full %08x %08x\n",partitions[bufnum].numblks,sectnum);
LOGWARN("CD: buffer is not full %08x %08x\n",partitions[bufnum].numblks,sectnum);
cr_standard_return(CD_STAT_REJECT);
hirqreg |= (CMOK|EHST);
return;
@ -1634,7 +1648,7 @@ void stvcd_device::cmd_copy_sector_data()
void stvcd_device::cmd_get_sector_data_copy_or_move_error()
{
// get copy error
LOG("%s: Get copy error\n", machine().describe_context());
LOGCMD("%s: Get copy error\n", machine().describe_context());
logerror("Get copy error\n");
cr1 = cd_stat;
cr2 = 0;
@ -1648,7 +1662,7 @@ void stvcd_device::cmd_change_directory()
{
uint32_t temp;
// change directory
LOG("%s: Change Directory\n", machine().describe_context());
LOGCMD("%s: Change Directory\n", machine().describe_context());
hirqreg |= (CMOK|EFLS);
temp = (cr3&0xff)<<16;
@ -1662,7 +1676,7 @@ void stvcd_device::cmd_change_directory()
void stvcd_device::cmd_read_directory()
{
// Read directory entry
LOG("%s: Read Directory Entry\n", machine().describe_context());
LOGCMD("%s: Read Directory Entry\n", machine().describe_context());
// uint32_t read_dir;
// read_dir = ((cr3&0xff)<<16)|cr4;
@ -1683,13 +1697,13 @@ void stvcd_device::cmd_read_directory()
void stvcd_device::cmd_get_file_scope()
{
// Get file system scope
LOG("%s: Get file system scope\n", machine().describe_context());
LOGCMD("%s: Get file system scope\n", machine().describe_context());
hirqreg |= (CMOK|EFLS);
cr1 = cd_stat;
cr2 = numfiles; // # of files in directory
cr3 = 0x0100; // report directory held
cr4 = firstfile; // first file id
printf("%04x %04x %04x %04x\n",cr1,cr2,cr3,cr4);
LOGWARN("%04x %04x %04x %04x\n",cr1,cr2,cr3,cr4);
status_type = 0;
}
@ -1698,7 +1712,7 @@ void stvcd_device::cmd_get_target_file_info()
uint32_t temp;
// Get File Info
LOG("%s: Get File Info\n", machine().describe_context());
LOGCMD("%s: Get File Info\n", machine().describe_context());
cd_stat |= CD_STAT_TRANS;
cd_stat &= 0xff00; // clear top byte of return value
playtype = 0;
@ -1737,7 +1751,7 @@ void stvcd_device::cmd_get_target_file_info()
// (iso9660 parsing doesn't read beyond the first sector)
if (curdir[temp].firstfad == 0 || curdir[temp].length == 0)
throw emu_fatalerror("File ID not found in XFERTYPE_FILEINFO_1");
// printf("%08x %08x\n",curdir[temp].firstfad,curdir[temp].length);
// LOGWARN("%08x %08x\n",curdir[temp].firstfad,curdir[temp].length);
// first 4 bytes = FAD
finfbuf[0] = (curdir[temp].firstfad>>24)&0xff;
finfbuf[1] = (curdir[temp].firstfad>>16)&0xff;
@ -1764,7 +1778,7 @@ void stvcd_device::cmd_get_target_file_info()
void stvcd_device::cmd_read_file()
{
// Read File
LOG("%s: Read File\n", machine().describe_context());
LOGCMD("%s: Read File\n", machine().describe_context());
uint16_t file_offset,file_filter,file_id,file_size;
file_offset = ((cr1 & 0xff)<<8)|(cr2 & 0xff); /* correct? */
@ -1780,7 +1794,7 @@ void stvcd_device::cmd_read_file()
else
cddevice = (filterT *)nullptr;
printf("Read file %08x (%08x %08x) %02x %d\n",curdir[file_id].firstfad,cd_curfad,fadstoplay,file_filter,sectlenin);
LOGWARN("Read file %08x (%08x %08x) %02x %d\n",curdir[file_id].firstfad,cd_curfad,fadstoplay,file_filter,sectlenin);
cr_standard_return(cd_stat);
@ -1795,7 +1809,7 @@ void stvcd_device::cmd_read_file()
void stvcd_device::cmd_abort_file()
{
LOG("%s: Abort File\n", machine().describe_context());
LOGCMD("%s: Abort File\n", machine().describe_context());
// bios expects "2bc" mask to work against this
hirqreg |= (CMOK|EFLS);
sectorstore = 0;
@ -1810,7 +1824,7 @@ void stvcd_device::cmd_abort_file()
void stvcd_device::cmd_check_copy_protection()
{
// appears to be copy protection check. needs only to return OK.
LOG("%s: Verify copy protection\n", machine().describe_context());
LOGCMD("%s: Verify copy protection\n", machine().describe_context());
if(((cd_stat & 0x0f00) != CD_STAT_NODISC) && ((cd_stat & 0x0f00) != CD_STAT_OPEN))
cd_stat = CD_STAT_PAUSE;
@ -1833,7 +1847,7 @@ void stvcd_device::cmd_check_copy_protection()
void stvcd_device::cmd_get_disc_region()
{
// get disc region
LOG("%s: Get disc region\n", machine().describe_context());
LOGCMD("%s: Get disc region\n", machine().describe_context());
if(cd_stat != CD_STAT_NODISC && cd_stat != CD_STAT_OPEN)
cd_stat = CD_STAT_PAUSE;
cr1 = cd_stat; // necessary to pass
@ -2120,7 +2134,7 @@ stvcd_device::blockT *stvcd_device::cd_alloc_block(uint8_t *blknum)
if (freeblocks <= 0)
{
buffull = 1;
printf("buffull in cd_alloc_block\n");
LOGWARN("buffull in cd_alloc_block\n");
}
blocks[i].size = sectlenin;
@ -2166,7 +2180,7 @@ void stvcd_device::cd_getsectoroffsetnum(uint32_t bufnum, uint32_t *sectoffs, ui
if (*sectoffs == 0xffff)
{
// last sector
osd_printf_error("CD: Don't know how to handle offset ffff\n");
LOGWARN("CD: Don't know how to handle offset ffff\n");
}
else if (*sectnum == 0xffff)
{
@ -2262,7 +2276,7 @@ void stvcd_device::read_new_dir(uint32_t fileno)
// easy to fix, but make sure we *need* to first
if (curroot.length > MAX_DIR_SIZE)
{
osd_printf_error("ERROR: root directory too big (%d)\n", curroot.length);
LOGWARN("ERROR: root directory too big (%d)\n", curroot.length);
}
// done with all that, read the root directory now
@ -2273,7 +2287,7 @@ void stvcd_device::read_new_dir(uint32_t fileno)
{
if (curdir[fileno].length > MAX_DIR_SIZE)
{
osd_printf_error("ERROR: new directory too big (%d)!\n", curdir[fileno].length);
LOGWARN("ERROR: new directory too big (%d)!\n", curdir[fileno].length);
}
make_dir_current(curdir[fileno].firstfad);
}
@ -2361,7 +2375,7 @@ void stvcd_device::make_dir_current(uint32_t fad)
curentry->name[i] = sect[nextent+33+i];
}
curentry->name[i] = '\0'; // terminate
//printf("%08x %08x %s %d/%d/%d\n",curentry->firstfad,curentry->length,curentry->name,curentry->year,curentry->month,curentry->day);
//LOGWARN("%08x %08x %s %d/%d/%d\n",curentry->firstfad,curentry->length,curentry->name,curentry->year,curentry->month,curentry->day);
nextent += sect[nextent];
curentry++;
@ -2494,7 +2508,7 @@ stvcd_device::partitionT *stvcd_device::cd_filterdata(filterT *flt, int trktype,
{
if ((cd_curfad < flt->fad) || (cd_curfad > (flt->fad + flt->range)))
{
printf("curfad reject %08x %08x %08x %08x\n",cd_curfad,fadstoplay,flt->fad,flt->fad+flt->range);
LOGWARN("curfad reject %08x %08x %08x %08x\n",cd_curfad,fadstoplay,flt->fad,flt->fad+flt->range);
match = 0;
//lastbuf = flt->condfalse;
//flt = &filters[lastbuf];
@ -2507,7 +2521,7 @@ stvcd_device::partitionT *stvcd_device::cd_filterdata(filterT *flt, int trktype,
{
if (curblock.fnum != flt->fid)
{
printf("fnum reject\n");
LOGWARN("fnum reject\n");
match = 0;
}
}
@ -2516,7 +2530,7 @@ stvcd_device::partitionT *stvcd_device::cd_filterdata(filterT *flt, int trktype,
{
if (curblock.chan != flt->chan)
{
printf("channel number reject\n");
LOGWARN("channel number reject\n");
match = 0;
}
}
@ -2525,7 +2539,7 @@ stvcd_device::partitionT *stvcd_device::cd_filterdata(filterT *flt, int trktype,
{
if((curblock.subm & flt->smmask) != flt->smval)
{
printf("sub mode reject\n");
LOGWARN("sub mode reject\n");
match = 0;
}
}
@ -2534,7 +2548,7 @@ stvcd_device::partitionT *stvcd_device::cd_filterdata(filterT *flt, int trktype,
{
if((curblock.cinf & flt->cimask) != flt->cival)
{
printf("coding information reject\n");
LOGWARN("coding information reject\n");
match = 0;
}
}
@ -2685,26 +2699,26 @@ void stvcd_device::cd_playdata()
if ((cd_stat & 0x0f00) == CD_STAT_SEEK)
{
int32_t fad_diff;
//printf("PRE %08x %08x %08x %d\n",cd_curfad,cd_fad_seek,cd_stat,cd_fad_seek - cd_curfad);
LOGSEEK("PRE %08x %08x %08x %d\n",cd_curfad,cd_fad_seek,cd_stat,cd_fad_seek - cd_curfad);
fad_diff = (cd_fad_seek - cd_curfad);
/* Zero Divide wants this TODO: timings. */
if(fad_diff > (750*cd_speed))
{
//printf("PRE FFWD %08x %08x %08x %d %d\n",cd_curfad,cd_fad_seek,cd_stat,cd_fad_seek - cd_curfad,750*cd_speed);
LOGSEEK("PRE FFWD %08x %08x %08x %d %d\n",cd_curfad,cd_fad_seek,cd_stat,cd_fad_seek - cd_curfad,750*cd_speed);
cd_curfad += (750*cd_speed);
//printf("POST FFWD %08x %08x %08x %d %d\n",cd_curfad,cd_fad_seek,cd_stat,cd_fad_seek - cd_curfad, 750*cd_speed);
LOGSEEK("POST FFWD %08x %08x %08x %d %d\n",cd_curfad,cd_fad_seek,cd_stat,cd_fad_seek - cd_curfad, 750*cd_speed);
}
else if(fad_diff < (-750*cd_speed))
{
//printf("PRE REW %08x %08x %08x %d %d\n",cd_curfad,cd_fad_seek,cd_stat,cd_fad_seek - cd_curfad, -750*cd_speed);
LOGSEEK("PRE REW %08x %08x %08x %d %d\n",cd_curfad,cd_fad_seek,cd_stat,cd_fad_seek - cd_curfad, -750*cd_speed);
cd_curfad -= (750*cd_speed);
//printf("POST REW %08x %08x %08x %d %d\n",cd_curfad,cd_fad_seek,cd_stat,cd_fad_seek - cd_curfad, -750*cd_speed);
LOGSEEK("POST REW %08x %08x %08x %d %d\n",cd_curfad,cd_fad_seek,cd_stat,cd_fad_seek - cd_curfad, -750*cd_speed);
}
else
{
//printf("Ready\n");
LOGSEEK("Ready\n");
cd_curfad = cd_fad_seek;
cd_stat = CD_STAT_PLAY;
}
@ -2712,11 +2726,14 @@ void stvcd_device::cd_playdata()
return;
}
if (LIVE_CD_VIEW)
popmessage("%04x %d %d", cd_stat, cd_curfad, fadstoplay);
if ((cd_stat & 0x0f00) == CD_STAT_PLAY)
{
if (fadstoplay)
{
logerror("STVCD: Reading FAD %d\n", cd_curfad);
LOGXFER("STVCD: Reading FAD %d\n", cd_curfad);
if (m_cdrom_image->exists())
{
@ -2729,7 +2746,9 @@ void stvcd_device::cd_playdata()
}
else
{
p_ok = 1; // TODO
// TODO: pinpoint cases when this isn't okay
// (out of bounds disc for example)
p_ok = 1;
m_cdda->start_audio(cd_curfad, 1);
}
@ -2787,6 +2806,7 @@ void stvcd_device::set_tray_open()
hirqreg |= DCHG;
cd_stat = CD_STAT_OPEN;
// TODO: unmount image
tray_is_closed = 0;
popmessage("Tray Open");