From 6129d2714a8ff03e61ed480a88e6cccf1939da5f Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 27 Apr 2024 18:27:50 -0500 Subject: [PATCH] YM2608-LLE, part 9 --- src/engine/platform/ym2608.cpp | 56 ++++++++++++++++------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/src/engine/platform/ym2608.cpp b/src/engine/platform/ym2608.cpp index 999054ced..3774f7a37 100644 --- a/src/engine/platform/ym2608.cpp +++ b/src/engine/platform/ym2608.cpp @@ -510,7 +510,6 @@ void DivPlatformYM2608::acquire_lle(short** buf, size_t len) { fm_lle.input.wr=1; fm_lle.input.a0=0; fm_lle.input.a1=0; - //logV("preparing a delay"); delay=0; } else { fm_lle.input.cs=0; @@ -519,7 +518,6 @@ void DivPlatformYM2608::acquire_lle(short** buf, size_t len) { fm_lle.input.a0=0; fm_lle.input.a1=0; fm_lle.input.data=0; - //logV("preparing a read"); delay=1; } } else if (!writes.empty()) { @@ -534,8 +532,6 @@ void DivPlatformYM2608::acquire_lle(short** buf, size_t len) { delay=2; - //logV("VAL %.2x",w.val); - regPool[w.addr&0x1ff]=w.val; writes.pop_front(); } else { @@ -548,8 +544,6 @@ void DivPlatformYM2608::acquire_lle(short** buf, size_t len) { delay=2; - //logV("ADDR %.2x =",w.addr); - w.addrOrVal=true; } } else { @@ -558,7 +552,6 @@ void DivPlatformYM2608::acquire_lle(short** buf, size_t len) { fm_lle.input.wr=1; fm_lle.input.a0=0; fm_lle.input.a1=0; - //logV("nothing to do"); } } @@ -568,32 +561,48 @@ void DivPlatformYM2608::acquire_lle(short** buf, size_t len) { if (canWeWrite) { if (delay==1) { // check busy status here - //if (!(fm_lle.o_data&0x80)) { if (!fm_lle.busy_cnt_en[1]) { - delay=3; - } else { - //logV("AM BUSY"); + delay=0; } } } if (fm_lle.o_s && !lastS) { dacVal>>=1; - dacVal|=(fm_lle.o_opo&1)<<23; + dacVal|=(fm_lle.o_opo&1)<<14; howLong++; } if (!fm_lle.o_sh1 && lastSH) { + if (dacVal&0x2000) { // positive + int e=(dacVal>>10)&7; + int m=(dacVal>>0)&1023; + dacOut[0]=m<>10)&7)^7; + int m=((dacVal>>0)&1023)^1023; + dacOut[0]=-(m<>10)&7; //int m=(dacVal>>0)&1023; - dacOut[0]=dacVal>>8;//(m<>1; + //m-=512; have0=true; } if (!fm_lle.o_sh2 && lastSH2) { - //int e=(dacVal>>10)&7; - //int m=(dacVal>>0)&1023; - dacOut[1]=dacVal>>8;//(m<>1; + if (dacVal&0x2000) { // positive + int e=(dacVal>>10)&7; + int m=(dacVal>>0)&1023; + dacOut[1]=(m<>10)&7)^7; + int m=((dacVal>>0)&1023)^1023; + dacOut[1]=-(m<