Permalink
Browse files

New Hotspot for F6 in ConsolePanel

  • Loading branch information...
1 parent 653c6dc commit 3cef13a819e344f4293e0f1053555f321d762e6f @ppeccin committed May 23, 2012
View
@@ -3,6 +3,7 @@
package atari.board;
import parameters.Parameters;
+import utils.Randomizer;
import general.board.BUS16Bits;
import atari.cartridge.Cartridge;
import atari.pia.PIA;
@@ -17,6 +18,14 @@ public BUS(TIA tia, PIA pia, RAM ram) {
this.pia = pia;
}
+ public void powerOn() {
+ // Data in the bus come random at creation if no Cartridge is inserted
+ if (cartridge == null) data = (byte)Randomizer.instance.nextInt(256);
+ }
+
+ public void powerOff() {
+ }
+
@Override
public byte readByte(int address) {
// CART selected?
@@ -8,9 +8,10 @@
/**
* Implements no cartridge connected
*/
+// TODO Remover?
public final class CartridgeDisconnected extends Cartridge {
- public CartridgeDisconnected() {
+ private CartridgeDisconnected() {
super();
}
@@ -13,7 +13,6 @@
import parameters.Parameters;
import atari.board.BUS;
import atari.cartridge.Cartridge;
-import atari.cartridge.CartridgeDisconnected;
import atari.cartridge.CartridgeSocket;
import atari.console.savestate.ConsoleState;
import atari.console.savestate.SaveStateMedia;
@@ -33,7 +32,7 @@ public Console() {
socketsCreate();
mainClockCreate();
videoStandardAuto();
- cartridge(new CartridgeDisconnected());
+ // cartridge(new CartridgeDisconnected()); TODO Verificar
}
public VideoSignal videoOutput() {
@@ -58,6 +57,7 @@ public SaveStateSocket saveStateSocket() {
public void powerOn() {
if (powerOn) powerOff();
+ bus.powerOn();
ram.powerOn();
cpu.powerOn();
pia.powerOn();
@@ -74,6 +74,7 @@ public void powerOff() {
pia.powerOff();
cpu.powerOff();
ram.powerOff();
+ bus.powerOff();
powerOn = false;
controlsSocket.controlsStatesRedefined();
}
View
@@ -12,7 +12,7 @@
public final class RAM implements BUS16Bits {
public RAM() {
- // RAMs come totally random at creation
+ // RAM come totally random at creation
Randomizer.instance.nextBytes(bytes);
}
@@ -3,7 +3,6 @@
import general.av.video.VideoStandard;
import atari.cartridge.Cartridge;
import atari.cartridge.Cartridge4K;
-import atari.cartridge.CartridgeDisconnected;
import atari.cartridge.bankswitching.Cartridge12K;
import atari.cartridge.bankswitching.Cartridge16K;
import atari.cartridge.bankswitching.Cartridge28K;
@@ -29,8 +28,8 @@ static Cartridge create(byte[] content, String name) throws UnsupportedROMFormat
if (cartName.indexOf("(SC)") >= 0) sc = true;
else if (cartName.indexOf("(NOSC)") >= 0) sc = false;
switch (content.length) {
- case CartridgeDisconnected.SIZE:
- cart = new CartridgeDisconnected(); break;
+ case 0:
+ return null;
case Cartridge4K.HALF_SIZE:
case Cartridge4K.SIZE:
cart = new Cartridge4K(content); break;
@@ -35,7 +35,7 @@
import atari.controls.ConsoleControlsRedefinitionListener;
import atari.controls.ConsoleControlsSocket;
-public class ConsolePanel extends SlickFrame implements ConsoleControls, ConsoleControlsInput, ConsoleControlsRedefinitionListener {
+public class extends SlickFrame implements ConsoleControls, ConsoleControlsInput, ConsoleControlsRedefinitionListener {
public ConsolePanel(JFrame masterWindow, Screen screen, ConsoleControlsSocket controlsSocket) {
super(false);
@@ -143,14 +143,14 @@ public void toggle() {
}
private void addHotspots() {
- addHotspot(
- new Rectangle(218, -13, 30, 15),
+ addHotspot(
+ new Rectangle(218, -13, 30, 15),
new Runnable() { @Override public void run() {
toggleRetract();
}});
addHotspot(
- new Rectangle(446, 4 - 137, 14, 13),
- new Runnable() { @Override public void run() {
+ new Rectangle(446, 4 - 137, 14, 13),
+ new Runnable() { @Override public void run() {
if (!docked) {
setVisible(false);
SwingUtilities.invokeLater(new Runnable() { @Override public void run() {
@@ -159,10 +159,10 @@ private void addHotspots() {
}
}});
addHotspot(
- new Rectangle(31, 52 - 137, 24, 46),
- new Runnable() { @Override public void run() {
+ new Rectangle(31, 52 - 137, 24, 46),
+ new Runnable() { @Override public void run() {
consoleControlsSocket.controlStateChanged(Control.POWER, true);
- updateVisibleControlsState();
+ updateVisibleControlsState();
}});
addHotspot(
new Rectangle(95, 52 - 137, 24, 46),
@@ -171,42 +171,48 @@ private void addHotspots() {
updateVisibleControlsState();
}});
addHotspot(
- new Rectangle(351, 52 - 137, 24, 46),
- new Runnable() { @Override public void run() {
+ new Rectangle(351, 52 - 137, 24, 46),
+ new Runnable() { @Override public void run() {
consoleControlsSocket.controlStateChanged(Control.SELECT, true);
- updateVisibleControlsState();
+ updateVisibleControlsState();
}},
- new Runnable() { @Override public void run() {
+ new Runnable() { @Override public void run() {
consoleControlsSocket.controlStateChanged(Control.SELECT, false);
- updateVisibleControlsState();
+ updateVisibleControlsState();
}});
addHotspot(
- new Rectangle(414, 52 - 137, 24, 46),
- new Runnable() { @Override public void run() {
+ new Rectangle(414, 52 - 137, 24, 46),
+ new Runnable() { @Override public void run() {
consoleControlsSocket.controlStateChanged(Control.RESET, true);
- updateVisibleControlsState();
+ updateVisibleControlsState();
}},
- new Runnable() { @Override public void run() {
+ new Runnable() { @Override public void run() {
consoleControlsSocket.controlStateChanged(Control.RESET, false);
- updateVisibleControlsState();
+ updateVisibleControlsState();
}});
addHotspot(
- new Rectangle(161, 4 - 137, 34, 21),
- new Runnable() { @Override public void run() {
+ new Rectangle(161, 4 - 137, 34, 21),
+ new Runnable() { @Override public void run() {
consoleControlsSocket.controlStateChanged(Control.DIFFICULTY0, true);
- updateVisibleControlsState();
+ updateVisibleControlsState();
}});
addHotspot(
- new Rectangle(274, 4 - 137, 34, 21),
- new Runnable() { @Override public void run() {
+ new Rectangle(274, 4 - 137, 34, 21),
+ new Runnable() { @Override public void run() {
consoleControlsSocket.controlStateChanged(Control.DIFFICULTY1, true);
- updateVisibleControlsState();
+ updateVisibleControlsState();
}});
addHotspot(
- new Rectangle(150, 52 - 137, 170, 45),
- new Runnable() { @Override public void run() {
+ new Rectangle(160, 52 - 135, 74, 43),
+ new Runnable() { @Override public void run() {
screen.controlStateChanged(pc.screen.Screen.Control.LOAD_CARTRIDGE_FILE, true);
- updateVisibleControlsState();
+ updateVisibleControlsState();
+ }});
+ addHotspot(
+ new Rectangle(150 + 85, 52 - 135, 74, 43),
+ new Runnable() { @Override public void run() {
+ screen.controlStateChanged(pc.screen.Screen.Control.LOAD_CARTRIDGE_URL, true);
+ updateVisibleControlsState();
}});
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3cef13a

Please sign in to comment.