gpgx: don't let (our copy of) PC reg run away during callbacks.

todo: less ugly?
This commit is contained in:
feos 2016-02-25 20:07:51 +03:00
parent d70951c20b
commit b02601cb04
4 changed files with 10 additions and 5 deletions

View File

@ -9,6 +9,7 @@ extern void (*biz_execcb)(unsigned addr);
extern void (*biz_readcb)(unsigned addr);
extern void (*biz_writecb)(unsigned addr);
extern CDCallback biz_cdcallback;
extern unsigned biz_lastpc;
enum eCDLog_AddrType
{

View File

@ -57,6 +57,7 @@ void (*biz_execcb)(unsigned addr) = NULL;
void (*biz_readcb)(unsigned addr) = NULL;
void (*biz_writecb)(unsigned addr) = NULL;
CDCallback biz_cdcallback = NULL;
unsigned biz_lastpc = 0;
static void update_viewport(void)
{
@ -629,6 +630,8 @@ GPGX_EX int gpgx_getregs(gpregister_t *regs)
MAKEREG(IR);
#undef MAKEREG
(regs-6)->value = biz_lastpc; // during read/write callbacks, PC runs away due to prefetch. restore it.
// 13
#define MAKEREG(x) regs->name = "Z80 " #x; regs->value = Z80.x.d; regs++; ret++;
MAKEREG(pc);

View File

@ -342,12 +342,13 @@ void m68k_run(unsigned int cycles)
if (biz_execcb)
biz_execcb(REG_PC);
if(biz_cdcallback)
{
CDLog68k(REG_PC,eCDLog_Flags_Exec68k);
CDLog68k(REG_PC+1,eCDLog_Flags_Exec68k);
}
if(biz_cdcallback)
{
CDLog68k(REG_PC,eCDLog_Flags_Exec68k);
CDLog68k(REG_PC+1,eCDLog_Flags_Exec68k);
}
biz_lastpc = REG_PC;
/* Decode next instruction */
REG_IR = m68ki_read_imm_16();

Binary file not shown.