+#ifdef PICODRIVE_HACK
+#define NOT_POLLING g_m68kcontext->not_polling = 1;
+#else
+#define NOT_POLLING
+#endif
+
// ORI
OPCODE(0x0000)
{
FETCH_BYTE(src);
src = 1 << (src & 7);
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
FETCH_BYTE(src);
src = 1 << (src & 7);
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
src = DREGu8((Opcode >> 9) & 7);
src = 1 << (src & 7);
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
src = DREGu8((Opcode >> 9) & 7);
src = 1 << (src & 7);
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = (uptr)(PC) - BasePC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READSX_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READSX_LONG_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READSX_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READSX_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
if (flag_S)
{
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, res)
if (flag_S)
{
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, res)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
PUSH_32_F(adr)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
PUSH_32_F(adr)
s32 *psrc;
FETCH_WORD(res);
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
psrc = &DREGs32(0);
dst = adr;
s32 *psrc;
FETCH_WORD(res);
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
psrc = &DREGs32(0);
dst = adr;
u32 *psrc;
FETCH_WORD(res);
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
psrc = &DREGu32(0);
dst = adr;
u32 *psrc;
FETCH_WORD(res);
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
psrc = &DREGu32(0);
dst = adr;
ASP = res;
}
m68kcontext.execinfo |= FM68K_HALTED;
- m68kcontext.io_cycle_counter = 0;
-RET(4)
+RET0()
}
// RTE
{
u32 oldPC;
- oldPC = (u32)(PC) - BasePC;
+ oldPC = GET_PC;
PRE_IO
PUSH_32_F(oldPC)
}
{
u32 oldPC;
- oldPC = (u32)(PC) - BasePC;
+ oldPC = GET_PC;
PRE_IO
PUSH_32_F(oldPC)
}
{
u32 oldPC;
- oldPC = (u32)(PC) - BasePC;
+ oldPC = GET_PC;
PRE_IO
PUSH_32_F(oldPC)
}
{
u32 oldPC;
- oldPC = (u32)(PC) - BasePC;
+ oldPC = GET_PC;
PRE_IO
PUSH_32_F(oldPC)
}
{
u32 oldPC;
- oldPC = (u32)(PC) - BasePC;
+ oldPC = GET_PC;
PRE_IO
PUSH_32_F(oldPC)
}
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
{
u32 oldPC;
- oldPC = (u32)(PC) - BasePC;
+ oldPC = GET_PC;
PRE_IO
PUSH_32_F(oldPC)
}
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
{
u32 oldPC;
- oldPC = (u32)(PC) - BasePC;
+ oldPC = GET_PC;
PRE_IO
PUSH_32_F(oldPC)
}
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
SET_PC(adr)
CHECK_BRANCH_EXCEPTION(adr)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
SET_PC(adr)
CHECK_BRANCH_EXCEPTION(adr)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
res = adr;
AREG((Opcode >> 9) & 7) = res;
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
res = adr;
AREG((Opcode >> 9) & 7) = res;
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
res = DREGu16((Opcode >> 0) & 7);
res--;
DREGu16((Opcode >> 0) & 7) = res;
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if ((!flag_NotZ) || (flag_C & 0x100))
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if (flag_NotZ && (!(flag_C & 0x100)))
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if (flag_C & 0x100)
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if (!(flag_C & 0x100))
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if (!flag_NotZ)
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if (flag_NotZ)
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if (flag_V & 0x80)
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if (!(flag_V & 0x80))
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if (flag_N & 0x80)
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if (!(flag_N & 0x80))
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if ((flag_N ^ flag_V) & 0x80)
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if (!((flag_N ^ flag_V) & 0x80))
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if ((!flag_NotZ) || ((flag_N ^ flag_V) & 0x80))
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
u32 adr, res;
u32 src, dst;
+ NOT_POLLING
+
if (flag_NotZ && (!((flag_N ^ flag_V) & 0x80)))
{
res = DREGu16((Opcode >> 0) & 7);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
OPCODE(0x6001)
{
#ifdef FAMEC_CHECK_BRANCHES
- u32 newPC = (u32)(PC) - BasePC;
+ u32 newPC = GET_PC;
s8 offs=Opcode;
newPC += offs;
SET_PC(newPC);
{
u32 newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
newPC += GET_SWORD;
SET_PC(newPC);
CHECK_BRANCH_EXCEPTION(newPC)
PRE_IO
- oldPC = (u32)(PC) - BasePC;
+ oldPC = GET_PC;
PUSH_32_F(oldPC)
#ifdef FAMEC_CHECK_BRANCHES
offs = Opcode;
{
u32 oldPC, newPC;
- newPC = (u32)(PC) - BasePC;
+ newPC = GET_PC;
oldPC = newPC + 2;
PUSH_32_F(oldPC)
newPC += GET_SWORD;
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READSX_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READSX_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READSX_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READSX_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READSX_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READSX_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READSX_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READSX_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READSX_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READSX_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READSX_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READSX_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_BYTE_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_BYTE_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READ_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READ_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READSX_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READSX_WORD_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = GET_SWORD + ((u32)(PC) - BasePC);
+ adr = GET_SWORD + GET_PC;
PC++;
PRE_IO
READSX_LONG_F(adr, src)
u32 adr, res;
u32 src, dst;
- adr = (u32)(PC) - BasePC;
+ adr = GET_PC;
DECODE_EXT_WORD
PRE_IO
READSX_LONG_F(adr, src)
OPCODE(0x6001_idle)
{
#ifdef FAMEC_CHECK_BRANCHES
- u32 newPC = (u32)(PC) - BasePC;
+ u32 newPC = GET_PC;
s8 offs=Opcode;
newPC += offs;
SET_PC(newPC);
PC += ((s8)(Opcode & 0xFE)) >> 1;
#endif
UPDATE_IDLE_COUNT
- m68kcontext.io_cycle_counter = 10;
-RET(10)
+RET0()
}
// BCC
{
UPDATE_IDLE_COUNT
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter = 8;
+ //if (idle_hit)
+ RET0()
}
RET(8)
}
{
UPDATE_IDLE_COUNT
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter = 8;
+ //if (idle_hit)
+ RET0()
}
RET(8)
}
+extern int SekIsIdleReady(void);
extern int SekIsIdleCode(unsigned short *dst, int bytes);
-extern int SekRegisterIdlePatch(unsigned int pc, int oldop, int newop);
+extern int SekRegisterIdlePatch(unsigned int pc, int oldop, int newop, void *ctx);
OPCODE(idle_detector_bcc8)
{
- extern int idledet_start_frame;
- extern char Pico[];
int frame_count, cond_true, bytes, ret, newop;
u16 *dest_pc;
dest_pc = PC + (((s8)(Opcode & 0xFE)) >> 1);
- frame_count = *(int *)(Pico+0x22208+0x1c); // Pico.m.frame_count
- if (frame_count < idledet_start_frame)
+ if (!SekIsIdleReady())
goto end;
bytes = 0 - (s8)(Opcode & 0xFE) - 2;
ret = SekIsIdleCode(dest_pc, bytes);
newop = (Opcode & 0xfe) | 0x7100;
if (!ret) newop |= 0x200;
- if (Opcode & 0x0100) newop |= 0x400; // beq
+ if ( Opcode & 0x0100) newop |= 0x400; // beq
+ if (!(Opcode & 0x0f00)) newop |= 0xc00; // bra
- ret = SekRegisterIdlePatch(GET_PC - 2, Opcode, newop);
+ ret = SekRegisterIdlePatch(GET_PC - 2, Opcode, newop, &m68kcontext);
switch (ret)
{
case 0: PC[-1] = newop; break;
case 1: break;
- case 2: JumpTable[Opcode] = (Opcode & 0x0100) ? CAST_OP(0x6701) : CAST_OP(0x6601); break;
+ case 2: JumpTable[Opcode] = (Opcode & 0x0f00) ?
+ ((Opcode & 0x0100) ? CAST_OP(0x6701) : CAST_OP(0x6601)) :
+ CAST_OP(0x6001); break;
}
end:
- cond_true = (Opcode & 0x0100) ? !flag_NotZ : flag_NotZ; // beq?
+ if ((Opcode & 0xff00) == 0x6000) cond_true = 1;
+ else cond_true = (Opcode & 0x0100) ? !flag_NotZ : flag_NotZ; // beq?
if (cond_true)
{
PC = dest_pc;
RET(8)
}
-OPCODE(idle_detector_dead)
-{
- // patch without further questions
- int newop = 0x7d00 | (Opcode & 0xff);
- PC[-1] = newop;
- SekRegisterIdlePatch(GET_PC - 2, Opcode, newop);
-
- PC += ((s8)(Opcode & 0xFE)) >> 1;
-RET(10)
-}
#endif // PICODRIVE_HACK