summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine/tmp68301.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/machine/tmp68301.c')
-rw-r--r--src/emu/machine/tmp68301.c59
1 files changed, 29 insertions, 30 deletions
diff --git a/src/emu/machine/tmp68301.c b/src/emu/machine/tmp68301.c
index f46175844e6..8f87ebe15f8 100644
--- a/src/emu/machine/tmp68301.c
+++ b/src/emu/machine/tmp68301.c
@@ -13,8 +13,8 @@
static UINT16 tmp68301_regs[0x400];
-static UINT8 tmp68301_IE[3]; // 3 External Interrupt Lines
-static emu_timer *tmp68301_timer[3]; // 3 Timers
+static UINT8 tmp68301_IE[3]; // 3 External Interrupt Lines
+static emu_timer *tmp68301_timer[3]; // 3 Timers
static int tmp68301_irq_vector[8];
@@ -30,27 +30,27 @@ static IRQ_CALLBACK(tmp68301_irq_callback)
static TIMER_CALLBACK( tmp68301_timer_callback )
{
int i = param;
- UINT16 TCR = tmp68301_regs[(0x200 + i * 0x20)/2];
- UINT16 IMR = tmp68301_regs[0x94/2]; // Interrupt Mask Register (IMR)
- UINT16 ICR = tmp68301_regs[0x8e/2+i]; // Interrupt Controller Register (ICR7..9)
- UINT16 IVNR = tmp68301_regs[0x9a/2]; // Interrupt Vector Number Register (IVNR)
+ UINT16 TCR = tmp68301_regs[(0x200 + i * 0x20)/2];
+ UINT16 IMR = tmp68301_regs[0x94/2]; // Interrupt Mask Register (IMR)
+ UINT16 ICR = tmp68301_regs[0x8e/2+i]; // Interrupt Controller Register (ICR7..9)
+ UINT16 IVNR = tmp68301_regs[0x9a/2]; // Interrupt Vector Number Register (IVNR)
// logerror("s: callback timer %04X, j = %d\n",machine.describe_context(),i,tcount);
- if ( (TCR & 0x0004) && // INT
+ if ( (TCR & 0x0004) && // INT
!(IMR & (0x100<<i))
)
{
int level = ICR & 0x0007;
// Interrupt Vector Number Register (IVNR)
- tmp68301_irq_vector[level] = IVNR & 0x00e0;
- tmp68301_irq_vector[level] += 4+i;
+ tmp68301_irq_vector[level] = IVNR & 0x00e0;
+ tmp68301_irq_vector[level] += 4+i;
machine.firstcpu->set_input_line(level,HOLD_LINE);
}
- if (TCR & 0x0080) // N/1
+ if (TCR & 0x0080) // N/1
{
// Repeat
tmp68301_update_timer(machine, i);
@@ -63,9 +63,9 @@ static TIMER_CALLBACK( tmp68301_timer_callback )
static void tmp68301_update_timer( running_machine &machine, int i )
{
- UINT16 TCR = tmp68301_regs[(0x200 + i * 0x20)/2];
- UINT16 MAX1 = tmp68301_regs[(0x204 + i * 0x20)/2];
- UINT16 MAX2 = tmp68301_regs[(0x206 + i * 0x20)/2];
+ UINT16 TCR = tmp68301_regs[(0x200 + i * 0x20)/2];
+ UINT16 MAX1 = tmp68301_regs[(0x204 + i * 0x20)/2];
+ UINT16 MAX2 = tmp68301_regs[(0x206 + i * 0x20)/2];
int max = 0;
attotime duration = attotime::zero;
@@ -73,7 +73,7 @@ static void tmp68301_update_timer( running_machine &machine, int i )
tmp68301_timer[i]->adjust(attotime::never,i);
// timers 1&2 only
- switch( (TCR & 0x0030)>>4 ) // MR2..1
+ switch( (TCR & 0x0030)>>4 ) // MR2..1
{
case 1:
max = MAX1;
@@ -83,12 +83,12 @@ static void tmp68301_update_timer( running_machine &machine, int i )
break;
}
- switch ( (TCR & 0xc000)>>14 ) // CK2..1
+ switch ( (TCR & 0xc000)>>14 ) // CK2..1
{
- case 0: // System clock (CLK)
+ case 0: // System clock (CLK)
if (max)
{
- int scale = (TCR & 0x3c00)>>10; // P4..1
+ int scale = (TCR & 0x3c00)>>10; // P4..1
if (scale > 8) scale = 8;
duration = attotime::from_hz(machine.firstcpu->unscaled_clock()) * ((1 << scale) * max);
}
@@ -97,7 +97,7 @@ static void tmp68301_update_timer( running_machine &machine, int i )
// logerror("%s: TMP68301 Timer %d, duration %lf, max %04X\n",machine.describe_context(),i,duration,max);
- if (!(TCR & 0x0002)) // CS
+ if (!(TCR & 0x0002)) // CS
{
if (duration != attotime::zero)
tmp68301_timer[i]->adjust(duration,i);
@@ -130,25 +130,25 @@ static void update_irq_state(running_machine &machine)
/* Take care of external interrupts */
- UINT16 IMR = tmp68301_regs[0x94/2]; // Interrupt Mask Register (IMR)
- UINT16 IVNR = tmp68301_regs[0x9a/2]; // Interrupt Vector Number Register (IVNR)
+ UINT16 IMR = tmp68301_regs[0x94/2]; // Interrupt Mask Register (IMR)
+ UINT16 IVNR = tmp68301_regs[0x9a/2]; // Interrupt Vector Number Register (IVNR)
for (i = 0; i < 3; i++)
{
- if ( (tmp68301_IE[i]) &&
+ if ( (tmp68301_IE[i]) &&
!(IMR & (1<<i))
)
{
- UINT16 ICR = tmp68301_regs[0x80/2+i]; // Interrupt Controller Register (ICR0..2)
+ UINT16 ICR = tmp68301_regs[0x80/2+i]; // Interrupt Controller Register (ICR0..2)
// Interrupt Controller Register (ICR0..2)
int level = ICR & 0x0007;
// Interrupt Vector Number Register (IVNR)
- tmp68301_irq_vector[level] = IVNR & 0x00e0;
- tmp68301_irq_vector[level] += i;
+ tmp68301_irq_vector[level] = IVNR & 0x00e0;
+ tmp68301_irq_vector[level] += i;
- tmp68301_IE[i] = 0; // Interrupts are edge triggerred
+ tmp68301_IE[i] = 0; // Interrupts are edge triggerred
machine.firstcpu->set_input_line(level,HOLD_LINE);
}
@@ -164,7 +164,7 @@ WRITE16_HANDLER( tmp68301_regs_w )
{
COMBINE_DATA(&tmp68301_regs[offset]);
- if (!ACCESSING_BITS_0_7) return;
+ if (!ACCESSING_BITS_0_7) return;
// logerror("CPU #0 PC %06X: TMP68301 Reg %04X<-%04X & %04X\n",space.device().safe_pc(),offset*2,data,mem_mask^0xffff);
@@ -183,7 +183,6 @@ WRITE16_HANDLER( tmp68301_regs_w )
}
}
-void tmp68301_external_interrupt_0(running_machine &machine) { tmp68301_IE[0] = 1; update_irq_state(machine); }
-void tmp68301_external_interrupt_1(running_machine &machine) { tmp68301_IE[1] = 1; update_irq_state(machine); }
-void tmp68301_external_interrupt_2(running_machine &machine) { tmp68301_IE[2] = 1; update_irq_state(machine); }
-
+void tmp68301_external_interrupt_0(running_machine &machine) { tmp68301_IE[0] = 1; update_irq_state(machine); }
+void tmp68301_external_interrupt_1(running_machine &machine) { tmp68301_IE[1] = 1; update_irq_state(machine); }
+void tmp68301_external_interrupt_2(running_machine &machine) { tmp68301_IE[2] = 1; update_irq_state(machine); }