forked from Apple-2-Tools/jace
Whitespace reformat and moving around init code in hopes of getting U5 to playback correctly on the first try every boot
This commit is contained in:
parent
2f9b38e570
commit
55b3693466
@ -98,7 +98,7 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
public void sendOutputA(int value) {
|
public void sendOutputA(int value) {
|
||||||
chips[j].setBus(value);
|
chips[j].setBus(value);
|
||||||
if (phasorMode) {
|
if (phasorMode) {
|
||||||
chips[j+2].setBus(value);
|
chips[j + 2].setBus(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,8 +108,8 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
if ((chips[j].mask & value) != 0) {
|
if ((chips[j].mask & value) != 0) {
|
||||||
chips[j].setControl(value & 0x07);
|
chips[j].setControl(value & 0x07);
|
||||||
}
|
}
|
||||||
if ((chips[j+2].mask & value) != 0) {
|
if ((chips[j + 2].mask & value) != 0) {
|
||||||
chips[j+2].setControl(value & 0x07);
|
chips[j + 2].setControl(value & 0x07);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chips[j].setControl(value & 0x07);
|
chips[j].setControl(value & 0x07);
|
||||||
@ -142,7 +142,6 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleFirmwareAccess(int register, TYPE type, int value, RAMEvent e) {
|
protected void handleFirmwareAccess(int register, TYPE type, int value, RAMEvent e) {
|
||||||
// System.out.println(e.getType().toString() + " event to mockingboard register "+Integer.toHexString(register)+", value "+e.getNewValue());
|
|
||||||
resume();
|
resume();
|
||||||
int chip = 0;
|
int chip = 0;
|
||||||
for (PSG psg : chips) {
|
for (PSG psg : chips) {
|
||||||
@ -159,7 +158,6 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
R6522 controller = controllers[chip & 1];
|
R6522 controller = controllers[chip & 1];
|
||||||
if (e.getType().isRead()) {
|
if (e.getType().isRead()) {
|
||||||
int val = controller.readRegister(register & 0x0f);
|
int val = controller.readRegister(register & 0x0f);
|
||||||
// System.out.println("Register returns "+Integer.toHexString(val));
|
|
||||||
e.setNewValue(val);
|
e.setNewValue(val);
|
||||||
} else {
|
} else {
|
||||||
controller.writeRegister(register & 0x0f, e.getNewValue());
|
controller.writeRegister(register & 0x0f, e.getNewValue());
|
||||||
@ -209,7 +207,7 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
boolean restart = suspend();
|
boolean restart = suspend();
|
||||||
initPSG();
|
initPSG();
|
||||||
for (PSG chip : chips) {
|
for (PSG chip : chips) {
|
||||||
chip.setRate(phasorMode ? CLOCK_SPEED*2 : CLOCK_SPEED, SAMPLE_RATE);
|
chip.setRate(phasorMode ? CLOCK_SPEED * 2 : CLOCK_SPEED, SAMPLE_RATE);
|
||||||
chip.reset();
|
chip.reset();
|
||||||
}
|
}
|
||||||
super.reconfigure();
|
super.reconfigure();
|
||||||
@ -218,7 +216,6 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
public static int[] VolTable;
|
public static int[] VolTable;
|
||||||
int[][] buffers;
|
int[][] buffers;
|
||||||
@ -249,6 +246,7 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
VolTable[i] = (int) Math.round(out); /* round to nearest */ // [TC: unsigned int cast]
|
VolTable[i] = (int) Math.round(out); /* round to nearest */ // [TC: unsigned int cast]
|
||||||
// out /= 1.188502227; /* = 10 ^ (1.5/20) = 1.5dB */
|
// out /= 1.188502227; /* = 10 ^ (1.5/20) = 1.5dB */
|
||||||
// out /= 1.15; /* = 10 ^ (3/20) = 3dB */
|
// out /= 1.15; /* = 10 ^ (3/20) = 3dB */
|
||||||
|
|
||||||
delta += 0.0225;
|
delta += 0.0225;
|
||||||
out /= delta; // As per applewin's source, the levels don't scale as documented.
|
out /= delta; // As per applewin's source, the levels don't scale as documented.
|
||||||
}
|
}
|
||||||
@ -263,6 +261,10 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
if (!isRunning()) {
|
if (!isRunning()) {
|
||||||
if (chips == null) {
|
if (chips == null) {
|
||||||
initPSG();
|
initPSG();
|
||||||
|
for (PSG psg : chips) {
|
||||||
|
psg.setRate(phasorMode ? CLOCK_SPEED * 2 : CLOCK_SPEED, SAMPLE_RATE);
|
||||||
|
psg.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (R6522 controller : controllers) {
|
for (R6522 controller : controllers) {
|
||||||
controller.attach();
|
controller.attach();
|
||||||
@ -283,12 +285,6 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
controller.suspend();
|
controller.suspend();
|
||||||
controller.detach();
|
controller.detach();
|
||||||
}
|
}
|
||||||
// Reset PSG registers
|
|
||||||
if (chips != null) {
|
|
||||||
for (PSG psg : chips) {
|
|
||||||
psg.reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (playbackThread == null || !playbackThread.isAlive()) {
|
if (playbackThread == null || !playbackThread.isAlive()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -395,10 +391,10 @@ public class CardMockingboard extends Card implements Runnable {
|
|||||||
private void initPSG() {
|
private void initPSG() {
|
||||||
if (phasorMode) {
|
if (phasorMode) {
|
||||||
chips = new PSG[4];
|
chips = new PSG[4];
|
||||||
chips[0] = new PSG(0x10, CLOCK_SPEED*2, SAMPLE_RATE, "AY1", 8);
|
chips[0] = new PSG(0x10, CLOCK_SPEED * 2, SAMPLE_RATE, "AY1", 8);
|
||||||
chips[1] = new PSG(0x80, CLOCK_SPEED*2, SAMPLE_RATE, "AY2", 8);
|
chips[1] = new PSG(0x80, CLOCK_SPEED * 2, SAMPLE_RATE, "AY2", 8);
|
||||||
chips[2] = new PSG(0x10, CLOCK_SPEED*2, SAMPLE_RATE, "AY3", 16);
|
chips[2] = new PSG(0x10, CLOCK_SPEED * 2, SAMPLE_RATE, "AY3", 16);
|
||||||
chips[3] = new PSG(0x80, CLOCK_SPEED*2, SAMPLE_RATE, "AY4", 16);
|
chips[3] = new PSG(0x80, CLOCK_SPEED * 2, SAMPLE_RATE, "AY4", 16);
|
||||||
} else {
|
} else {
|
||||||
chips = new PSG[2];
|
chips = new PSG[2];
|
||||||
chips[0] = new PSG(0, CLOCK_SPEED, SAMPLE_RATE, "AY1", 255);
|
chips[0] = new PSG(0, CLOCK_SPEED, SAMPLE_RATE, "AY1", 255);
|
||||||
|
Loading…
Reference in New Issue
Block a user