#ifdef PICODRIVE_HACK
-#define NOT_POLLING g_m68kcontext->not_polling = 1;
+#define NOT_POLLING ctx->not_polling = 1;
#else
#define NOT_POLLING
#endif
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
#ifdef USE_CYCLONE_TIMING
RET(0)
#else
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(20)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(0)
}
RET(20)
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
flag_C = 0;
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
flag_C = 0;
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
flag_C = 0;
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
flag_C = 0;
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
flag_C = 0;
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
flag_C = 0;
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
flag_C = 0;
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
flag_C = 0;
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
flag_C = 0;
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
flag_C = 0;
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(12)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(16)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(16)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(18)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(20)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(22)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(20)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(24)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(20)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(22)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(16)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(16)
}
else
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
RET(18)
u32 adr, res;
u32 src, dst;
- res = DREGu8((Opcode >> 0) & 7);
- res = 0x9a - res - ((flag_X >> M68K_SR_X_SFT) & 1);
+ dst = DREGu8((Opcode >> 0) & 7);
+ res = -dst - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res != 0x9a)
+ if (res != 0)
{
- if ((res & 0x0f) == 0xa) res = (res & 0xf0) + 0x10;
- res &= 0xFF;
- DREGu8((Opcode >> 0) & 7) = res;
+ flag_V = res;
+ if (((res|dst) & 0x0f) == 0) res = (res & 0xf0) + 6;
+ res = (res + 0x9a) & 0xFF;
+ DREGu8((Opcode >> 0) & 7) = res;
+ flag_V &= ~res;
flag_NotZ |= res;
flag_X = flag_C = M68K_SR_C;
}
- else flag_X = flag_C = 0;
+ else flag_V = flag_X = flag_C = 0;
flag_N = res;
RET(6)
}
adr = AREG((Opcode >> 0) & 7);
PRE_IO
- READ_BYTE_F(adr, res)
- res = 0x9a - res - ((flag_X >> M68K_SR_X_SFT) & 1);
+ READ_BYTE_F(adr, dst)
+ res = -dst - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res != 0x9a)
+ if (res != 0)
{
- if ((res & 0x0f) == 0xa) res = (res & 0xf0) + 0x10;
- res &= 0xFF;
- WRITE_BYTE_F(adr, res)
+ flag_V = res;
+ if (((res|dst) & 0x0f) == 0) res = (res & 0xf0) + 6;
+ res = (res + 0x9a) & 0xFF;
+ WRITE_BYTE_F(adr, res)
+ flag_V &= ~res;
flag_NotZ |= res;
flag_X = flag_C = M68K_SR_C;
}
- else flag_X = flag_C = 0;
+ else flag_V = flag_X = flag_C = 0;
flag_N = res;
POST_IO
RET(12)
adr = AREG((Opcode >> 0) & 7);
AREG((Opcode >> 0) & 7) += 1;
PRE_IO
- READ_BYTE_F(adr, res)
- res = 0x9a - res - ((flag_X >> M68K_SR_X_SFT) & 1);
+ READ_BYTE_F(adr, dst)
+ res = -dst - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res != 0x9a)
+ if (res != 0)
{
- if ((res & 0x0f) == 0xa) res = (res & 0xf0) + 0x10;
- res &= 0xFF;
- WRITE_BYTE_F(adr, res)
+ flag_V = res;
+ if (((res|dst) & 0x0f) == 0) res = (res & 0xf0) + 6;
+ res = (res + 0x9a) & 0xFF;
+ WRITE_BYTE_F(adr, res)
+ flag_V &= ~res;
flag_NotZ |= res;
flag_X = flag_C = M68K_SR_C;
}
- else flag_X = flag_C = 0;
+ else flag_V = flag_X = flag_C = 0;
flag_N = res;
POST_IO
RET(12)
adr = AREG((Opcode >> 0) & 7) - 1;
AREG((Opcode >> 0) & 7) = adr;
PRE_IO
- READ_BYTE_F(adr, res)
- res = 0x9a - res - ((flag_X >> M68K_SR_X_SFT) & 1);
+ READ_BYTE_F(adr, dst)
+ res = -dst - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res != 0x9a)
+ if (res != 0)
{
- if ((res & 0x0f) == 0xa) res = (res & 0xf0) + 0x10;
- res &= 0xFF;
- WRITE_BYTE_F(adr, res)
+ flag_V = res;
+ if (((res|dst) & 0x0f) == 0) res = (res & 0xf0) + 6;
+ res = (res + 0x9a) & 0xFF;
+ WRITE_BYTE_F(adr, res)
+ flag_V &= ~res;
flag_NotZ |= res;
flag_X = flag_C = M68K_SR_C;
}
- else flag_X = flag_C = 0;
+ else flag_V = flag_X = flag_C = 0;
flag_N = res;
POST_IO
RET(14)
FETCH_SWORD(adr);
adr += AREG((Opcode >> 0) & 7);
PRE_IO
- READ_BYTE_F(adr, res)
- res = 0x9a - res - ((flag_X >> M68K_SR_X_SFT) & 1);
+ READ_BYTE_F(adr, dst)
+ res = -dst - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res != 0x9a)
+ if (res != 0)
{
- if ((res & 0x0f) == 0xa) res = (res & 0xf0) + 0x10;
- res &= 0xFF;
- WRITE_BYTE_F(adr, res)
+ flag_V = res;
+ if (((res|dst) & 0x0f) == 0) res = (res & 0xf0) + 6;
+ res = (res + 0x9a) & 0xFF;
+ WRITE_BYTE_F(adr, res)
+ flag_V &= ~res;
flag_NotZ |= res;
flag_X = flag_C = M68K_SR_C;
}
- else flag_X = flag_C = 0;
+ else flag_V = flag_X = flag_C = 0;
flag_N = res;
POST_IO
RET(16)
adr = AREG((Opcode >> 0) & 7);
DECODE_EXT_WORD
PRE_IO
- READ_BYTE_F(adr, res)
- res = 0x9a - res - ((flag_X >> M68K_SR_X_SFT) & 1);
+ READ_BYTE_F(adr, dst)
+ res = -dst - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res != 0x9a)
+ if (res != 0)
{
- if ((res & 0x0f) == 0xa) res = (res & 0xf0) + 0x10;
- res &= 0xFF;
- WRITE_BYTE_F(adr, res)
+ flag_V = res;
+ if (((res|dst) & 0x0f) == 0) res = (res & 0xf0) + 6;
+ res = (res + 0x9a) & 0xFF;
+ WRITE_BYTE_F(adr, res)
+ flag_V &= ~res;
flag_NotZ |= res;
flag_X = flag_C = M68K_SR_C;
}
- else flag_X = flag_C = 0;
+ else flag_V = flag_X = flag_C = 0;
flag_N = res;
POST_IO
RET(18)
FETCH_SWORD(adr);
PRE_IO
- READ_BYTE_F(adr, res)
- res = 0x9a - res - ((flag_X >> M68K_SR_X_SFT) & 1);
+ READ_BYTE_F(adr, dst)
+ res = -dst - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res != 0x9a)
+ if (res != 0)
{
- if ((res & 0x0f) == 0xa) res = (res & 0xf0) + 0x10;
- res &= 0xFF;
- WRITE_BYTE_F(adr, res)
+ flag_V = res;
+ if (((res|dst) & 0x0f) == 0) res = (res & 0xf0) + 6;
+ res = (res + 0x9a) & 0xFF;
+ WRITE_BYTE_F(adr, res)
+ flag_V &= ~res;
flag_NotZ |= res;
flag_X = flag_C = M68K_SR_C;
}
- else flag_X = flag_C = 0;
+ else flag_V = flag_X = flag_C = 0;
flag_N = res;
POST_IO
RET(16)
FETCH_LONG(adr);
PRE_IO
- READ_BYTE_F(adr, res)
- res = 0x9a - res - ((flag_X >> M68K_SR_X_SFT) & 1);
+ READ_BYTE_F(adr, dst)
+ res = -dst - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res != 0x9a)
+ if (res != 0)
{
- if ((res & 0x0f) == 0xa) res = (res & 0xf0) + 0x10;
- res &= 0xFF;
- WRITE_BYTE_F(adr, res)
+ flag_V = res;
+ if (((res|dst) & 0x0f) == 0) res = (res & 0xf0) + 6;
+ res = (res + 0x9a) & 0xFF;
+ WRITE_BYTE_F(adr, res)
+ flag_V &= ~res;
flag_NotZ |= res;
flag_X = flag_C = M68K_SR_C;
}
- else flag_X = flag_C = 0;
+ else flag_V = flag_X = flag_C = 0;
flag_N = res;
POST_IO
RET(20)
adr = AREG(7);
AREG(7) += 2;
PRE_IO
- READ_BYTE_F(adr, res)
- res = 0x9a - res - ((flag_X >> M68K_SR_X_SFT) & 1);
+ READ_BYTE_F(adr, dst)
+ res = -dst - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res != 0x9a)
+ if (res != 0)
{
- if ((res & 0x0f) == 0xa) res = (res & 0xf0) + 0x10;
- res &= 0xFF;
- WRITE_BYTE_F(adr, res)
+ flag_V = res;
+ if (((res|dst) & 0x0f) == 0) res = (res & 0xf0) + 6;
+ res = (res + 0x9a) & 0xFF;
+ WRITE_BYTE_F(adr, res)
+ flag_V &= ~res;
flag_NotZ |= res;
flag_X = flag_C = M68K_SR_C;
}
- else flag_X = flag_C = 0;
+ else flag_V = flag_X = flag_C = 0;
flag_N = res;
POST_IO
RET(12)
adr = AREG(7) - 2;
AREG(7) = adr;
PRE_IO
- READ_BYTE_F(adr, res)
- res = 0x9a - res - ((flag_X >> M68K_SR_X_SFT) & 1);
+ READ_BYTE_F(adr, dst)
+ res = -dst - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res != 0x9a)
+ if (res != 0)
{
- if ((res & 0x0f) == 0xa) res = (res & 0xf0) + 0x10;
- res &= 0xFF;
- WRITE_BYTE_F(adr, res)
+ flag_V = res;
+ if (((res|dst) & 0x0f) == 0) res = (res & 0xf0) + 6;
+ res = (res + 0x9a) & 0xFF;
+ WRITE_BYTE_F(adr, res)
+ flag_V &= ~res;
flag_NotZ |= res;
flag_X = flag_C = M68K_SR_C;
}
- else flag_X = flag_C = 0;
+ else flag_V = flag_X = flag_C = 0;
flag_N = res;
POST_IO
RET(14)
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(8)
#else
} while (res >>= 1);
AREG((Opcode >> 0) & 7) = adr;
POST_IO
- m68kcontext.io_cycle_counter -= (dst - adr) * 2;
+ ctx->io_cycle_counter -= (dst - adr) * 2;
RET(8)
}
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(12)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(14)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(12)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(16)
#else
} while (res >>= 1);
AREG(7) = adr;
POST_IO
- m68kcontext.io_cycle_counter -= (dst - adr) * 2;
+ ctx->io_cycle_counter -= (dst - adr) * 2;
RET(8)
}
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(8)
#else
} while (res >>= 1);
AREG((Opcode >> 0) & 7) = adr;
POST_IO
- m68kcontext.io_cycle_counter -= (dst - adr) * 2;
+ ctx->io_cycle_counter -= (dst - adr) * 2;
RET(8)
}
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(12)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(14)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(12)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(16)
#else
} while (res >>= 1);
AREG(7) = adr;
POST_IO
- m68kcontext.io_cycle_counter -= (dst - adr) * 2;
+ ctx->io_cycle_counter -= (dst - adr) * 2;
RET(8)
}
flag_NotZ = res;
flag_N = res;
#ifdef PICODRIVE_HACK
- if (g_m68kcontext == &PicoCpuFS68k) {
+ if (ctx == &PicoCpuFS68k) {
res |= 0x80;
WRITE_BYTE_F(adr, res);
}
flag_N = res;
#ifdef PICODRIVE_HACK
- if (g_m68kcontext == &PicoCpuFS68k) {
+ if (ctx == &PicoCpuFS68k) {
res |= 0x80;
WRITE_BYTE_F(adr, res);
}
flag_N = res;
#ifdef PICODRIVE_HACK
- if (g_m68kcontext == &PicoCpuFS68k) {
+ if (ctx == &PicoCpuFS68k) {
res |= 0x80;
WRITE_BYTE_F(adr, res);
}
flag_N = res;
#ifdef PICODRIVE_HACK
- if (g_m68kcontext == &PicoCpuFS68k) {
+ if (ctx == &PicoCpuFS68k) {
res |= 0x80;
WRITE_BYTE_F(adr, res);
}
flag_N = res;
#ifdef PICODRIVE_HACK
- if (g_m68kcontext == &PicoCpuFS68k) {
+ if (ctx == &PicoCpuFS68k) {
res |= 0x80;
WRITE_BYTE_F(adr, res);
}
flag_N = res;
#ifdef PICODRIVE_HACK
- if (g_m68kcontext == &PicoCpuFS68k) {
+ if (ctx == &PicoCpuFS68k) {
res |= 0x80;
WRITE_BYTE_F(adr, res);
}
flag_N = res;
#ifdef PICODRIVE_HACK
- if (g_m68kcontext == &PicoCpuFS68k) {
+ if (ctx == &PicoCpuFS68k) {
res |= 0x80;
WRITE_BYTE_F(adr, res);
}
flag_N = res;
#ifdef PICODRIVE_HACK
- if (g_m68kcontext == &PicoCpuFS68k) {
+ if (ctx == &PicoCpuFS68k) {
res |= 0x80;
WRITE_BYTE_F(adr, res);
}
flag_N = res;
#ifdef PICODRIVE_HACK
- if (g_m68kcontext == &PicoCpuFS68k) {
+ if (ctx == &PicoCpuFS68k) {
res |= 0x80;
WRITE_BYTE_F(adr, res);
}
// ILLEGAL
OPCODE(0x4AFC)
{
- SET_PC(execute_exception(M68K_ILLEGAL_INSTRUCTION_EX, GET_PC-2, GET_SR));
+#ifdef PICODRIVE_HACK
+ extern void SekFinishIdleDet(void);
+ SekFinishIdleDet();
+#endif
+ SET_PC(execute_exception(ctx, M68K_ILLEGAL_INSTRUCTION_EX, GET_PC-2, GET_SR));
RET(0)
}
// ILLEGAL A000-AFFF
OPCODE(0xA000)
{
- SET_PC(execute_exception(M68K_1010_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_1010_EX, GET_PC-2, GET_SR));
RET(0)
}
// ILLEGAL F000-FFFF
OPCODE(0xF000)
{
- SET_PC(execute_exception(M68K_1111_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_1111_EX, GET_PC-2, GET_SR));
RET(0) // 4 already taken by exc. handler
}
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(12)
#else
} while (res >>= 1);
AREG((Opcode >> 0) & 7) = adr;
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
RET(12)
}
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(16)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(18)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(16)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(20)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(16)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(18)
#else
} while (res >>= 1);
AREG(7) = adr;
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
RET(12)
}
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(12)
#else
} while (res >>= 1);
AREG((Opcode >> 0) & 7) = adr;
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
RET(12)
}
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(16)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(18)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(16)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(20)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(16)
#else
psrc++;
} while (res >>= 1);
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
#ifdef USE_CYCLONE_TIMING
RET(18)
#else
} while (res >>= 1);
AREG(7) = adr;
POST_IO
- m68kcontext.io_cycle_counter -= (adr - dst) * 2;
+ ctx->io_cycle_counter -= (adr - dst) * 2;
RET(12)
}
// TRAP
OPCODE(0x4E40)
{
- SET_PC(execute_exception(M68K_TRAP_BASE_EX + (Opcode & 0xF), GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_TRAP_BASE_EX + (Opcode & 0xF), GET_PC, GET_SR));
RET(4)
}
if (!flag_S)
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
res = AREGu32((Opcode >> 0) & 7);
if (!flag_S)
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
res = ASP;
if (!flag_S)
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
PRE_IO
- if (m68kcontext.reset_handler) m68kcontext.reset_handler();
+ if (ctx->reset_handler) ctx->reset_handler();
// CPU->Reset_CallBack();
POST_IO
RET(132)
if (!flag_S)
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
FETCH_WORD(res);
AREG(7) = ASP;
ASP = res;
}
- m68kcontext.execinfo |= FM68K_HALTED;
+ ctx->execinfo |= FM68K_HALTED;
RET0()
}
if (!flag_S)
{
- SET_PC(execute_exception(M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_PRIVILEGE_VIOLATION_EX, GET_PC-2, GET_SR));
RET(4)
}
PRE_IO
ASP = res;
}
POST_IO
- m68kcontext.execinfo &= ~(FM68K_EMULATE_GROUP_0|FM68K_EMULATE_TRACE|FM68K_DO_TRACE);
+ ctx->execinfo &= ~(FM68K_EMULATE_GROUP_0|FM68K_EMULATE_TRACE|FM68K_DO_TRACE);
CHECK_INT_TO_JUMP(20)
RET(20)
}
OPCODE(0x4E76)
{
if (flag_V & 0x80)
- SET_PC(execute_exception(M68K_TRAPV_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_TRAPV_EX, GET_PC, GET_SR));
RET(4)
}
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
RET(10)
}
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(14)
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(14)
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(16)
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(18)
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(20)
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(18)
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(22)
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(18)
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(20)
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(14)
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(14)
if ((res < 0) || (res > src))
{
flag_N = res >> 8;
- SET_PC(execute_exception(M68K_CHK_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_CHK_EX, GET_PC, GET_SR));
}
POST_IO
RET(16)
if (flag_NotZ && (!(flag_C & 0x100)))
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if ((!flag_NotZ) || (flag_C & 0x100))
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if (!(flag_C & 0x100))
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if (flag_C & 0x100)
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if (flag_NotZ)
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if (!flag_NotZ)
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if (!(flag_V & 0x80))
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if (flag_V & 0x80)
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if (!(flag_N & 0x80))
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if (flag_N & 0x80)
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if (!((flag_N ^ flag_V) & 0x80))
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if ((flag_N ^ flag_V) & 0x80)
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if (flag_NotZ && (!((flag_N ^ flag_V) & 0x80)))
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
if ((!flag_NotZ) || ((flag_N ^ flag_V) & 0x80))
{
PC += ((s8)(Opcode & 0xFE)) >> 1;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}
{
u32 adr, res;
u32 src, dst;
+ u32 corf = 0;
src = DREGu8((Opcode >> 0) & 7);
dst = DREGu8((Opcode >> 9) & 7);
res = (dst & 0xF) - (src & 0xF) - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res > 9) res -= 6;
+ if (res > 0xF) corf = 6;
res += (dst & 0xF0) - (src & 0xF0);
- if (res > 0x99)
- {
- res += 0xA0;
- flag_X = flag_C = M68K_SR_C;
- }
- else flag_X = flag_C = 0;
- flag_NotZ |= res & 0xFF;
+ flag_V = res;
+ flag_X = flag_C = (s32)res < (s32)corf ? M68K_SR_C : 0;
+ if (res > 0xff) res += 0xA0;
+ res = (res - corf) & 0xFF;
+ flag_V &= ~res;
+ flag_NotZ |= res;
flag_N = res;
DREGu8((Opcode >> 9) & 7) = res;
RET(6)
{
u32 adr, res;
u32 src, dst;
+ u32 corf = 0;
adr = AREG((Opcode >> 0) & 7) - 1;
AREG((Opcode >> 0) & 7) = adr;
AREG((Opcode >> 9) & 7) = adr;
READ_BYTE_F(adr, dst)
res = (dst & 0xF) - (src & 0xF) - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res > 9) res -= 6;
+ if (res > 0xF) corf = 6;
res += (dst & 0xF0) - (src & 0xF0);
- if (res > 0x99)
- {
- res += 0xA0;
- flag_X = flag_C = M68K_SR_C;
- }
- else flag_X = flag_C = 0;
- flag_NotZ |= res & 0xFF;
+ flag_V = res;
+ flag_X = flag_C = (s32)res < (s32)corf ? M68K_SR_C : 0;
+ if (res > 0xff) res += 0xA0;
+ res = (res - corf) & 0xFF;
+ flag_V &= ~res;
+ flag_NotZ |= res;
flag_N = res;
WRITE_BYTE_F(adr, res)
POST_IO
{
u32 adr, res;
u32 src, dst;
+ u32 corf = 0;
adr = AREG(7) - 2;
AREG(7) = adr;
AREG((Opcode >> 9) & 7) = adr;
READ_BYTE_F(adr, dst)
res = (dst & 0xF) - (src & 0xF) - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res > 9) res -= 6;
+ if (res > 0xF) corf = 6;
res += (dst & 0xF0) - (src & 0xF0);
- if (res > 0x99)
- {
- res += 0xA0;
- flag_X = flag_C = M68K_SR_C;
- }
- else flag_X = flag_C = 0;
- flag_NotZ |= res & 0xFF;
+ flag_V = res;
+ flag_X = flag_C = (s32)res < (s32)corf ? M68K_SR_C : 0;
+ if (res > 0xff) res += 0xA0;
+ res = (res - corf) & 0xFF;
+ flag_V &= ~res;
+ flag_NotZ |= res;
flag_N = res;
WRITE_BYTE_F(adr, res)
POST_IO
{
u32 adr, res;
u32 src, dst;
+ u32 corf = 0;
adr = AREG((Opcode >> 0) & 7) - 1;
AREG((Opcode >> 0) & 7) = adr;
AREG(7) = adr;
READ_BYTE_F(adr, dst)
res = (dst & 0xF) - (src & 0xF) - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res > 9) res -= 6;
+ if (res > 0xF) corf = 6;
res += (dst & 0xF0) - (src & 0xF0);
- if (res > 0x99)
- {
- res += 0xA0;
- flag_X = flag_C = M68K_SR_C;
- }
- else flag_X = flag_C = 0;
- flag_NotZ |= res & 0xFF;
+ flag_V = res;
+ flag_X = flag_C = (s32)res < (s32)corf ? M68K_SR_C : 0;
+ if (res > 0xff) res += 0xA0;
+ res = (res - corf) & 0xFF;
+ flag_V &= ~res;
+ flag_NotZ |= res;
flag_N = res;
WRITE_BYTE_F(adr, res)
POST_IO
{
u32 adr, res;
u32 src, dst;
+ u32 corf = 0;
adr = AREG(7) - 2;
AREG(7) = adr;
AREG(7) = adr;
READ_BYTE_F(adr, dst)
res = (dst & 0xF) - (src & 0xF) - ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res > 9) res -= 6;
+ if (res > 0xF) corf = 6;
res += (dst & 0xF0) - (src & 0xF0);
- if (res > 0x99)
- {
- res += 0xA0;
- flag_X = flag_C = M68K_SR_C;
- }
- else flag_X = flag_C = 0;
- flag_NotZ |= res & 0xFF;
+ flag_V = res;
+ flag_X = flag_C = (s32)res < (s32)corf ? M68K_SR_C : 0;
+ if (res > 0xff) res += 0xA0;
+ res = (res - corf) & 0xFF;
+ flag_V &= ~res;
+ flag_NotZ |= res;
flag_N = res;
WRITE_BYTE_F(adr, res)
POST_IO
src = DREGu16((Opcode >> 0) & 7);
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
RET(140)
#else
READ_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
RET(144)
#else
READ_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
RET(144)
#else
READ_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
RET(146)
#else
READ_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
RET(148)
#else
READ_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
RET(150)
#else
READ_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
RET(148)
#else
READ_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
-RET(162)
+RET(152)
#else
RET(22)
#endif
{
flag_V = M68K_SR_V;
#ifdef USE_CYCLONE_TIMING_DIV
-RET(162)
+RET(152)
#else
RET(82)
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-RET(162)
+RET(152)
#else
RET(102)
#endif
READ_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
RET(148)
#else
READ_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
-RET(160)
+RET(150)
#else
RET(20)
#endif
{
flag_V = M68K_SR_V;
#ifdef USE_CYCLONE_TIMING_DIV
-RET(160)
+RET(150)
#else
RET(80)
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-RET(160)
+RET(150)
#else
RET(100)
#endif
FETCH_WORD(src);
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
RET(144)
#else
READ_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
RET(144)
#else
READ_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
RET(146)
#else
src = (s32)DREGs16((Opcode >> 0) & 7);
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81C0;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81C0: m68kcontext.io_cycle_counter -= 50;
+end81C0: ctx->io_cycle_counter -= 50;
#endif
RET(108)
}
READSX_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81D0;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81D0: m68kcontext.io_cycle_counter -= 50;
+end81D0: ctx->io_cycle_counter -= 50;
#endif
RET(112)
}
READSX_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81D8;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81D8: m68kcontext.io_cycle_counter -= 50;
+end81D8: ctx->io_cycle_counter -= 50;
#endif
RET(112)
}
READSX_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81E0;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81E0: m68kcontext.io_cycle_counter -= 50;
+end81E0: ctx->io_cycle_counter -= 50;
#endif
RET(114)
}
READSX_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81E8;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81E8: m68kcontext.io_cycle_counter -= 50;
+end81E8: ctx->io_cycle_counter -= 50;
#endif
RET(116)
}
READSX_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81F0;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81F0: m68kcontext.io_cycle_counter -= 50;
+end81F0: ctx->io_cycle_counter -= 50;
#endif
RET(118)
}
READSX_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81F8;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81F8: m68kcontext.io_cycle_counter -= 50;
+end81F8: ctx->io_cycle_counter -= 50;
#endif
RET(116)
}
READSX_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81F9;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81F9: m68kcontext.io_cycle_counter -= 50;
+end81F9: ctx->io_cycle_counter -= 50;
#endif
RET(120)
}
READSX_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81FA;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81FA: m68kcontext.io_cycle_counter -= 50;
+end81FA: ctx->io_cycle_counter -= 50;
#endif
RET(116)
}
READSX_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81FB;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81FB: m68kcontext.io_cycle_counter -= 50;
+end81FB: ctx->io_cycle_counter -= 50;
#endif
RET(118)
}
FETCH_SWORD(src);
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81FC;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81FC: m68kcontext.io_cycle_counter -= 50;
+end81FC: ctx->io_cycle_counter -= 50;
#endif
RET(112)
}
READSX_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81DF;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81DF: m68kcontext.io_cycle_counter -= 50;
+end81DF: ctx->io_cycle_counter -= 50;
#endif
RET(112)
}
READSX_WORD_F(adr, src)
if (src == 0)
{
- SET_PC(execute_exception(M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
+ SET_PC(execute_exception(ctx, M68K_ZERO_DIVIDE_EX, GET_PC, GET_SR));
#ifdef USE_CYCLONE_TIMING_DIV
goto end81E7;
#endif
DREGu32((Opcode >> 9) & 7) = res;
}
#ifdef USE_CYCLONE_TIMING_DIV
-end81E7: m68kcontext.io_cycle_counter -= 50;
+end81E7: ctx->io_cycle_counter -= 50;
#endif
RET(114)
}
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
dst = DREGu8((Opcode >> 9) & 7);
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
dst = DREGu8((Opcode >> 9) & 7);
{
u32 adr, res;
u32 src, dst;
+ u32 corf = 0;
src = DREGu8((Opcode >> 0) & 7);
dst = DREGu8((Opcode >> 9) & 7);
res = (dst & 0xF) + (src & 0xF) + ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res > 9) res += 6;
+ if (res > 9) corf = 6;
res += (dst & 0xF0) + (src & 0xF0);
- if (res > 0x99)
+ flag_V = ~res;
+ res += corf;
+ if (res > 0x9F)
{
res -= 0xA0;
flag_X = flag_C = M68K_SR_C;
}
else flag_X = flag_C = 0;
+ flag_V &= res;
flag_NotZ |= res & 0xFF;
flag_N = res;
DREGu8((Opcode >> 9) & 7) = res;
{
u32 adr, res;
u32 src, dst;
+ u32 corf = 0;
adr = AREG((Opcode >> 0) & 7) - 1;
AREG((Opcode >> 0) & 7) = adr;
AREG((Opcode >> 9) & 7) = adr;
READ_BYTE_F(adr, dst)
res = (dst & 0xF) + (src & 0xF) + ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res > 9) res += 6;
+ if (res > 9) corf = 6;
res += (dst & 0xF0) + (src & 0xF0);
- if (res > 0x99)
+ flag_V = ~res;
+ res += corf;
+ if (res > 0x9F)
{
res -= 0xA0;
flag_X = flag_C = M68K_SR_C;
}
else flag_X = flag_C = 0;
+ flag_V &= res;
flag_NotZ |= res & 0xFF;
flag_N = res;
WRITE_BYTE_F(adr, res)
{
u32 adr, res;
u32 src, dst;
+ u32 corf = 0;
adr = AREG(7) - 2;
AREG(7) = adr;
AREG((Opcode >> 9) & 7) = adr;
READ_BYTE_F(adr, dst)
res = (dst & 0xF) + (src & 0xF) + ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res > 9) res += 6;
+ if (res > 9) corf = 6;
res += (dst & 0xF0) + (src & 0xF0);
- if (res > 0x99)
+ flag_V = ~res;
+ res += corf;
+ if (res > 0x9F)
{
res -= 0xA0;
flag_X = flag_C = M68K_SR_C;
}
else flag_X = flag_C = 0;
+ flag_V &= res;
flag_NotZ |= res & 0xFF;
flag_N = res;
WRITE_BYTE_F(adr, res)
{
u32 adr, res;
u32 src, dst;
+ u32 corf = 0;
adr = AREG((Opcode >> 0) & 7) - 1;
AREG((Opcode >> 0) & 7) = adr;
AREG(7) = adr;
READ_BYTE_F(adr, dst)
res = (dst & 0xF) + (src & 0xF) + ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res > 9) res += 6;
+ if (res > 9) corf = 6;
res += (dst & 0xF0) + (src & 0xF0);
- if (res > 0x99)
+ flag_V = ~res;
+ res += corf;
+ if (res > 0x9F)
{
res -= 0xA0;
flag_X = flag_C = M68K_SR_C;
}
else flag_X = flag_C = 0;
+ flag_V &= res;
flag_NotZ |= res & 0xFF;
flag_N = res;
WRITE_BYTE_F(adr, res)
{
u32 adr, res;
u32 src, dst;
+ u32 corf = 0;
adr = AREG(7) - 2;
AREG(7) = adr;
AREG(7) = adr;
READ_BYTE_F(adr, dst)
res = (dst & 0xF) + (src & 0xF) + ((flag_X >> M68K_SR_X_SFT) & 1);
- if (res > 9) res += 6;
+ if (res > 9) corf = 6;
res += (dst & 0xF0) + (src & 0xF0);
- if (res > 0x99)
+ flag_V = ~res;
+ res += corf;
+ if (res > 0x9F)
{
res -= 0xA0;
flag_X = flag_C = M68K_SR_C;
}
else flag_X = flag_C = 0;
+ flag_V &= res;
flag_NotZ |= res & 0xFF;
flag_N = res;
WRITE_BYTE_F(adr, res)
u32 src, dst;
// can't read byte from Ax registers !
- m68kcontext.execinfo |= M68K_FAULTED;
- m68kcontext.io_cycle_counter = 0;
+ ctx->execinfo |= M68K_FAULTED;
+ ctx->io_cycle_counter = 0;
/*
goto famec_Exec_End;
dst = DREGu8((Opcode >> 9) & 7);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = (s32)DREGs8((Opcode >> 0) & 7);
flag_V = 0;
flag_X = flag_C = src << ((M68K_SR_C_SFT + 1) - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = (s32)DREGs16((Opcode >> 0) & 7);
flag_V = 0;
flag_X = flag_C = src << ((M68K_SR_C_SFT + 1) - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = (s32)DREGs32((Opcode >> 0) & 7);
flag_V = 0;
flag_X = flag_C = src << ((M68K_SR_C_SFT + 1) - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu8((Opcode >> 0) & 7);
flag_N = flag_V = 0;
flag_X = flag_C = src << ((M68K_SR_C_SFT + 1) - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu16((Opcode >> 0) & 7);
flag_N = flag_V = 0;
flag_X = flag_C = src << ((M68K_SR_C_SFT + 1) - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu32((Opcode >> 0) & 7);
flag_N = flag_V = 0;
flag_X = flag_C = src << ((M68K_SR_C_SFT + 1) - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu8((Opcode >> 0) & 7);
src |= (flag_X & M68K_SR_X) << 0;
res = (src >> sft) | (src << (9 - sft));
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu16((Opcode >> 0) & 7);
src |= (flag_X & M68K_SR_X) << 8;
res = (src >> sft) | (src << (17 - sft));
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu32((Opcode >> 0) & 7);
flag_C = src << ((M68K_SR_C_SFT + 1) - sft);
if (sft == 1) res = (src >> 1) | ((flag_X & M68K_SR_X) << (32 - (M68K_SR_X_SFT + 1)));
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu8((Opcode >> 0) & 7);
flag_V = 0;
flag_C = src << ((M68K_SR_C_SFT + 1) - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu16((Opcode >> 0) & 7);
flag_V = 0;
flag_C = src << ((M68K_SR_C_SFT + 1) - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu32((Opcode >> 0) & 7);
flag_V = 0;
flag_C = src << ((M68K_SR_C_SFT + 1) - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu8((Opcode >> 0) & 7);
if (sft < 8)
{
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu16((Opcode >> 0) & 7);
flag_X = flag_C = src >> (8 - sft);
res = src << sft;
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu32((Opcode >> 0) & 7);
flag_X = flag_C = src >> (24 - sft);
res = src << sft;
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu8((Opcode >> 0) & 7);
flag_V = 0;
flag_X = flag_C = src << (0 + sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu16((Opcode >> 0) & 7);
flag_V = 0;
flag_X = flag_C = src >> (8 - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu32((Opcode >> 0) & 7);
flag_V = 0;
flag_X = flag_C = src >> (24 - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu8((Opcode >> 0) & 7);
src |= (flag_X & M68K_SR_X) << 0;
res = (src << sft) | (src >> (9 - sft));
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu16((Opcode >> 0) & 7);
src |= (flag_X & M68K_SR_X) << 8;
res = (src << sft) | (src >> (17 - sft));
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu32((Opcode >> 0) & 7);
flag_C = src >> ((32 - M68K_SR_C_SFT) - sft);
if (sft == 1) res = (src << 1) | ((flag_X & M68K_SR_X) >> ((M68K_SR_X_SFT + 1) - 1));
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu8((Opcode >> 0) & 7);
flag_V = 0;
flag_C = src << (0 + sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu16((Opcode >> 0) & 7);
flag_V = 0;
flag_C = src >> (8 - sft);
u32 sft;
sft = (((Opcode >> 9) - 1) & 7) + 1;
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
src = DREGu32((Opcode >> 0) & 7);
flag_V = 0;
flag_C = src >> (24 - sft);
src = (s32)DREGs8((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft < 8)
{
flag_V = 0;
src = (s32)DREGs16((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft < 16)
{
flag_V = 0;
src = (s32)DREGs32((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft < 32)
{
flag_V = 0;
src = DREGu8((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft <= 8)
{
flag_N = flag_V = 0;
src = DREGu16((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft <= 16)
{
flag_N = flag_V = 0;
src = DREGu32((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft < 32)
{
flag_N = flag_V = 0;
src = DREGu8((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
sft %= 9;
src |= (flag_X & M68K_SR_X) << 0;
src = DREGu16((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
sft %= 17;
src |= (flag_X & M68K_SR_X) << 8;
src = DREGu32((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
sft %= 33;
if (sft != 0)
{
if (sft == 1) res = (src >> 1) | ((flag_X & M68K_SR_X) << (32 - (M68K_SR_X_SFT + 1)));
else res = (src >> sft) | (src << (33 - sft)) | (((flag_X & M68K_SR_X) << (32 - (M68K_SR_X_SFT + 1))) >> (sft - 1));
- flag_X = (src >> (32 - sft)) << M68K_SR_X_SFT;
+ flag_X = (src >> (sft - 1)) << M68K_SR_X_SFT;
}
else res = src;
flag_C = flag_X;
src = DREGu8((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
sft &= 0x07;
flag_C = src << (M68K_SR_C_SFT - ((sft - 1) & 7));
src = DREGu16((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
sft &= 0x0F;
flag_C = (src >> ((sft - 1) & 15)) << M68K_SR_C_SFT;
src = DREGu32((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
sft &= 0x1F;
flag_C = (src >> ((sft - 1) & 31)) << M68K_SR_C_SFT;
src = DREGu8((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft < 8)
{
flag_X = flag_C = (src << sft) >> 0;
src = DREGu16((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft < 16)
{
flag_X = flag_C = (src << sft) >> 8;
src = DREGu32((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft < 32)
{
flag_X = flag_C = (src >> (32 - sft)) << M68K_SR_C_SFT;
src = DREGu8((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft <= 8)
{
flag_X = flag_C = (src << sft) >> 0;
src = DREGu16((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft <= 16)
{
flag_X = flag_C = (src << sft) >> 8;
src = DREGu32((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft < 32)
{
flag_X = flag_C = (src >> (32 - sft)) << M68K_SR_C_SFT;
src = DREGu8((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
sft %= 9;
src |= (flag_X & M68K_SR_X) << 0;
src = DREGu16((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
sft %= 17;
src |= (flag_X & M68K_SR_X) << 8;
src = DREGu32((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
sft %= 33;
if (sft != 0)
src = DREGu8((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft &= 0x07)
{
flag_C = (src << sft) >> 0;
src = DREGu16((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft &= 0x0F)
{
flag_C = (src << sft) >> 8;
src = DREGu32((Opcode >> 0) & 7);
if (sft)
{
- m68kcontext.io_cycle_counter -= sft * 2;
+ ctx->io_cycle_counter -= sft * 2;
if (sft &= 0x1F)
{
flag_C = (src >> (32 - sft)) << M68K_SR_C_SFT;
if ( Opcode & 0x0100) newop |= 0x400; // beq
if (!(Opcode & 0x0f00)) newop |= 0xc00; // bra
- ret = SekRegisterIdlePatch(GET_PC - 2, Opcode, newop, &m68kcontext);
+ ret = SekRegisterIdlePatch(GET_PC - 2, Opcode, newop, ctx);
switch (ret)
{
case 0: PC[-1] = newop; break;
if (cond_true)
{
PC = dest_pc;
- m68kcontext.io_cycle_counter -= 2;
+ ctx->io_cycle_counter -= 2;
}
RET(8)
}