mirror of
https://github.com/badvision/jace.git
synced 2024-11-24 15:30:51 +00:00
Cleanup of how the paddle trigger is handled in order to support floating bus (also better floating bus support on the other memory softswitches as well)
This commit is contained in:
parent
55b3693466
commit
3d12714068
@ -88,12 +88,21 @@ public enum SoftSwitches {
|
|||||||
PB0(new MemorySoftSwitch("Pushbutton0", -1, -1, 0x0c061, RAMEvent.TYPE.ANY, null)),
|
PB0(new MemorySoftSwitch("Pushbutton0", -1, -1, 0x0c061, RAMEvent.TYPE.ANY, null)),
|
||||||
PB1(new MemorySoftSwitch("Pushbutton1", -1, -1, 0x0c062, RAMEvent.TYPE.ANY, null)),
|
PB1(new MemorySoftSwitch("Pushbutton1", -1, -1, 0x0c062, RAMEvent.TYPE.ANY, null)),
|
||||||
PB2(new MemorySoftSwitch("Pushbutton2", -1, -1, 0x0c063, RAMEvent.TYPE.ANY, null)),
|
PB2(new MemorySoftSwitch("Pushbutton2", -1, -1, 0x0c063, RAMEvent.TYPE.ANY, null)),
|
||||||
PDLTRIG(new MemorySoftSwitch(
|
PDLTRIG(new SoftSwitch("PaddleTrigger",
|
||||||
"PaddleTrigger",
|
|
||||||
null,
|
null,
|
||||||
new int[]{0x0c070, 0x0c071, 0x0c072, 0x0c073, 0x0c074, 0x0c075, 0x0c076, 0x0c077,
|
new int[]{0x0c070, 0x0c071, 0x0c072, 0x0c073, 0x0c074, 0x0c075, 0x0c076, 0x0c077,
|
||||||
0x0c078, 0x0c079, 0x0c07a, 0x0c07b, 0x0c07c, 0x0c07d, 0x0c07e, 0x0c07f},
|
0x0c078, 0x0c079, 0x0c07a, 0x0c07b, 0x0c07c, 0x0c07d, 0x0c07e, 0x0c07f},
|
||||||
null, RAMEvent.TYPE.ANY, false)),
|
null, RAMEvent.TYPE.ANY, false) {
|
||||||
|
@Override
|
||||||
|
protected byte readSwitch() {
|
||||||
|
setState(true);
|
||||||
|
return computer.getVideo().getFloatingBus();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stateChanged() {
|
||||||
|
}
|
||||||
|
}),
|
||||||
PDL0(new MemorySoftSwitch("Paddle0", -1, -1, 0x0c064, RAMEvent.TYPE.ANY, false)),
|
PDL0(new MemorySoftSwitch("Paddle0", -1, -1, 0x0c064, RAMEvent.TYPE.ANY, false)),
|
||||||
PDL1(new MemorySoftSwitch("Paddle1", -1, -1, 0x0c065, RAMEvent.TYPE.ANY, false)),
|
PDL1(new MemorySoftSwitch("Paddle1", -1, -1, 0x0c065, RAMEvent.TYPE.ANY, false)),
|
||||||
PDL2(new MemorySoftSwitch("Paddle2", -1, -1, 0x0c066, RAMEvent.TYPE.ANY, false)),
|
PDL2(new MemorySoftSwitch("Paddle2", -1, -1, 0x0c066, RAMEvent.TYPE.ANY, false)),
|
||||||
@ -114,7 +123,7 @@ public enum SoftSwitches {
|
|||||||
KEYBOARD_STROBE_READ(new SoftSwitch("KeyStrobe_Read", 0x0c010, -1, -1, RAMEvent.TYPE.READ, false) {
|
KEYBOARD_STROBE_READ(new SoftSwitch("KeyStrobe_Read", 0x0c010, -1, -1, RAMEvent.TYPE.READ, false) {
|
||||||
@Override
|
@Override
|
||||||
protected byte readSwitch() {
|
protected byte readSwitch() {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
return computer.getVideo().getFloatingBus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package jace.apple2e.softswitch;
|
package jace.apple2e.softswitch;
|
||||||
|
|
||||||
import jace.core.Computer;
|
|
||||||
import jace.core.RAMEvent;
|
import jace.core.RAMEvent;
|
||||||
import jace.core.SoftSwitch;
|
import jace.core.SoftSwitch;
|
||||||
|
|
||||||
@ -38,6 +37,7 @@ public class MemorySoftSwitch extends SoftSwitch {
|
|||||||
super(name, offAddrs, onAddrs, queryAddrs, changeType, initalState);
|
super(name, offAddrs, onAddrs, queryAddrs, changeType, initalState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stateChanged() {
|
public void stateChanged() {
|
||||||
// System.out.println(getName()+ " was switched to "+getState());
|
// System.out.println(getName()+ " was switched to "+getState());
|
||||||
if (computer.getMemory() != null) {
|
if (computer.getMemory() != null) {
|
||||||
@ -46,7 +46,13 @@ public class MemorySoftSwitch extends SoftSwitch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Todo: Implement floating bus, maybe?
|
// Todo: Implement floating bus, maybe?
|
||||||
|
@Override
|
||||||
protected byte readSwitch() {
|
protected byte readSwitch() {
|
||||||
return (byte) (getState() ? 0x0A0 : 0x020);
|
byte value = computer.getVideo().getFloatingBus();
|
||||||
|
if (getState()) {
|
||||||
|
return (byte) (value | 0x080);
|
||||||
|
} else {
|
||||||
|
return (byte) (value & 0x07f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package jace.apple2e.softswitch;
|
package jace.apple2e.softswitch;
|
||||||
|
|
||||||
import jace.core.Computer;
|
|
||||||
import jace.core.RAMEvent;
|
import jace.core.RAMEvent;
|
||||||
import jace.core.SoftSwitch;
|
import jace.core.SoftSwitch;
|
||||||
|
|
||||||
@ -38,6 +37,7 @@ public class VideoSoftSwitch extends SoftSwitch {
|
|||||||
super(name, offAddrs, onAddrs, queryAddrs, changeType, initalState);
|
super(name, offAddrs, onAddrs, queryAddrs, changeType, initalState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stateChanged() {
|
public void stateChanged() {
|
||||||
// System.out.println("Set "+getName()+" -> "+getState());
|
// System.out.println("Set "+getName()+" -> "+getState());
|
||||||
if (computer.getVideo() != null) {
|
if (computer.getVideo() != null) {
|
||||||
@ -45,6 +45,7 @@ public class VideoSoftSwitch extends SoftSwitch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected byte readSwitch() {
|
protected byte readSwitch() {
|
||||||
// System.out.println("Read "+getName()+" = "+getState());
|
// System.out.println("Read "+getName()+" = "+getState());
|
||||||
return (byte) (getState() ? 0x080 : 0x000);
|
return (byte) (getState() ? 0x080 : 0x000);
|
||||||
|
@ -144,6 +144,9 @@ public abstract class SoftSwitch {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doEvent(RAMEvent e) {
|
protected void doEvent(RAMEvent e) {
|
||||||
|
if (e.getType().isRead()) {
|
||||||
|
e.setNewValue(computer.getVideo().getFloatingBus());
|
||||||
|
}
|
||||||
if (!exclusionActivate.contains(e.getAddress())) {
|
if (!exclusionActivate.contains(e.getAddress())) {
|
||||||
// System.out.println("Access to "+Integer.toHexString(e.getAddress())+" ENABLES switch "+getName());
|
// System.out.println("Access to "+Integer.toHexString(e.getAddress())+" ENABLES switch "+getName());
|
||||||
setState(true);
|
setState(true);
|
||||||
|
@ -199,14 +199,11 @@ public class Joystick extends Device {
|
|||||||
protected void doEvent(RAMEvent e) {
|
protected void doEvent(RAMEvent e) {
|
||||||
setRun(true);
|
setRun(true);
|
||||||
readJoystick();
|
readJoystick();
|
||||||
// if (x <= 0) {
|
|
||||||
xSwitch.setState(true);
|
xSwitch.setState(true);
|
||||||
x = 10 + joyX * 11;
|
x = 10 + joyX * 11;
|
||||||
// }
|
|
||||||
// if (y <= 0) {
|
|
||||||
ySwitch.setState(true);
|
ySwitch.setState(true);
|
||||||
y = 10 + joyY * 11;
|
y = 10 + joyY * 11;
|
||||||
// }
|
e.setNewValue(computer.getVideo().getFloatingBus());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user