Tooltip Text and Minor Enhancements

- Added tooltip text to status panel.
- Memory is no longer cleared on reset.
- Console can now receive key-strokes even while the simulator is
  stopped (for single-stepping programs that require interaction)
- Updated screenshots with bug-fixed version.
This commit is contained in:
Seth Morabito committed 2013-01-12 11:41:32 -08:00
1 parent 34fb8940ae
commit 4ccb7bec97
12 files changed
+45 -34

No files matched your search

@@ -270,10 +270,9 @@ public class Simulator implements Observer {
}
try {
logger.log(Level.INFO, "Cold reset requested. Resetting CPU and clearing memory.");
logger.log(Level.INFO, "Reset requested. Resetting CPU.");
// Reset and clear memory
cpu.reset();
ram.fill(0x00);
// Clear the console.
console.reset();
// Reset the trace log.
@@ -440,8 +439,6 @@ public class Simulator implements Observer {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
// Tell the console to start handling key presses
console.startListening();
// Don't allow step while the simulator is running
stepButton.setEnabled(false);
menuBar.simulatorDidStart();
+12 -26
View File
@@ -55,9 +55,6 @@ public class Console extends JTerminal implements KeyListener, MouseListener {
// If true, send CRLF (0x0d 0x0a) whenever CR is typed
private static final boolean SEND_CR_LF_FOR_CR = false;
// If true, the console is actively listening for key input.
private boolean isListening;
private FifoRingBuffer<Character> typeAheadBuffer;
public Console(int columns, int rows, Font font) {
@@ -65,7 +62,6 @@ public class Console extends JTerminal implements KeyListener, MouseListener {
// A small type-ahead buffer, as might be found in any real
// VT100-style serial terminal.
this.typeAheadBuffer = new FifoRingBuffer<Character>(128);
this.isListening = false;
setBorderWidth(DEFAULT_BORDER_WIDTH);
addKeyListener(this);
addMouseListener(this);
@@ -87,14 +83,6 @@ public class Console extends JTerminal implements KeyListener, MouseListener {
repaint();
}
public void startListening() {
this.isListening = true;
}
public void stopListening() {
this.isListening = false;
}
/**
* Returns true if a key has been pressed since the last time input was read.
*
@@ -110,23 +98,21 @@ public class Console extends JTerminal implements KeyListener, MouseListener {
* @param keyEvent The key event.
*/
public void keyTyped(KeyEvent keyEvent) {
if (isListening) {
char keyTyped = keyEvent.getKeyChar();
char keyTyped = keyEvent.getKeyChar();
if (SWAP_CR_AND_LF) {
if (keyTyped == 0x0a) {
keyTyped = 0x0d;
} else if (keyTyped == 0x0d) {
keyTyped = 0x0a;
}
if (SWAP_CR_AND_LF) {
if (keyTyped == 0x0a) {
keyTyped = 0x0d;
} else if (keyTyped == 0x0d) {
keyTyped = 0x0a;
}
}
if (SEND_CR_LF_FOR_CR && keyTyped == 0x0d) {
typeAheadBuffer.push((char) 0x0d);
typeAheadBuffer.push((char) 0x0a);
} else {
typeAheadBuffer.push(keyTyped);
}
if (SEND_CR_LF_FOR_CR && keyTyped == 0x0d) {
typeAheadBuffer.push((char) 0x0d);
typeAheadBuffer.push((char) 0x0a);
} else {
typeAheadBuffer.push(keyTyped);
}
keyEvent.consume();
@@ -122,6 +122,18 @@ public class StatusPanel extends JPanel {
overflowFlagLabel = new JLabel(overflowOff, JLabel.CENTER);
negativeFlagLabel = new JLabel(negativeOff, JLabel.CENTER);
// Add tool-tip text
carryFlagLabel.setToolTipText("Carry: The last operation caused an overflow " +
"from bit 7 of the result or an underflow from bit 0");
zeroFlagLabel.setToolTipText("Zero: The result of the last operation was 0");
irqDisableFlagLabel.setToolTipText("Interrupt Disable: Processor will not respond to IRQ");
decimalModeFlagLabel.setToolTipText("Decimal Mode");
breakFlagLabel.setToolTipText("Break: BRK instruction occurred");
overflowFlagLabel.setToolTipText("Overflow: The result of the last operation was " +
"an invalid 2's complement result");
negativeFlagLabel.setToolTipText("Negative: The result of the last operation set bit 7");
statusFlagsPanel.add(negativeFlagLabel);
statusFlagsPanel.add(overflowFlagLabel);
statusFlagsPanel.add(breakFlagLabel);
@@ -139,6 +151,11 @@ public class StatusPanel extends JPanel {
xLabel = makeLabel("X");
yLabel = makeLabel("Y");
statusFlagsLabel.setToolTipText("6502 Processor Status Flags");
opcodeLabel.setToolTipText("Instruction Register");
pcLabel.setToolTipText("Program Counter");
spLabel.setToolTipText("Stack Pointer");
opcodeField = makeTextField(LARGE_TEXT_FIELD_SIZE);
pcField = makeTextField(LARGE_TEXT_FIELD_SIZE);
spField = makeTextField(SMALL_TEXT_FIELD_SIZE);