diff --git a/src/main/java/jace/hardware/CardMockingboard.java b/src/main/java/jace/hardware/CardMockingboard.java index 701c80e..59d5247 100644 --- a/src/main/java/jace/hardware/CardMockingboard.java +++ b/src/main/java/jace/hardware/CardMockingboard.java @@ -162,10 +162,10 @@ public class CardMockingboard extends Card { if (e.getType().isRead()) { int val = controller.readRegister(register & 0x0f); e.setNewValue(val); - if (DEBUG) System.out.println("Chip " + chip + " Read "+Integer.toHexString(register & 0x0f)+" == "+val); + // if (DEBUG) System.out.println("Chip " + chip + " Read "+Integer.toHexString(register & 0x0f)+" == "+val); } else { controller.writeRegister(register & 0x0f, e.getNewValue()); - if (DEBUG) System.out.println("Chip " + chip + " Write "+Integer.toHexString(register & 0x0f)+" == "+e.getNewValue()); + // if (DEBUG) System.out.println("Chip " + chip + " Write "+Integer.toHexString(register & 0x0f)+" == "+e.getNewValue()); } // Any firmware access will reset the idle counter and wake up the card, this allows the timers to start running again // Games such as "Skyfox" use the timer to detect if the card is present. diff --git a/src/main/java/jace/hardware/mockingboard/TimedGenerator.java b/src/main/java/jace/hardware/mockingboard/TimedGenerator.java index 1e94c71..b17548b 100644 --- a/src/main/java/jace/hardware/mockingboard/TimedGenerator.java +++ b/src/main/java/jace/hardware/mockingboard/TimedGenerator.java @@ -51,7 +51,7 @@ public class TimedGenerator { } public void setPeriod(int _period) { - period = _period > 0 ? _period : 1; + period = _period; clocksPerPeriod = (period * stepsPerCycle()); // set counter back... necessary? // while (clocksPerPeriod > period) { @@ -60,13 +60,12 @@ public class TimedGenerator { } protected int updateCounter() { - counter += cyclesPerSample; - int numStateChanges = 0; - // Skyfox and Genius use a period value of 001 for silence instead of setting volume to 0. - if (period == 1) { - counter = 0; + // Period == 0 means the generator is off + if (period <= 1 || clocksPerPeriod <= 1) { return 0; } + counter += cyclesPerSample; + int numStateChanges = 0; while (counter >= clocksPerPeriod) { counter -= clocksPerPeriod; numStateChanges++; @@ -76,6 +75,6 @@ public class TimedGenerator { public void reset() { counter = 0; - period = 1; + period = 0; } } \ No newline at end of file