From d3cc1b974285761e2c3476fbef1b27eb1bf9ad0f Mon Sep 17 00:00:00 2001 From: Roberto Fresca Date: Mon, 6 Oct 2008 21:36:30 +0000 Subject: [PATCH] Fixed timers in i8051 core. [Grull Osgo] --- src/emu/cpu/i8051/i8051.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/emu/cpu/i8051/i8051.c b/src/emu/cpu/i8051/i8051.c index d19ad0a5f02..ef78f3af124 100644 --- a/src/emu/cpu/i8051/i8051.c +++ b/src/emu/cpu/i8051/i8051.c @@ -402,11 +402,13 @@ static READ32_HANDLER((*hold_eram_iaddr_callback)); /* Any pending IRQ */ #define SERIALPORT_IRQ ((R_SCON & 0x03) && GET_ES) +#define TIMERS_IRQ ((GET_TF0 && GET_ET0) || (GET_TF1 && GET_ET1)) +#define EXTERNAL_IRQ ((GET_IE0 && GET_EX0) || (GET_IE1 && GET_EX1)) #if (HAS_I8052 || HAS_I8752) -#define NO_PENDING_IRQ !(R_TCON & 0xaa) && !(SERIALPORT_IRQ) && !(GET_ET2 && (GET_TF2 || GET_EXF2)) +#define NO_PENDING_IRQ !(TIMERS_IRQ) && !(EXTERNAL_IRQ) && !(SERIALPORT_IRQ) && !(GET_ET2 && (GET_TF2 || GET_EXF2)) #else -#define NO_PENDING_IRQ !(R_TCON & 0xaa) && !(SERIALPORT_IRQ) +#define NO_PENDING_IRQ !(TIMERS_IRQ) && !(EXTERNAL_IRQ) && !(SERIALPORT_IRQ) #endif /* Clear Current IRQ */ @@ -606,7 +608,7 @@ int i8051_execute(int cycles) if(PC != PPC) op = cpu_readop(PC); //Update Timer (if any timers are running) - if((GET_TR0 && GET_ET0) || (GET_TR1 && GET_ET1)) + if(GET_TR0 || GET_TR1) update_timer(i8051.prev_used_cycles); //Update Serial (if serial port sending data)