mirror of
https://github.com/sethm/symon.git
synced 2025-04-05 08:37:32 +00:00
Faster refresh of memory window
This commit is contained in:
parent
a7ea60d250
commit
40c5397ed8
@ -84,12 +84,12 @@ public class Simulator {
|
||||
// to refresh the status view on every simulated clock cycle. Instead, we will only refresh the status view
|
||||
// after this number of steps when running normally.
|
||||
//
|
||||
// Since we're simulating a 1MHz 6502 here, we have a 1 us delay between steps. Setting this to 10000
|
||||
// should give us a status update every 10 ms.
|
||||
// Since we're simulating a 1MHz 6502 here, we have a 1 us delay between steps. Setting this to 20000
|
||||
// should give us a status update about every 100 ms.
|
||||
//
|
||||
// TODO: Work around the event dispatch thread with custom painting code instead of relying on Swing.
|
||||
//
|
||||
private static final int MAX_STEPS_BETWEEN_UPDATES = 10000;
|
||||
private static final int MAX_STEPS_BETWEEN_UPDATES = 20000;
|
||||
|
||||
private final static Logger logger = Logger.getLogger(Simulator.class.getName());
|
||||
|
||||
@ -322,6 +322,7 @@ public class Simulator {
|
||||
public void run() {
|
||||
// Now update the state
|
||||
statusPane.updateState(cpu);
|
||||
memoryWindow.updateState();
|
||||
}
|
||||
});
|
||||
} catch (MemoryAccessException ex) {
|
||||
@ -343,6 +344,7 @@ public class Simulator {
|
||||
traceLog.refresh();
|
||||
}
|
||||
statusPane.updateState(cpu);
|
||||
memoryWindow.updateState();
|
||||
}
|
||||
});
|
||||
} catch (SymonException ex) {
|
||||
@ -390,6 +392,7 @@ public class Simulator {
|
||||
public void run() {
|
||||
// Now update the state
|
||||
statusPane.updateState(cpu);
|
||||
memoryWindow.updateState();
|
||||
}
|
||||
});
|
||||
stepsSinceLastUpdate = 0;
|
||||
@ -421,6 +424,7 @@ public class Simulator {
|
||||
public void run() {
|
||||
// Now update the state
|
||||
statusPane.updateState(cpu);
|
||||
memoryWindow.updateState();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -489,6 +493,7 @@ public class Simulator {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
statusPane.updateState(cpu);
|
||||
memoryWindow.updateState();
|
||||
runStopButton.setText("Run");
|
||||
stepButton.setEnabled(true);
|
||||
stepCountBox.setEnabled(true);
|
||||
|
@ -190,14 +190,14 @@ public class MemoryWindow extends JFrame implements ActionListener {
|
||||
if (currentPage > 0x00) {
|
||||
setPageNumber(currentPage - 1);
|
||||
updateControls();
|
||||
memoryTable.updateUI();
|
||||
updateState();
|
||||
}
|
||||
} else if (e.getSource() == nextPageButton) {
|
||||
int currentPage = getPageNumber();
|
||||
if (currentPage < 0xff) {
|
||||
setPageNumber(currentPage + 1);
|
||||
updateControls();
|
||||
memoryTable.updateUI();
|
||||
updateState();
|
||||
}
|
||||
} else if (e.getSource() == pageNumberTextField) {
|
||||
String pageNumberInput = pageNumberTextField.getText();
|
||||
@ -205,7 +205,7 @@ public class MemoryWindow extends JFrame implements ActionListener {
|
||||
// Try to parse a hex value out of the pageNumber.
|
||||
int newPageNumber = Integer.parseInt(pageNumberInput, 16);
|
||||
setPageNumber(newPageNumber & 0xff);
|
||||
memoryTable.updateUI();
|
||||
updateState();
|
||||
} catch (NumberFormatException ex) {
|
||||
// An invalid number was entered. Log the error, but otherwise
|
||||
// take no action.
|
||||
@ -216,6 +216,13 @@ public class MemoryWindow extends JFrame implements ActionListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the view of memory
|
||||
*/
|
||||
public void updateState() {
|
||||
memoryTable.updateUI();
|
||||
}
|
||||
|
||||
/**
|
||||
* A JTable that will automatically select all text in a cell
|
||||
* being edited.
|
||||
|
Loading…
x
Reference in New Issue
Block a user