machine/ncr53c90.cpp: Fix NCR53CF94 ID read sequence

This commit is contained in:
AJR 2025-01-06 23:07:44 -05:00
parent 2a9cfda080
commit fd93123881
2 changed files with 22 additions and 9 deletions

View File

@ -918,6 +918,15 @@ void ncr53c90_device::command_pop_and_chain()
}
}
void ncr53c90_device::load_tcounter()
{
LOGMASKED(LOG_COMMAND, "DMA command: tcounter reloaded to %d\n", tcount & tcounter_mask);
tcounter = tcount & tcounter_mask;
// clear transfer count zero flag when counter is reloaded
status &= ~S_TC0;
}
void ncr53c90_device::start_command()
{
uint8_t c = command[0] & 0x7f;
@ -932,11 +941,7 @@ void ncr53c90_device::start_command()
dma_command = command[0] & 0x80;
if (dma_command)
{
LOGMASKED(LOG_COMMAND, "DMA command: tcounter reloaded to %d\n", tcount);
tcounter = tcount;
// clear transfer count zero flag when counter is reloaded
status &= ~S_TC0;
load_tcounter();
}
else
{
@ -1417,6 +1422,15 @@ void ncr53cf94_device::device_reset()
ncr53c94_device::device_reset();
}
void ncr53cf94_device::load_tcounter()
{
ncr53c94_device::load_tcounter();
// ID may be read by executing DMA NOP command twice, first with the features bit clear and then with it set
if ((config2 & S2FE) == 0)
tcount = (1 << 23) | (family_id << 19) | (revision_level << 16) | (tcount & 0xffff);
}
void ncr53cf94_device::conf2_w(uint8_t data)
{
tcounter_mask = (data & S2FE) ? 0xffffff : 0xffff;
@ -1425,10 +1439,6 @@ void ncr53cf94_device::conf2_w(uint8_t data)
uint8_t ncr53cf94_device::tcounter_hi2_r()
{
// tcounter is 24-bit when the features bit is set, otherwise it returns the ID
if ((config2 & S2FE) == 0)
return (1 << 7) | (family_id << 3) | revision_level;
LOG("tcounter_hi2_r %02x (%s)\n", (tcounter >> 16) & 0xff, machine().describe_context());
return tcounter >> 16;
}

View File

@ -232,6 +232,7 @@ protected:
void delay_cycles(int cycles);
void decrement_tcounter(int count = 1);
virtual void load_tcounter();
devcb_write_line m_irq_handler;
devcb_write_line m_drq_handler;
@ -361,6 +362,8 @@ protected:
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;
virtual void load_tcounter() override;
private:
u8 config4;
u8 family_id;