ti99: Some debug output improvements

This commit is contained in:
Michael Zapf 2023-06-08 17:46:20 +02:00
parent 5c5e7badca
commit e273507f1d
5 changed files with 37 additions and 27 deletions

View File

@ -69,6 +69,7 @@
#define LOG_MOTOR (1U << 8)
#define LOG_INT (1U << 9)
#define LOG_CRU (1U << 10)
#define LOG_SKCOM (1U << 11)
#define LOG_CONFIG (1U << 15) // Configuration
#define VERBOSE (LOG_GENERAL | LOG_CONFIG | LOG_WARN)
@ -546,7 +547,7 @@ void myarc_hfdc_device::harddisk_ready_callback(mfm_harddisk_device *harddisk, i
*/
void myarc_hfdc_device::harddisk_skcom_callback(mfm_harddisk_device *harddisk, int state)
{
LOGMASKED(LOG_LINES, "HD seek complete = %d\n", state);
LOGMASKED(LOG_SKCOM, "HD seek complete = %d\n", state);
set_bits(m_status_latch, hdc92x4_device::DS_SKCOM, (state==ASSERT_LINE));
signal_drive_status();
}

View File

@ -112,6 +112,8 @@
Thanks to Don O'Neil of WHT for providing the required schematics, ROM dumps,
and documentation
TODO: Enable block DMA. The only other driver using eop is lbpc.
*****************************************************************************/
#include "emu.h"
@ -260,12 +262,12 @@ void whtech_scsi_card_device::readz(offs_t offset, uint8_t *value)
if ((m_address & 0x0010)==0x0000)
{
int reg = (m_address >> 1)&0x07;
// If we are in DMA mode, reading from register 6 means DMA read
if ((m_controller->read(2) & 0x02) && (reg == 6))
if (m_controller->in_dma_mode() && (reg == 6))
{
LOGMASKED(LOG_DMA, "CTR: DMA in (%s)\n", machine().describe_context());
*value = m_controller->dma_r();
LOGMASKED(LOG_DMA, "CTR: DMA -> %02x\n", *value);
LOGMASKED(LOG_DMA, "CTR: DMA in [%d] -> %02x (%s)\n", m_dmacount++, *value, machine().describe_context());
}
else
{
@ -304,9 +306,9 @@ void whtech_scsi_card_device::write(offs_t offset, uint8_t data)
int reg = (m_address >> 1)&0x07;
// If we are in DMA mode, writing to register 0 means DMA write
if ((m_controller->read(2) & 0x02) && (reg == 0))
if (m_controller->in_dma_mode() && (reg == 0))
{
LOGMASKED(LOG_DMA, "CTR: DMA out <- %02x (%s)\n", data, machine().describe_context());
LOGMASKED(LOG_DMA, "CTR: DMA out <- %02x [%d] (%s)\n", data, m_dmacount++, machine().describe_context());
m_controller->dma_w(data);
}
else
@ -613,36 +615,37 @@ void whtscsi_pld_device::cruwrite(offs_t offset, uint8_t data)
int crubase = m_board->get_sw1();
if ((offset & 0xff00)==crubase)
{
LOGMASKED(LOG_CRU, "CRU %04x <- %d (%s)\n", offset & 0xffff, data, machine().describe_context());
// LOGMASKED(LOG_CRU, "CRU %04x <- %d (%s)\n", offset & 0xffff, data, machine().describe_context());
int bit = (offset >> 1) & 0x1f;
switch (bit)
{
case 0: // card activation
LOGMASKED(LOG_CRU, "DSR %s\n", (data!=0)? "on" : "off");
LOGMASKED(LOG_CRU, "DSR %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
m_selected = (data != 0);
break;
case 1: // SRAM shadow
LOGMASKED(LOG_CRU, "SRAM shadow %s\n", (data!=0)? "on" : "off");
LOGMASKED(LOG_CRU, "SRAM shadow %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
m_sram_shadow = (data != 0);
break;
case 2: // DMA lock enable
LOGMASKED(LOG_CRU, "DMA lock %s\n", (data!=0)? "on" : "off");
LOGMASKED(LOG_CRU, "DMA lock %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
m_dma_lock = (data != 0);
m_board->m_dmacount = 0;
break;
case 3: // SCSI EOP
LOGMASKED(LOG_CRU, "SCSI EOP %s\n", (data!=0)? "on" : "off");
LOGMASKED(LOG_CRU, "SCSI EOP %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
m_board->signal_scsi_eop((data != 0)? ASSERT_LINE : CLEAR_LINE);
break;
case 4:
LOGMASKED(LOG_CRU, "Word transfer %s\n", (data!=0)? "on" : "off");
LOGMASKED(LOG_CRU, "Word transfer %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
m_word_transfer = (data != 0);
break;
case 5:
LOGMASKED(LOG_CRU, "Bank swap %s\n", (data!=0)? "on" : "off");
LOGMASKED(LOG_CRU, "Bank swap %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
m_bank_swapped = (data != 0);
break;
case 6:
LOGMASKED(LOG_CRU, "Block mode %s (not implemented)\n", (data!=0)? "on" : "off");
LOGMASKED(LOG_CRU, "Block mode %s (not implemented) (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
break;
case 8:
case 9:
@ -651,6 +654,7 @@ void whtscsi_pld_device::cruwrite(offs_t offset, uint8_t data)
m_eprom_bank = m_eprom_bank | (1<<(bit-8));
else
m_eprom_bank = m_eprom_bank & ~(1<<(bit-8));
LOGMASKED(LOG_CRU, "Set EPROM bank %d (%s)\n", m_eprom_bank, machine().describe_context());
break;
case 12:
case 13:
@ -659,6 +663,7 @@ void whtscsi_pld_device::cruwrite(offs_t offset, uint8_t data)
m_sram_bank = m_sram_bank | (1<<(bit-12));
else
m_sram_bank = m_sram_bank & ~(1<<(bit-12));
LOGMASKED(LOG_CRU, "Set SRAM bank %d (%s)\n", m_sram_bank, machine().describe_context());
break;
default:
break;

View File

@ -69,6 +69,9 @@ private:
// Settings
int m_sw2;
// Debugging
int m_dmacount;
// Latches for the lines
// Should be removed and accessor functions be added to ncr5380
bool m_irq;

View File

@ -655,7 +655,7 @@ TIMER_CALLBACK_MEMBER(mfm_harddisk_device::seek_update)
// Start the settle timer
m_step_phase = STEP_SETTLE;
m_seek_timer->adjust(m_settle_time);
LOGMASKED(LOG_STEPSDETAIL, "Arrived at target cylinder %d, settling ...\n", m_current_cylinder);
LOGMASKED(LOG_STEPSDETAIL, "Arrived at target cylinder %d, settling ...[%s]\n", m_current_cylinder, machine().time().to_string());
}
else
{
@ -678,7 +678,7 @@ TIMER_CALLBACK_MEMBER(mfm_harddisk_device::seek_update)
}
else
{
LOGMASKED(LOG_SIGNALS, "Settling done at cylinder %d, seek complete\n", m_current_cylinder);
LOGMASKED(LOG_STEPSDETAIL, "Settling done at cylinder %d, seek complete [%s]\n", m_current_cylinder, machine().time().to_string());
}
m_seek_complete = true;
if (!m_seek_complete_cb.isnull()) m_seek_complete_cb(this, ASSERT_LINE);
@ -703,7 +703,8 @@ void mfm_harddisk_device::head_move()
m_step_phase = STEP_MOVING;
m_seek_timer->adjust(m_step_time * steps);
LOGMASKED(LOG_TIMING, "Head movement takes %s time\n", (m_step_time * steps).to_string());
long moveus = (m_step_time.attoseconds() * steps) / ATTOSECONDS_PER_MICROSECOND;
LOGMASKED(LOG_STEPSDETAIL, "Head movement takes %.1f ms time [%s]\n", moveus/1000., machine().time().to_string());
// We pretend that we already arrived
// TODO: Check auto truncation?
m_current_cylinder += m_track_delta;
@ -714,8 +715,8 @@ void mfm_harddisk_device::head_move()
void mfm_harddisk_device::direction_in_w(line_state line)
{
if (m_seek_inward != (line == ASSERT_LINE)) LOGMASKED(LOG_STEPSDETAIL, "Setting seek direction %s\n", m_seek_inward? "inward" : "outward");
m_seek_inward = (line == ASSERT_LINE);
LOGMASKED(LOG_STEPSDETAIL, "Setting seek direction %s\n", m_seek_inward? "inward" : "outward");
}
/*

View File

@ -809,7 +809,7 @@ void hdc92x4_device::wait_line(int line, line_state level, int substate, bool st
if (line == SEEKCOMP_LINE && (seek_complete() == (level==ASSERT_LINE)))
{
LOGMASKED(LOG_LINES, "SEEK_COMPLETE line is already %d\n", level);
LOGMASKED(LOG_STEP, "SEEK_COMPLETE line is already %d\n", level);
}
else
{
@ -930,7 +930,7 @@ void hdc92x4_device::read_id(int& cont, bool implied_seek, bool wait_seek_comple
if (wait_seek_complete)
{
// We have to wait for SEEK COMPLETE
LOGMASKED(LOG_SUBSTATES, "Waiting for SEEK COMPLETE\n");
LOGMASKED(LOG_STEP, "Waiting for SEEK COMPLETE\n");
wait_line(SEEKCOMP_LINE, ASSERT_LINE, READ_ID_SEEK_COMPLETE, false);
cont = WAIT;
}
@ -943,7 +943,7 @@ void hdc92x4_device::read_id(int& cont, bool implied_seek, bool wait_seek_comple
break;
}
LOGMASKED(LOG_SUBSTATES, "substate STEP_ON\n");
LOGMASKED(LOG_STEP, "substate STEP_ON\n");
// STEPDIR = 0 -> towards TRK00
set_bits(m_output2, OUT2_STEPDIR, (m_track_delta>0));
set_bits(m_output2, OUT2_STEPPULSE, true);
@ -952,7 +952,7 @@ void hdc92x4_device::read_id(int& cont, bool implied_seek, bool wait_seek_comple
break;
case READ_ID_STEPOFF:
LOGMASKED(LOG_SUBSTATES, "substate STEP_OFF\n");
LOGMASKED(LOG_STEP, "substate STEP_OFF\n");
set_bits(m_output2, OUT2_STEPPULSE, false);
m_track_delta += (m_track_delta<0)? 1 : -1;
// Return to STEP_ON, check whether there are more steps
@ -1404,7 +1404,7 @@ void hdc92x4_device::restore_drive()
if (m_substate == UNDEF)
{
LOGMASKED(LOG_COMMAND, "RESTORE command %02x\n", current_command());
LOGMASKED(LOG_RESTORE, "RESTORE command %02x\n", current_command());
m_seek_count = 0;
m_substate = RESTORE_CHECK;
}
@ -1447,7 +1447,7 @@ void hdc92x4_device::restore_drive()
break;
case STEP_ON:
LOGMASKED(LOG_SUBSTATES, "[%s] substate STEP_ON\n", ttsn());
LOGMASKED(LOG_RESTORE, "[%s] substate STEP_ON\n", ttsn());
// Increase step count
m_seek_count++;
@ -1462,7 +1462,7 @@ void hdc92x4_device::restore_drive()
break;
case STEP_OFF:
LOGMASKED(LOG_SUBSTATES, "[%s] substate STEP_OFF\n", ttsn());
LOGMASKED(LOG_RESTORE, "[%s] substate STEP_OFF\n", ttsn());
set_bits(m_output2, OUT2_STEPPULSE, false);
wait_time(m_timer, step_time(), RESTORE_CHECK);
cont = WAIT;
@ -1834,7 +1834,7 @@ void hdc92x4_device::read_sectors()
{
// Command init
m_logical = (current_command() & 0x04)!=0; // used in VERIFY and DATA TRANSFER substate
LOGMASKED(LOG_COMMAND, "READ SECTORS %s command %02x, CHS=(%d,%d,%d)\n", m_logical? "LOGICAL": "PHYSICAL", current_command(), desired_cylinder(), desired_head(), desired_sector());
LOGMASKED(LOG_READ, "[%s] READ SECTORS %s command %02x, CHS=(%d,%d,%d)\n", ttsn(), m_logical? "LOGICAL": "PHYSICAL", current_command(), desired_cylinder(), desired_head(), desired_sector());
m_bypass = !m_is_hdc9234 && (current_command() & 0x02)!=0;
m_transfer_enabled = (current_command() & 0x01)!=0;
@ -4610,7 +4610,7 @@ void hdc92x4_device::ready_handler()
void hdc92x4_device::seek_complete_handler()
{
int level = seek_complete()? ASSERT_LINE : CLEAR_LINE;
LOGMASKED(LOG_LINES, "[%s] Seek complete handler; level=%d\n", ttsn(), level);
LOGMASKED(LOG_STEP, "[%s] Seek complete handler; level=%d\n", ttsn(), level);
// Some commands may wait for SEEK_COMPLETE regardless of the step rate
if (waiting_for_line(SEEKCOMP_LINE, level))