mirror of
https://github.com/FunKey-Project/picodrive-irixxxx.git
synced 2026-05-01 10:29:37 +02:00
32x: sh2mame: critical bugfix (irqs on delay slot) + global cycle counter
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@796 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
@@ -48,10 +48,10 @@ typedef struct
|
|||||||
void (*irq_callback)(int id, int level);
|
void (*irq_callback)(int id, int level);
|
||||||
int is_slave;
|
int is_slave;
|
||||||
|
|
||||||
// XXX: unused, will we ever use?
|
UINT32 cycles_aim; // subtract sh2_icount to get global counter
|
||||||
int internal_irq_level;
|
|
||||||
} SH2;
|
} SH2;
|
||||||
|
|
||||||
|
SH2 *sh2; // active sh2
|
||||||
extern int sh2_icount;
|
extern int sh2_icount;
|
||||||
|
|
||||||
void sh2_init(SH2 *sh2, int is_slave);
|
void sh2_init(SH2 *sh2, int is_slave);
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ void sh2_reset(SH2 *sh2)
|
|||||||
sh2->pc = RL(0);
|
sh2->pc = RL(0);
|
||||||
sh2->r[15] = RL(4);
|
sh2->r[15] = RL(4);
|
||||||
sh2->sr = I;
|
sh2->sr = I;
|
||||||
|
|
||||||
sh2->internal_irq_level = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute cycles - returns number of cycles actually run */
|
/* Execute cycles - returns number of cycles actually run */
|
||||||
@@ -64,6 +62,7 @@ int sh2_execute(SH2 *sh2_, int cycles)
|
|||||||
{
|
{
|
||||||
sh2 = sh2_;
|
sh2 = sh2_;
|
||||||
sh2_icount = cycles;
|
sh2_icount = cycles;
|
||||||
|
sh2->cycles_aim += cycles;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -112,7 +111,7 @@ int sh2_execute(SH2 *sh2_, int cycles)
|
|||||||
}
|
}
|
||||||
sh2_icount--;
|
sh2_icount--;
|
||||||
}
|
}
|
||||||
while (sh2_icount > 0);
|
while (sh2_icount > 0 || sh2->delay); /* can't interrupt before delay */
|
||||||
|
|
||||||
return cycles - sh2_icount;
|
return cycles - sh2_icount;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user