notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
32x: rework scheduling/timing
[picodrive.git]
/
cpu
/
sh2
/
sh2.c
diff --git
a/cpu/sh2/sh2.c
b/cpu/sh2/sh2.c
index
0e6be67
..
7b9f9a1
100644
(file)
--- a/
cpu/sh2/sh2.c
+++ b/
cpu/sh2/sh2.c
@@
-1,3
+1,10
@@
+/*
+ * PicoDrive
+ * (C) notaz, 2009,2010
+ *
+ * This work is licensed under the terms of MAME license.
+ * See COPYING file in the top-level directory.
+ */
#include <string.h>
#include <stddef.h>
#include <string.h>
#include <stddef.h>
@@
-13,7
+20,7
@@
int sh2_init(SH2 *sh2, int is_slave)
{
int ret = 0;
{
int ret = 0;
- memset(sh2, 0,
sizeof(*
sh2));
+ memset(sh2, 0,
offsetof(SH2, mult_m68k_to_
sh2));
sh2->is_slave = is_slave;
pdb_register_cpu(sh2, PDBCT_SH2, is_slave ? "ssh2" : "msh2");
#ifdef DRC_SH2
sh2->is_slave = is_slave;
pdb_register_cpu(sh2, PDBCT_SH2, is_slave ? "ssh2" : "msh2");
#ifdef DRC_SH2
@@
-52,27
+59,31
@@
void sh2_do_irq(SH2 *sh2, int level, int vector)
sh2->pc = p32x_sh2_read32(sh2->vbr + vector * 4, sh2);
/* 13 cycles at best */
sh2->pc = p32x_sh2_read32(sh2->vbr + vector * 4, sh2);
/* 13 cycles at best */
- sh2->
cycles_done += 13
;
+ sh2->
m68krcycles_done += C_SH2_TO_M68K(*sh2, 13)
;
// sh2->icount -= 13;
}
// sh2->icount -= 13;
}
-
void
sh2_irl_irq(SH2 *sh2, int level, int nested_call)
+
int
sh2_irl_irq(SH2 *sh2, int level, int nested_call)
{
{
+ int taken;
+
sh2->pending_irl = level;
if (level < sh2->pending_int_irq)
level = sh2->pending_int_irq;
sh2->pending_level = level;
sh2->pending_irl = level;
if (level < sh2->pending_int_irq)
level = sh2->pending_int_irq;
sh2->pending_level = level;
- if (!nested_call) {
- // not in memhandler, so handle this now (recompiler friendly)
- // do this to avoid missing irqs that other SH2 might clear
- if (level > ((sh2->sr >> 4) & 0x0f)) {
+ taken = (level > ((sh2->sr >> 4) & 0x0f));
+ if (taken) {
+ if (!nested_call) {
+ // not in memhandler, so handle this now (recompiler friendly)
+ // do this to avoid missing irqs that other SH2 might clear
int vector = sh2->irq_callback(sh2, level);
sh2_do_irq(sh2, level, vector);
}
int vector = sh2->irq_callback(sh2, level);
sh2_do_irq(sh2, level, vector);
}
+ else
+ sh2->test_irq = 1;
}
}
- else
- sh2->test_irq = 1;
+ return taken;
}
void sh2_internal_irq(SH2 *sh2, int level, int vector)
}
void sh2_internal_irq(SH2 *sh2, int level, int vector)
@@
-98,8
+109,6
@@
void sh2_pack(const SH2 *sh2, unsigned char *buff)
p[0] = sh2->pending_int_irq;
p[1] = sh2->pending_int_vector;
p[0] = sh2->pending_int_irq;
p[1] = sh2->pending_int_vector;
- p[2] = sh2->cycles_aim;
- p[3] = sh2->cycles_done;
}
void sh2_unpack(SH2 *sh2, const unsigned char *buff)
}
void sh2_unpack(SH2 *sh2, const unsigned char *buff)
@@
-111,7
+120,5
@@
void sh2_unpack(SH2 *sh2, const unsigned char *buff)
sh2->pending_int_irq = p[0];
sh2->pending_int_vector = p[1];
sh2->pending_int_irq = p[0];
sh2->pending_int_vector = p[1];
- sh2->cycles_aim = p[2];
- sh2->cycles_done = p[3];
}
}