Skip to content

Commit

Permalink
Reverted triangle channel refactoring (broken)
Browse files Browse the repository at this point in the history
  • Loading branch information
ogamespec committed Jul 29, 2023
1 parent 9c66a75 commit 22f5805
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 6 additions & 9 deletions BreaksAPU/APUSim/triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,18 @@ namespace APUSim

void TriangleChan::sim_Control()
{
TriState PHI1 = apu->wire.PHI1;
TriState ACLK1 = apu->wire.ACLK1;
TriState W4008 = apu->wire.W4008;
TriState W400B = apu->wire.W400B;
TriState n_LFO1 = apu->wire.n_LFO1;

fout_latch.set(FOUT, PHI1);
n_FOUT = fout_latch.nget();

lc_reg.sim(ACLK1, W4008, apu->GetDBBit(7));

TriState res_reload = NOR3(reload_latch1.get(), lc_reg.get(), n_LFO1);
Reload_FF.set(NOR(res_reload, NOR(Reload_FF.get(), W400B)));
TriState TRELOAD = Reload_FF.get();
TriState set_reload = NOR3(reload_latch1.get(), lc_reg.get(), n_LFO1);
Reload_FF.set(NOR(NOR(Reload_FF.get(), set_reload), W400B));
TriState TRELOAD = Reload_FF.nget();

reload_latch1.set(Reload_FF.get(), ACLK1);
reload_latch2.set(TRELOAD, ACLK1);
Expand All @@ -49,9 +47,6 @@ namespace APUSim
LOAD = NOR(n_LFO1, reload_latch2.nget());
STEP = NOR3(n_LFO1, reload_latch2.get(), tco_latch.get());
TSTEP = NOR5(TCO, apu->wire.LOCK, apu->wire.PHI1, apu->wire.NOTRI, n_FOUT);

FLOAD = NOR(PHI1, n_FOUT);
FSTEP = NOR(PHI1, NOT(n_FOUT));
}

void TriangleChan::sim_LinearReg()
Expand Down Expand Up @@ -98,13 +93,15 @@ namespace APUSim
TriState RES = apu->wire.RES;

TriState carry = TriState::One;
TriState FLOAD = NOR(PHI1, n_FOUT);
TriState FSTEP = NOR(PHI1, NOT(n_FOUT));

for (size_t n = 0; n < 11; n++)
{
carry = freq_cnt[n].sim(carry, RES, FLOAD, FSTEP, PHI1, freq_reg[n].get());
}

FOUT = carry;
fout_latch.set(carry, PHI1);
}

void TriangleChan::sim_Output()
Expand Down
2 changes: 0 additions & 2 deletions BreaksAPU/APUSim/triangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ namespace APUSim
BaseLogic::TriState LOAD = BaseLogic::TriState::X;
BaseLogic::TriState STEP = BaseLogic::TriState::X;
BaseLogic::TriState TSTEP = BaseLogic::TriState::X;
BaseLogic::TriState FLOAD = BaseLogic::TriState::X;
BaseLogic::TriState FSTEP = BaseLogic::TriState::X;

RegisterBit lc_reg{};
BaseLogic::FF Reload_FF{};
Expand Down

0 comments on commit 22f5805

Please sign in to comment.