From b02601cb0477a0ba52b42babbed61f88d7fce646 Mon Sep 17 00:00:00 2001 From: feos Date: Thu, 25 Feb 2016 20:07:51 +0300 Subject: [PATCH] gpgx: don't let (our copy of) PC reg run away during callbacks. todo: less ugly? --- genplus-gx/cinterface/callbacks.h | 1 + genplus-gx/cinterface/cinterface.c | 3 +++ genplus-gx/core/m68k/m68kcpu.c | 11 ++++++----- output/dll/libgenplusgx.dll | Bin 1897984 -> 1897984 bytes 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/genplus-gx/cinterface/callbacks.h b/genplus-gx/cinterface/callbacks.h index c99b625004..a50407a3bb 100644 --- a/genplus-gx/cinterface/callbacks.h +++ b/genplus-gx/cinterface/callbacks.h @@ -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 { diff --git a/genplus-gx/cinterface/cinterface.c b/genplus-gx/cinterface/cinterface.c index 96ae87c414..ff5c030dd0 100644 --- a/genplus-gx/cinterface/cinterface.c +++ b/genplus-gx/cinterface/cinterface.c @@ -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); diff --git a/genplus-gx/core/m68k/m68kcpu.c b/genplus-gx/core/m68k/m68kcpu.c index 9ecb1033fa..8febefd76e 100644 --- a/genplus-gx/core/m68k/m68kcpu.c +++ b/genplus-gx/core/m68k/m68kcpu.c @@ -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(); diff --git a/output/dll/libgenplusgx.dll b/output/dll/libgenplusgx.dll index c03579c4fff86ecd4f6e000d940b0dfe8bb994d3..0981e28bc0506976938870ace0d91a8b5eb0587c 100644 GIT binary patch delta 3973 zcmZWr3s@6Z7M=+K0|_QP0z?oaf>IStGLK{?$pnfIL_bACQM-bcS_+o0mC8c}1sZw8 zfMQ1*w^b{Ziu;Kz7TeerpXj3Nv(|OpR<~4L#TK{P+6rpTo_mqHw)wtu?m6fG&wn48 zJ4r>)l8T-s4HojwI%{(I(wR%|S#)8|17@GJy4eP~eNt_+8ISGFdOYrL7GPvjs_C@LYivJj82SA?~bh2VXZ!u5zhYq3Sz(arG$p z^-yiBMaAkvxOfWuCPWRa!ve=~^#b@NEYN@j&f)51@GVGSJr=lBj;q(f@4*Tiu|gNF z_JD843Y)M(H?H0Te-tTf#R_+D@e%k_SfB|D^x~?NB!~-GU zF}@H&8sQ&fWC20~Fp>|U1tA;6O`)2|Qj9M~xB}y45Kcq*OX4|Do{aGdgb&7e9fb1` zo`8{BgeWnx9>RqP2@#{!8m3Q;*1QqnK^Sj>un^(jU}P&of-%wpVHrY>iTP?x1>3i+Z5_S{5BoI~Ru%nYs_Iu`q_h(1@G z6=pULMNKL-Y9jWfscMH_IS1IFr`4_xA-^B@bn1sQgS&5vN5e*hsNimO9{^~P&Yrs< z6L`DD2Vv>@d6Aaxh)^(>xJPKS*qfh$XLzCnD0xdNEp4AL@;f6ON-Pxrc_MrbGu!*drd) zObpr%K&~thSF@n{j;J1zN5b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