Skip to content

Commit

Permalink
OPL: YM3812-LLE, part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
tildearrow committed Nov 24, 2023
1 parent ea2f92f commit 817d066
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 2 additions & 0 deletions extern/YM3812-LLE/fmopl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,8 @@ void FMOPL2_Clock(fmopl2_t *chip)
int value = chip->fsm_out[8] ? 0 : chip->accm_value[1];
value += add;

chip->op_value_debug = add;

int sign = ((chip->accm_top & 64) != 0 && !chip->accm_clamplow) || chip->accm_clamphigh;

int top_unsigned = chip->accm_top & 63;
Expand Down
2 changes: 2 additions & 0 deletions extern/YM3812-LLE/fmopl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ typedef struct
int o_write1;
int o_data_latch;

int op_value_debug;

} fmopl2_t;

// modification
Expand Down
23 changes: 21 additions & 2 deletions src/engine/platform/opl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,14 @@ void DivPlatformOPL::acquire_ymfm3(short** buf, size_t len) {
}

void DivPlatformOPL::acquire_nukedLLE2(short** buf, size_t len) {
int chOut[11];
for (size_t h=0; h<len; h++) {
int curCycle=-9;
unsigned char subCycle=0;
for (int i=0; i<11; i++) {
chOut[i]=0;
}

while (true) {
lastSH=fm_lle2.o_sh;
lastSY=fm_lle2.o_sy;
Expand All @@ -529,17 +536,19 @@ void DivPlatformOPL::acquire_nukedLLE2(short** buf, size_t len) {
fm_lle2.input.address=1;
fm_lle2.input.data_i=w.val;
writes.pop();
delay=84;
} else {
fm_lle2.input.cs=0;
fm_lle2.input.rd=1;
fm_lle2.input.wr=0;
fm_lle2.input.address=0;
fm_lle2.input.data_i=w.addr;
w.addrOrVal=true;
// weird. wasn't it 12?
delay=24;
}

waitingBusy=true;
delay=144;
}
}

Expand All @@ -549,8 +558,13 @@ void DivPlatformOPL::acquire_nukedLLE2(short** buf, size_t len) {
FMOPL2_Clock(&fm_lle2);

if (waitingBusy) {
if (--delay<=0) waitingBusy=false;
if (--delay<0) waitingBusy=false;
}

if (curCycle>=0 && curCycle<9) {
// TODO: this
}
if (!(++subCycle&3)) curCycle++;

if (fm_lle2.o_sy && !lastSY) {
dacVal>>=1;
Expand All @@ -570,6 +584,11 @@ void DivPlatformOPL::acquire_nukedLLE2(short** buf, size_t len) {
}

buf[0][h]=dacOut;
//buf[0][h]=((fm_lle2.op_value+0x1000)&0x1fff)-0x1000;

for (int i=0; i<11; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=chOut[i];
}
}
}

Expand Down

0 comments on commit 817d066

Please sign in to comment.