Apollo changes: [Hans Ostermeyer]

- Unified logging format in associated devices
- Use correct raw video modes
This commit is contained in:
arbee 2016-02-20 15:25:45 -05:00
parent 2041d88978
commit f8028a33c1
7 changed files with 108 additions and 56 deletions

View File

@ -26,8 +26,6 @@ static int verbose = VERBOSE;
#define LOG1(d,x) { if (verbose > 0) LOG(d,x)}
#define LOG2(d,x) { if (verbose > 1) LOG(d,x)}
#define MAINCPU "maincpu"
#ifdef LSB_FIRST
static UINT16 uint16_to_le(UINT16 value)
{
@ -424,7 +422,7 @@ const char *threecom3c505_device::cpu_context()
{
static char statebuf[64]; /* string buffer containing state description */
device_t *cpu = machine().device(MAINCPU);
device_t *cpu = machine().firstcpu;
osd_ticks_t t = osd_ticks();
int s = t / osd_ticks_per_second();
int ms = (t % osd_ticks_per_second()) / 1000;
@ -442,6 +440,18 @@ const char *threecom3c505_device::cpu_context()
return statebuf;
}
/*-------------------------------------------------
logerror - log an error message (w/o device tags)
-------------------------------------------------*/
void threecom3c505_device::logerror(const char *format, ...) const
{
va_list arg;
va_start(arg, format);
machine().vlogerror(format, arg);
va_end(arg);
}
//**************************************************************************
// data_buffer
//**************************************************************************
@ -855,8 +865,8 @@ void threecom3c505_device::do_receive_command()
void threecom3c505_device::set_command_pending(int state)
{
LOG2(this,("set_command_pending %d -> %d m_wait_for_ack=%d m_wait_for_nak=%d m_rx_pending=%d%s",
m_command_pending, state, m_wait_for_ack, m_wait_for_nak, m_rx_pending, state ? "" :"\n"));
LOG2(this,("set_command_pending %d -> %d m_wait_for_ack=%d m_wait_for_nak=%d m_rx_pending=%d",
m_command_pending, state, m_wait_for_ack, m_wait_for_nak, m_rx_pending));
//- verbose = onoff ? 1 : 2;
@ -1657,7 +1667,7 @@ void threecom3c505_device::set_verbose(int on_off)
int threecom3c505_device::tx_data(device_t *device, const UINT8 data[], int length)
{
LOG1(device,("threecom3c505_device::tx_data length=%d", length));
LOG1(this,("threecom3c505_device::tx_data length=%d", length));
return 1;
}

View File

@ -143,6 +143,7 @@ protected:
virtual int setfilter(device_t *, int);
const char *cpu_context();
void logerror(const char *format, ...) const;
// device-level overrides
virtual void device_start() override;

View File

@ -73,6 +73,10 @@ protected:
virtual void device_reset() override;
void omti_disk_config(UINT16 disk_type);
private:
void logerror(const char *format, ...) const;
public:
UINT16 m_type;
UINT16 m_cylinders;
@ -685,6 +689,18 @@ void omti8621_device::set_esdi_defect_list(UINT8 lun, UINT8 head)
memset(disk->m_esdi_defect_list+6, 0xff, 5); // end of defect list
}
/*-------------------------------------------------
logerror - log an error message (w/o device tags)
-------------------------------------------------*/
void omti8621_device::logerror(const char *format, ...) const
{
va_list arg;
va_start(arg, format);
machine().vlogerror(format, arg);
va_end(arg);
}
/***************************************************************************
log_command - log command from a command descriptor block
***************************************************************************/
@ -693,83 +709,80 @@ void omti8621_device::log_command(const UINT8 cdb[], const UINT16 cdb_length)
{
if (verbose > 0) {
int i;
char sb[100];
std::string text(cpu_context(this));
text += ": OMTI command ";
logerror("%s: OMTI command ", cpu_context(this));
switch (cdb[0]) {
case OMTI_CMD_TEST_DRIVE_READY: // 0x00
text += "Test Drive Ready";
logerror("Test Drive Ready");
break;
case OMTI_CMD_RECALIBRATE: // 0x01
text += "Recalibrate";
logerror("Recalibrate");
break;
case OMTI_CMD_REQUEST_SENSE: // 0x03
text += "Request Sense";
logerror("Request Sense");
break;
case OMTI_CMD_READ_VERIFY: // 0x05
text += "Read Verify";
logerror("Read Verify");
break;
case OMTI_CMD_FORMAT_TRACK: // 0x06
text += "Format Track";
logerror("Format Track");
break;
case OMTI_CMD_FORMAT_BAD_TRACK: // 0x07
text += "Format Bad Track";
logerror("Format Bad Track");
break;
case OMTI_CMD_READ: // 0x08
text += "Read";
logerror("Read");
break;
case OMTI_CMD_WRITE: // 0x0A
text += "Write";
logerror("Write");
break;
case OMTI_CMD_SEEK: // 0x0B
text += "Seek";
logerror("Seek");
break;
case OMTI_CMD_READ_SECTOR_BUFFER: // 0x0E
text += "Read Sector Buffer";
logerror("Read Sector Buffer");
break;
case OMTI_CMD_WRITE_SECTOR_BUFFER: // 0x0F
text += "Write Sector Buffer";
logerror("Write Sector Buffer");
break;
case OMTI_CMD_ASSIGN_ALTERNATE_TRACK: // 0x11
text += "Assign Alternate Track";
logerror("Assign Alternate Track");
break;
case OMTI_CMD_READ_DATA_TO_BUFFER: // 0x1E
text += "Read Data to Buffer";
logerror("Read Data to Buffer");
break;
case OMTI_CMD_WRITE_DATA_FROM_BUFFER: // 0x1F
text += "Write Data from Buffer";
logerror("Write Data from Buffer");
break;
case OMTI_CMD_COPY: // 0x20
text += "Copy";
logerror("Copy");
break;
case OMTI_CMD_READ_ESDI_DEFECT_LIST: // 0x37
text += "Read ESDI Defect List";
logerror("Read ESDI Defect List");
break;
case OMTI_CMD_RAM_DIAGNOSTICS: // 0xE0
text += "RAM. Diagnostic";
logerror("RAM. Diagnostic");
break;
case OMTI_CMD_CONTROLLER_INT_DIAGNOSTIC: // 0xE4
text += "Controller Int. Diagnostic";
logerror("Controller Int. Diagnostic");
break;
case OMTI_CMD_READ_LONG: // 0xE5
text += "Read Long";
logerror("Read Long");
break;
case OMTI_CMD_WRITE_LONG: // 0xE6
text += "Write Long";
logerror("Write Long");
break;
case OMTI_CMD_READ_CONFIGURATION: // 0xEC
text += "Read Configuration";
logerror("Read Configuration");
break;
case OMTI_CMD_INVALID_COMMAND: // 0xFF
text += "Invalid Command";
logerror("Invalid Command");
break;
default:
text += "!!! Unexpected Command !!!";
logerror("!!! Unexpected Command !!!");
}
// logerror(" (%02x, length=%02x)", cdb[0], cdb_length);
for (i = 0; i < cdb_length; i++) {
sprintf(sb, " %02x", cdb[i]);
text += sb;
logerror(" %02x", cdb[i]);
}
switch (cdb[0]) {
@ -780,12 +793,10 @@ void omti8621_device::log_command(const UINT8 cdb[], const UINT16 cdb_length)
case OMTI_CMD_READ_DATA_TO_BUFFER: // 0x1E
case OMTI_CMD_WRITE_DATA_FROM_BUFFER: // 0x1F
case OMTI_CMD_COPY: // 0x20
sprintf(sb, " (diskaddr=%x count=%x)", get_disk_address(cdb), cdb[4]);
text += sb;
logerror(" (diskaddr=%x count=%x)", get_disk_address(cdb), cdb[4]);
break;
}
text += "\n";
logerror(text.c_str());
logerror("\n");
}
}
@ -795,25 +806,18 @@ void omti8621_device::log_command(const UINT8 cdb[], const UINT16 cdb_length)
void omti8621_device::log_data()
{
if (verbose > 0)
{
if (verbose > 0) {
int i;
char sb[100];
sprintf(sb, "%s: OMTI data (length=%02x)", cpu_context(this),
logerror("%s: OMTI data (length=%02x)", cpu_context(this),
data_length);
std::string text(sb);
for (i = 0; i < data_length && i < OMTI_DISK_SECTOR_SIZE; i++)
{
sprintf(sb, " %02x", data_buffer[i]);
text += sb;
for (i = 0; i < data_length && i < OMTI_DISK_SECTOR_SIZE; i++) {
logerror(" %02x", data_buffer[i]);
}
if (i < data_length)
{
text += " ...";
if (i < data_length) {
logerror(" ...");
}
text += "\n";
logerror(text.c_str());
logerror("\n");
}
}
@ -1350,6 +1354,18 @@ void omti_disk_image_device::omti_disk_config(UINT16 disk_type)
m_sector_count = m_cylinders * m_heads * m_sectors;
}
/*-------------------------------------------------
logerror - log an error message (w/o device tags)
-------------------------------------------------*/
void omti_disk_image_device::logerror(const char *format, ...) const
{
va_list arg;
va_start(arg, format);
machine().vlogerror(format, arg);
va_end(arg);
}
/*-------------------------------------------------
device start callback
-------------------------------------------------*/

View File

@ -114,6 +114,9 @@ private:
void copy_sectors(INT32 dst_addr, INT32 src_addr, UINT8 count, UINT8 lun);
void format_track(const UINT8 * cdb);
void set_esdi_defect_list(UINT8 lun, UINT8 head);
void logerror(const char *format, ...) const;
void log_command(const UINT8 cdb[], const UINT16 cdb_length);
void log_data();
void do_command(const UINT8 cdb[], const UINT16 cdb_length);

View File

@ -409,15 +409,36 @@ const char *sc499_device::cpu_context()
{
static char statebuf[64]; /* string buffer containing state description */
device_t *cpu = machine().firstcpu;
osd_ticks_t t = osd_ticks();
int s = t / osd_ticks_per_second();
int ms = (t % osd_ticks_per_second()) / 1000;
sprintf(statebuf, "%d.%03d%s:", s, ms, tag());
/* if we have an executing CPU, output data */
if (cpu != nullptr)
{
sprintf(statebuf, "%d.%03d %s pc=%08x - %s", s, ms, cpu->tag(),
cpu->safe_pcbase(), tag());
}
else
{
sprintf(statebuf, "%d.%03d", s, ms);
}
return statebuf;
}
/*-------------------------------------------------
logerror - log an error message (w/o device tags)
-------------------------------------------------*/
void sc499_device::logerror(const char *format, ...) const
{
va_list arg;
va_start(arg, format);
machine().vlogerror(format, arg);
va_end(arg);
}
/*-------------------------------------------------
tape_status_clear - clear bits in tape status
-------------------------------------------------*/

View File

@ -80,6 +80,7 @@ private:
virtual void eop_w(int state) override;
const char *cpu_context();
void logerror(const char *format, ...) const;
void tape_status_clear(UINT16 value);
void tape_status_set(UINT16 value);

View File

@ -1711,7 +1711,7 @@ MACHINE_CONFIG_FRAGMENT( apollo_graphics )
MCFG_SCREEN_ADD(VIDEO_SCREEN_TAG, RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
MCFG_SCREEN_REFRESH_RATE(76)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(657))
MCFG_SCREEN_RAW_PARAMS(68000000, 1343, 0, 1024, 841, 0, 800)
MCFG_SCREEN_SIZE(1024, 800)
MCFG_SCREEN_VISIBLE_AREA(0, 1023, 0, 799)
MCFG_SCREEN_UPDATE_DEVICE(APOLLO_SCREEN_TAG, apollo_graphics_15i, screen_update)
@ -1895,7 +1895,7 @@ MACHINE_CONFIG_FRAGMENT( apollo_mono19i )
MCFG_SCREEN_ADD(VIDEO_SCREEN_TAG, RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
MCFG_SCREEN_REFRESH_RATE(64)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(616))
MCFG_SCREEN_RAW_PARAMS(120000000, 1728, 0, 1280, 1066, 0, 1024)
MCFG_SCREEN_SIZE(1280, 1024)
MCFG_SCREEN_VISIBLE_AREA(0, 1279, 0, 1023)
MCFG_SCREEN_UPDATE_DEVICE(APOLLO_SCREEN_TAG, apollo_graphics_19i, screen_update)