mirror of
https://github.com/badvision/jace.git
synced 2024-11-28 10:52:33 +00:00
Add mockingboard register logging and workaround for routines that use high frequencies instead of muting channels
This commit is contained in:
parent
3701cd5457
commit
14b0cfd967
@ -75,7 +75,9 @@ public class EnvelopeGenerator extends TimedGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int shape;
|
||||||
public void setShape(int shape) {
|
public void setShape(int shape) {
|
||||||
|
this.shape = shape & 15;
|
||||||
oddEven = false;
|
oddEven = false;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
cont = (shape & 8) != 0;
|
cont = (shape & 8) != 0;
|
||||||
|
@ -23,6 +23,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
import jace.hardware.CardMockingboard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the AY sound PSG chip. This class manages register values
|
* Implementation of the AY sound PSG chip. This class manages register values
|
||||||
* and mixes the channels together (in the update method) The work of
|
* and mixes the channels together (in the update method) The work of
|
||||||
@ -225,6 +227,32 @@ public class PSG {
|
|||||||
case PortA, PortB -> {
|
case PortA, PortB -> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (CardMockingboard.DEBUG) {
|
||||||
|
debugStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String lastStatus = "";
|
||||||
|
public void debugStatus() {
|
||||||
|
String status = String.format("b%02X: A %03X %s %01X | B %03X %s %01X | C %03X %s %01X | N %03X | E %01X %04X",
|
||||||
|
baseReg,
|
||||||
|
channels.get(0).period,
|
||||||
|
(channels.get(0).active ? "T" : "_") + (channels.get(0).noiseActive ? "N" : "_"),
|
||||||
|
channels.get(0).amplitude,
|
||||||
|
channels.get(1).period,
|
||||||
|
(channels.get(1).active ? "T" : "_") + (channels.get(1).noiseActive ? "N" : "_"),
|
||||||
|
channels.get(1).amplitude,
|
||||||
|
channels.get(2).period,
|
||||||
|
(channels.get(2).active ? "T" : "_") + (channels.get(2).noiseActive ? "N" : "_"),
|
||||||
|
channels.get(2).amplitude,
|
||||||
|
noiseGenerator.period,
|
||||||
|
envelopeGenerator.shape,
|
||||||
|
envelopeGenerator.period
|
||||||
|
);
|
||||||
|
if (!lastStatus.equals(status)) {
|
||||||
|
System.out.println(status);
|
||||||
|
lastStatus = status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(AtomicInteger bufA, boolean clearA, AtomicInteger bufB, boolean clearB, AtomicInteger bufC, boolean clearC) {
|
public void update(AtomicInteger bufA, boolean clearA, AtomicInteger bufB, boolean clearB, AtomicInteger bufC, boolean clearC) {
|
||||||
|
@ -62,6 +62,11 @@ public class TimedGenerator {
|
|||||||
protected int updateCounter() {
|
protected int updateCounter() {
|
||||||
counter += cyclesPerSample;
|
counter += cyclesPerSample;
|
||||||
int numStateChanges = 0;
|
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;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
while (counter >= clocksPerPeriod) {
|
while (counter >= clocksPerPeriod) {
|
||||||
counter -= clocksPerPeriod;
|
counter -= clocksPerPeriod;
|
||||||
numStateChanges++;
|
numStateChanges++;
|
||||||
|
Loading…
Reference in New Issue
Block a user