summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/i86/i186.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/i86/i186.cpp')
-rw-r--r--src/devices/cpu/i86/i186.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/devices/cpu/i86/i186.cpp b/src/devices/cpu/i86/i186.cpp
index 7f64274ce6e..ac6ce5e6788 100644
--- a/src/devices/cpu/i86/i186.cpp
+++ b/src/devices/cpu/i86/i186.cpp
@@ -242,6 +242,7 @@ void i80186_cpu_device::execute_run()
if (m_halt)
{
+ debugger_wait_hook();
m_icount = 0;
return;
}
@@ -845,7 +846,7 @@ void i80186_cpu_device::write_port_word(uint16_t port, uint16_t data)
uint8_t i80186_cpu_device::read_byte(uint32_t addr)
{
- if ((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
+ if ((m_reloc & 0x1000) && ((addr >> 8) & 0xfff) == (m_reloc & 0xfff))
{
uint16_t ret = internal_port_r((addr >> 1) & 0x7f, (addr & 1) ? 0xff00 : 0x00ff);
return (addr & 1) ? (ret >> 8) : (ret & 0xff);
@@ -855,7 +856,7 @@ uint8_t i80186_cpu_device::read_byte(uint32_t addr)
uint16_t i80186_cpu_device::read_word(uint32_t addr)
{
- if ((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
+ if ((m_reloc & 0x1000) && ((addr >> 8) & 0xfff) == (m_reloc & 0xfff))
{
// Unaligned reads from the internal bus are swapped rather than split
if (addr & 1)
@@ -868,7 +869,7 @@ uint16_t i80186_cpu_device::read_word(uint32_t addr)
void i80186_cpu_device::write_byte(uint32_t addr, uint8_t data)
{
- if ((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
+ if ((m_reloc & 0x1000) && ((addr >> 8) & 0xfff) == (m_reloc & 0xfff))
internal_port_w((addr >> 1) & 0x7f, (addr & 1) ? (data << 8) : data);
else
m_program->write_byte(addr, data);
@@ -876,7 +877,7 @@ void i80186_cpu_device::write_byte(uint32_t addr, uint8_t data)
void i80186_cpu_device::write_word(uint32_t addr, uint16_t data)
{
- if ((m_reloc & 0x1000) && (addr >> 8) == (m_reloc & 0xfff))
+ if ((m_reloc & 0x1000) && ((addr >> 8) & 0xfff) == (m_reloc & 0xfff))
{
// Unaligned writes from the internal bus are swapped rather than split
if (addr & 1)
@@ -1243,7 +1244,7 @@ TIMER_CALLBACK_MEMBER(i80186_cpu_device::timer_elapsed)
int which = param;
timer_state *t = &m_timer[which];
- LOGMASKED(LOG_TIMER, "Hit interrupt callback for timer %d", which);
+ LOGMASKED(LOG_TIMER, "Hit interrupt callback for timer %d\n", which);
/* set the max count bit */
t->control |= 0x0020;
@@ -1253,14 +1254,14 @@ TIMER_CALLBACK_MEMBER(i80186_cpu_device::timer_elapsed)
{
m_intr.status |= 0x01 << which;
update_interrupt_state();
- LOGMASKED(LOG_TIMER, " Generating timer interrupt");
+ LOGMASKED(LOG_TIMER, " Generating timer interrupt\n");
}
if (which == 2)
{
- if ((m_dma[0].control & (TIMER_DRQ | ST_STOP)) == TIMER_DRQ)
+ if ((m_dma[0].control & (TIMER_DRQ | ST_STOP)) == (TIMER_DRQ | ST_STOP))
drq_callback(0);
- if ((m_dma[1].control & (TIMER_DRQ | ST_STOP)) == TIMER_DRQ)
+ if ((m_dma[1].control & (TIMER_DRQ | ST_STOP)) == (TIMER_DRQ | ST_STOP))
drq_callback(1);
if ((m_timer[0].control & 0x800c) == 0x8008)
inc_timer(0);
@@ -1294,7 +1295,7 @@ TIMER_CALLBACK_MEMBER(i80186_cpu_device::timer_elapsed)
t->control &= ~0x1000;
restart_timer(which);
- LOGMASKED(LOG_TIMER, " Repriming interrupt");
+ LOGMASKED(LOG_TIMER, " Repriming interrupt\n");
}
else
{
@@ -1308,9 +1309,13 @@ TIMER_CALLBACK_MEMBER(i80186_cpu_device::timer_elapsed)
void i80186_cpu_device::restart_timer(int which)
{
timer_state *t = &m_timer[which];
+ /* Only run timer 0,1 when not incremented via timer 2 pre-scaler */
+ if (which != 2 && (t->control & 0x800c) == 0x8008)
+ return;
+
int count = (t->control & 0x1000) ? t->maxB : t->maxA;
if (!(t->control & 4))
- t->int_timer->adjust((attotime::from_hz(clock() / 8) * (count ? count : 0x10000)), which);
+ t->int_timer->adjust(cycles_to_attotime(4 * (count ? count : 0x10000)), which);
}
void i80186_cpu_device::internal_timer_sync(int which)
@@ -1319,7 +1324,7 @@ void i80186_cpu_device::internal_timer_sync(int which)
/* if we have a timing timer running, adjust the count */
if ((t->control & 0x8000) && !(t->control & 0x0c) && t->int_timer->enabled())
- t->count = ((t->control & 0x1000) ? t->maxB : t->maxA) - t->int_timer->remaining().as_ticks(clock() / 8);
+ t->count = ((t->control & 0x1000) ? t->maxB : t->maxA) - attotime_to_cycles(t->int_timer->remaining()) / 4;
}
void i80186_cpu_device::inc_timer(int which)
@@ -1341,7 +1346,7 @@ void i80186_cpu_device::internal_timer_update(int which, int new_count, int new_
timer_state *t = &m_timer[which];
bool update_int_timer = false;
- LOGMASKED(LOG_TIMER, "internal_timer_update: %d, new_count=%d, new_maxA=%d, new_maxB=%d, new_control=%d", which, new_count, new_maxA, new_maxB, new_control);
+ LOGMASKED(LOG_TIMER, "internal_timer_update: %d, new_count=%d, new_maxA=%d, new_maxB=%d, new_control=%d\n", which, new_count, new_maxA, new_maxB, new_control);
/* if we have a new count and we're on, update things */
if (new_count != -1)
@@ -1443,7 +1448,7 @@ void i80186_cpu_device::internal_timer_update(int which, int new_count, int new_
int diff = ((t->control & 0x1000) ? t->maxB : t->maxA) - t->count;
if (diff <= 0)
diff += 0x10000;
- t->int_timer->adjust(attotime::from_hz(clock()/8) * diff, which);
+ t->int_timer->adjust(cycles_to_attotime(4 * diff), which);
LOGMASKED(LOG_TIMER, "Set interrupt timer for %d\n", which);
}
else
@@ -1486,11 +1491,6 @@ void i80186_cpu_device::update_dma_control(int which, int new_control)
new_control = (new_control & ~ST_STOP) | (d->control & ST_STOP);
new_control &= ~CHG_NOCHG;
- /* check for control bits we don't handle */
- int diff = new_control ^ d->control;
- if (diff & 0x6811)
- LOGMASKED(LOG_DMA, "%05X:ERROR! - unsupported DMA mode %04X\n", m_pc, new_control);
-
LOGMASKED(LOG_DMA, "Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest);
/* set the new control register */