Fixes and enhancements.
- Added ability to change inner border width of console window. - Fixed a nasty bug that prevented key press handling. - Reset now clears the accumulator and index registers.
This commit is contained in:
1 parent
e012d97bb3
commit
c214cc9b43
10 files changed
+220
-42
No files matched your search
@@ -44,7 +44,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.grahamedgecombe.jterminal</groupId>
|
<groupId>com.grahamedgecombe.jterminal</groupId>
|
||||||
<artifactId>jterminal</artifactId>
|
<artifactId>jterminal</artifactId>
|
||||||
<version>1.0.2-SNAPSHOT</version>
|
<version>1.0.2-loomcom</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,11 @@ public class Cpu implements InstructionTable {
|
|||||||
|
|
||||||
// Reset step counter
|
// Reset step counter
|
||||||
stepCounter = 0L;
|
stepCounter = 0L;
|
||||||
|
|
||||||
|
// Reset registers.
|
||||||
|
a = 0;
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void step(int num) throws MemoryAccessException {
|
public void step(int num) throws MemoryAccessException {
|
||||||
|
|||||||
@@ -8,11 +8,15 @@ public interface Preferences {
|
|||||||
|
|
||||||
public static final int DEFAULT_ACIA_ADDRESS = 0xc000;
|
public static final int DEFAULT_ACIA_ADDRESS = 0xc000;
|
||||||
|
|
||||||
|
public static final int DEFAULT_BORDER_WIDTH = 10;
|
||||||
|
|
||||||
public JDialog getDialog();
|
public JDialog getDialog();
|
||||||
|
|
||||||
public int getProgramStartAddress();
|
public int getProgramStartAddress();
|
||||||
|
|
||||||
public int getAciaAddress();
|
public int getAciaAddress();
|
||||||
|
|
||||||
|
public int getBorderWidth();
|
||||||
|
|
||||||
public void updateUi();
|
public void updateUi();
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ public class Simulator implements ActionListener, Observer {
|
|||||||
private JMenuItem loadMenuItem;
|
private JMenuItem loadMenuItem;
|
||||||
|
|
||||||
private JFileChooser fileChooser;
|
private JFileChooser fileChooser;
|
||||||
private Preferences preferences;
|
private PreferencesDialog preferences;
|
||||||
|
|
||||||
public Simulator() throws MemoryRangeException {
|
public Simulator() throws MemoryRangeException {
|
||||||
this.acia = new Acia(ACIA_BASE);
|
this.acia = new Acia(ACIA_BASE);
|
||||||
@@ -109,6 +109,7 @@ public class Simulator implements ActionListener, Observer {
|
|||||||
// File Chooser
|
// File Chooser
|
||||||
fileChooser = new JFileChooser();
|
fileChooser = new JFileChooser();
|
||||||
preferences = new PreferencesDialog(mainWindow, true);
|
preferences = new PreferencesDialog(mainWindow, true);
|
||||||
|
preferences.addObserver(this);
|
||||||
|
|
||||||
// Panel for Console and Buttons
|
// Panel for Console and Buttons
|
||||||
JPanel controlsContainer = new JPanel();
|
JPanel controlsContainer = new JPanel();
|
||||||
@@ -203,6 +204,8 @@ public class Simulator implements ActionListener, Observer {
|
|||||||
} else if (actionEvent.getSource() == stepButton) {
|
} else if (actionEvent.getSource() == stepButton) {
|
||||||
handleStep();
|
handleStep();
|
||||||
} else if (actionEvent.getSource() == runStopButton) {
|
} else if (actionEvent.getSource() == runStopButton) {
|
||||||
|
// Shift focus to the console.
|
||||||
|
console.requestFocus();
|
||||||
if (runLoop != null && runLoop.isRunning()) {
|
if (runLoop != null && runLoop.isRunning()) {
|
||||||
runLoop.requestStop();
|
runLoop.requestStop();
|
||||||
runLoop.interrupt();
|
runLoop.interrupt();
|
||||||
@@ -327,19 +330,10 @@ public class Simulator implements ActionListener, Observer {
|
|||||||
// Read from the ACIA and immediately update the console if there's
|
// Read from the ACIA and immediately update the console if there's
|
||||||
// output ready.
|
// output ready.
|
||||||
if (acia.hasTxChar()) {
|
if (acia.hasTxChar()) {
|
||||||
try {
|
// This is thread-safe
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
console.print(Character.toString((char)acia.txRead()));
|
console.print(Character.toString((char)acia.txRead()));
|
||||||
console.repaint();
|
console.repaint();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a key has been pressed, fill the ACIA.
|
// If a key has been pressed, fill the ACIA.
|
||||||
// TODO: Interrupt handling.
|
// TODO: Interrupt handling.
|
||||||
@@ -414,8 +408,14 @@ public class Simulator implements ActionListener, Observer {
|
|||||||
public void update(Observable observable, Object o) {
|
public void update(Observable observable, Object o) {
|
||||||
// Instance equality should work here, there is only one instance.
|
// Instance equality should work here, there is only one instance.
|
||||||
if (observable == preferences) {
|
if (observable == preferences) {
|
||||||
// TODO: Update system based on state. (i.e., update ACIA address, and raise a dialog if it
|
// TODO: Update ACIA base address if it has changed.
|
||||||
// overlaps with anything)
|
|
||||||
|
int oldBorderWidth = console.getBorderWidth();
|
||||||
|
if (oldBorderWidth != preferences.getBorderWidth()) {
|
||||||
|
// Resize the main window if the border width has changed.
|
||||||
|
console.setBorderWidth(preferences.getBorderWidth());
|
||||||
|
mainWindow.pack();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.awt.event.MouseEvent;
|
|||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
|
|
||||||
import com.grahamedgecombe.jterminal.JTerminal;
|
import com.grahamedgecombe.jterminal.JTerminal;
|
||||||
|
import com.grahamedgecombe.jterminal.vt100.Vt100TerminalModel;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.BevelBorder;
|
import javax.swing.border.BevelBorder;
|
||||||
@@ -18,11 +19,20 @@ import javax.swing.border.Border;
|
|||||||
|
|
||||||
public class Console extends JTerminal implements KeyListener, MouseListener {
|
public class Console extends JTerminal implements KeyListener, MouseListener {
|
||||||
|
|
||||||
|
private static final int DEFAULT_COLUMNS = 80;
|
||||||
|
private static final int DEFAULT_ROWS = 24;
|
||||||
|
private static final int DEFAULT_BORDER_WIDTH = 10;
|
||||||
|
|
||||||
private boolean hasInput = false;
|
private boolean hasInput = false;
|
||||||
private char keyBuffer;
|
private char keyBuffer;
|
||||||
|
|
||||||
public Console() {
|
public Console() {
|
||||||
super();
|
this(DEFAULT_COLUMNS, DEFAULT_ROWS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Console(int columns, int rows) {
|
||||||
|
super(new Vt100TerminalModel(columns, rows));
|
||||||
|
setBorderWidth(DEFAULT_BORDER_WIDTH);
|
||||||
addKeyListener(this);
|
addKeyListener(this);
|
||||||
addMouseListener(this);
|
addMouseListener(this);
|
||||||
Border emptyBorder = BorderFactory.createEmptyBorder(5, 5, 5, 0);
|
Border emptyBorder = BorderFactory.createEmptyBorder(5, 5, 5, 0);
|
||||||
@@ -31,6 +41,11 @@ public class Console extends JTerminal implements KeyListener, MouseListener {
|
|||||||
this.setBorder(compoundBorder);
|
this.setBorder(compoundBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the console. This will cause the console to be cleared and the cursor returned to the
|
||||||
|
* home position.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public void reset() {
|
public void reset() {
|
||||||
getModel().clear();
|
getModel().clear();
|
||||||
getModel().setCursorColumn(0);
|
getModel().setCursorColumn(0);
|
||||||
@@ -39,28 +54,50 @@ public class Console extends JTerminal implements KeyListener, MouseListener {
|
|||||||
this.hasInput = false;
|
this.hasInput = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void keyTyped(KeyEvent keyEvent) {
|
/**
|
||||||
keyEvent.consume();
|
* Returns true if a key has been pressed since the last time input was read.
|
||||||
}
|
*
|
||||||
|
* @return
|
||||||
public void keyPressed(KeyEvent keyEvent) {
|
*/
|
||||||
keyBuffer = keyEvent.getKeyChar();
|
|
||||||
hasInput = true;
|
|
||||||
|
|
||||||
System.out.println("Key Pressed (0x" + Integer.toString((int)keyBuffer, 16) + ") : " + keyBuffer);
|
|
||||||
|
|
||||||
keyEvent.consume();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasInput() {
|
public boolean hasInput() {
|
||||||
return hasInput;
|
return hasInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle a Key Typed event.
|
||||||
|
*
|
||||||
|
* @param keyEvent The key event.
|
||||||
|
*/
|
||||||
|
public void keyTyped(KeyEvent keyEvent) {
|
||||||
|
keyEvent.consume();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle a Key Press event.
|
||||||
|
*
|
||||||
|
* @param keyEvent The key event.
|
||||||
|
*/
|
||||||
|
public void keyPressed(KeyEvent keyEvent) {
|
||||||
|
keyBuffer = keyEvent.getKeyChar();
|
||||||
|
hasInput = true;
|
||||||
|
keyEvent.consume();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the most recently typed key from the single-char input buffer.
|
||||||
|
*
|
||||||
|
* @return The character typed.
|
||||||
|
*/
|
||||||
public char readInputChar() {
|
public char readInputChar() {
|
||||||
hasInput = false;
|
hasInput = false;
|
||||||
return this.keyBuffer;
|
return this.keyBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle a key release event.
|
||||||
|
*
|
||||||
|
* @param keyEvent The key event.
|
||||||
|
*/
|
||||||
public void keyReleased(KeyEvent keyEvent) {
|
public void keyReleased(KeyEvent keyEvent) {
|
||||||
keyEvent.consume();
|
keyEvent.consume();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ public class PreferencesDialog extends Observable implements Preferences {
|
|||||||
|
|
||||||
private JTextField aciaAddressField;
|
private JTextField aciaAddressField;
|
||||||
private JTextField programLoadAddressField;
|
private JTextField programLoadAddressField;
|
||||||
|
private JTextField borderWidthField;
|
||||||
|
|
||||||
private int programLoadAddress = DEFAULT_PROGRAM_LOAD_ADDRESS;
|
private int programLoadAddress = DEFAULT_PROGRAM_LOAD_ADDRESS;
|
||||||
private int aciaAddress = DEFAULT_ACIA_ADDRESS;
|
private int aciaAddress = DEFAULT_ACIA_ADDRESS;
|
||||||
|
private int borderWidth = DEFAULT_BORDER_WIDTH;
|
||||||
|
|
||||||
public PreferencesDialog(Frame parent, boolean modal) {
|
public PreferencesDialog(Frame parent, boolean modal) {
|
||||||
this.dialog = new JDialog(parent, modal);
|
this.dialog = new JDialog(parent, modal);
|
||||||
@@ -28,6 +30,9 @@ public class PreferencesDialog extends Observable implements Preferences {
|
|||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Validation of input.
|
||||||
|
*/
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
dialog.setTitle("Preferences");
|
dialog.setTitle("Preferences");
|
||||||
Container contents = dialog.getContentPane();
|
Container contents = dialog.getContentPane();
|
||||||
@@ -40,12 +45,15 @@ public class PreferencesDialog extends Observable implements Preferences {
|
|||||||
|
|
||||||
final JLabel aciaAddressLabel = new JLabel("ACIA Address");
|
final JLabel aciaAddressLabel = new JLabel("ACIA Address");
|
||||||
final JLabel programLoadAddressLabel = new JLabel("Program Load Address");
|
final JLabel programLoadAddressLabel = new JLabel("Program Load Address");
|
||||||
|
final JLabel borderWidthLabel = new JLabel("Console Border Width");
|
||||||
|
|
||||||
aciaAddressField = new JTextField(8);
|
aciaAddressField = new JTextField(8);
|
||||||
programLoadAddressField = new JTextField(8);
|
programLoadAddressField = new JTextField(8);
|
||||||
|
borderWidthField = new JTextField(8);
|
||||||
|
|
||||||
aciaAddressLabel.setLabelFor(aciaAddressField);
|
aciaAddressLabel.setLabelFor(aciaAddressField);
|
||||||
programLoadAddressLabel.setLabelFor(programLoadAddressField);
|
programLoadAddressLabel.setLabelFor(programLoadAddressField);
|
||||||
|
borderWidthLabel.setLabelFor(borderWidthField);
|
||||||
|
|
||||||
GridBagConstraints constraints = new GridBagConstraints();
|
GridBagConstraints constraints = new GridBagConstraints();
|
||||||
|
|
||||||
@@ -66,6 +74,13 @@ public class PreferencesDialog extends Observable implements Preferences {
|
|||||||
constraints.gridx = 1;
|
constraints.gridx = 1;
|
||||||
settingsContainer.add(programLoadAddressField, constraints);
|
settingsContainer.add(programLoadAddressField, constraints);
|
||||||
|
|
||||||
|
constraints.gridy = 2;
|
||||||
|
constraints.gridx = 0;
|
||||||
|
settingsContainer.add(borderWidthLabel, constraints);
|
||||||
|
|
||||||
|
constraints.gridx = 1;
|
||||||
|
settingsContainer.add(borderWidthField, constraints);
|
||||||
|
|
||||||
JButton applyButton = new JButton("Apply");
|
JButton applyButton = new JButton("Apply");
|
||||||
JButton cancelButton = new JButton("Cancel");
|
JButton cancelButton = new JButton("Cancel");
|
||||||
|
|
||||||
@@ -81,8 +96,11 @@ public class PreferencesDialog extends Observable implements Preferences {
|
|||||||
public void actionPerformed(ActionEvent actionEvent) {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
programLoadAddress = hexToInt(programLoadAddressField.getText());
|
programLoadAddress = hexToInt(programLoadAddressField.getText());
|
||||||
aciaAddress = hexToInt(aciaAddressField.getText());
|
aciaAddress = hexToInt(aciaAddressField.getText());
|
||||||
|
borderWidth = Integer.parseInt(borderWidthField.getText());
|
||||||
updateUi();
|
updateUi();
|
||||||
notifyObservers();
|
// TODO: Actually check to see if values have changed, don't assume.
|
||||||
|
setChanged();
|
||||||
|
PreferencesDialog.this.notifyObservers();
|
||||||
dialog.setVisible(false);
|
dialog.setVisible(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -96,6 +114,27 @@ public class PreferencesDialog extends Observable implements Preferences {
|
|||||||
dialog.pack();
|
dialog.pack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getProgramStartAddress() {
|
||||||
|
return programLoadAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAciaAddress() {
|
||||||
|
return aciaAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The width of the console border, in pixels.
|
||||||
|
*/
|
||||||
|
public int getBorderWidth() {
|
||||||
|
return borderWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateUi() {
|
||||||
|
aciaAddressField.setText(intToHex(aciaAddress));
|
||||||
|
programLoadAddressField.setText(intToHex(programLoadAddress));
|
||||||
|
borderWidthField.setText(Integer.toString(borderWidth));
|
||||||
|
}
|
||||||
|
|
||||||
private String intToHex(int i) {
|
private String intToHex(int i) {
|
||||||
return String.format("%04x", i);
|
return String.format("%04x", i);
|
||||||
}
|
}
|
||||||
@@ -109,16 +148,4 @@ public class PreferencesDialog extends Observable implements Preferences {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgramStartAddress() {
|
|
||||||
return programLoadAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAciaAddress() {
|
|
||||||
return aciaAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateUi() {
|
|
||||||
aciaAddressField.setText(intToHex(aciaAddress));
|
|
||||||
programLoadAddressField.setText(intToHex(programLoadAddress));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -401,6 +401,8 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -411,6 +413,8 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -421,6 +425,8 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -431,6 +437,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
bus.loadProgram(0xa9, 0x00, // LDA #$00
|
bus.loadProgram(0xa9, 0x00, // LDA #$00
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -441,6 +448,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -451,6 +459,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -461,6 +470,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -506,6 +516,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x49, // LDA #$49
|
0xa9, 0x49, // LDA #$49
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
@@ -517,6 +528,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x50, // LDA #$50
|
0xa9, 0x50, // LDA #$50
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
@@ -528,6 +540,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x99, // LDA #$99
|
0xa9, 0x99, // LDA #$99
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
@@ -539,6 +552,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x00, // LDA #$00
|
0xa9, 0x00, // LDA #$00
|
||||||
0x7d, 0x11, 0xab); // ADC $ab10,X
|
0x7d, 0x11, 0xab); // ADC $ab10,X
|
||||||
@@ -550,6 +564,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x49, // LDA #$49
|
0xa9, 0x49, // LDA #$49
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
@@ -561,6 +576,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x50, // LDA #$59
|
0xa9, 0x50, // LDA #$59
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
@@ -666,6 +682,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getNegativeFlag());
|
assertFalse(cpu.getNegativeFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
cpu.setAccumulator(0x0f);
|
cpu.setAccumulator(0x0f);
|
||||||
bus.loadProgram(0x9d, 0x10, 0xab); // STA $ab10,X
|
bus.loadProgram(0x9d, 0x10, 0xab); // STA $ab10,X
|
||||||
@@ -675,6 +692,7 @@ public class CpuAbsoluteXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getNegativeFlag());
|
assertFalse(cpu.getNegativeFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
cpu.setAccumulator(0x80);
|
cpu.setAccumulator(0x80);
|
||||||
bus.loadProgram(0x9d, 0x10, 0xab); // STA $ab10,X
|
bus.loadProgram(0x9d, 0x10, 0xab); // STA $ab10,X
|
||||||
|
|||||||
@@ -206,6 +206,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
||||||
0x79, 0x10, 0xab); // ADC $ab10,Y
|
0x79, 0x10, 0xab); // ADC $ab10,Y
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -216,6 +218,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
||||||
0x79, 0x10, 0xab); // ADC $ab10,Y
|
0x79, 0x10, 0xab); // ADC $ab10,Y
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -226,6 +230,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
||||||
0x79, 0x10, 0xab); // ADC $ab10,Y
|
0x79, 0x10, 0xab); // ADC $ab10,Y
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -236,6 +242,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x00, // LDA #$00
|
bus.loadProgram(0xa9, 0x00, // LDA #$00
|
||||||
0x79, 0x11, 0xab); // ADC $ab11,Y
|
0x79, 0x11, 0xab); // ADC $ab11,Y
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -246,6 +254,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
||||||
0x79, 0x11, 0xab); // ADC $ab11,Y
|
0x79, 0x11, 0xab); // ADC $ab11,Y
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -256,6 +266,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
||||||
0x79, 0x11, 0xab); // ADC $ab11,Y
|
0x79, 0x11, 0xab); // ADC $ab11,Y
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -266,6 +278,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
||||||
0x79, 0x11, 0xab); // ADC $ab11,Y
|
0x79, 0x11, 0xab); // ADC $ab11,Y
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -311,6 +325,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x49, // LDA #$49
|
0xa9, 0x49, // LDA #$49
|
||||||
0x79, 0x10, 0xab); // ADC $ab10,Y
|
0x79, 0x10, 0xab); // ADC $ab10,Y
|
||||||
@@ -322,6 +338,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x50, // LDA #$50
|
0xa9, 0x50, // LDA #$50
|
||||||
0x79, 0x10, 0xab); // ADC $ab10,Y
|
0x79, 0x10, 0xab); // ADC $ab10,Y
|
||||||
@@ -333,6 +351,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x99, // LDA #$99
|
0xa9, 0x99, // LDA #$99
|
||||||
0x79, 0x10, 0xab); // ADC $ab10,Y
|
0x79, 0x10, 0xab); // ADC $ab10,Y
|
||||||
@@ -344,6 +364,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x00, // LDA #$00
|
0xa9, 0x00, // LDA #$00
|
||||||
0x79, 0x11, 0xab); // ADC $ab10,Y
|
0x79, 0x11, 0xab); // ADC $ab10,Y
|
||||||
@@ -355,6 +377,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x49, // LDA #$49
|
0xa9, 0x49, // LDA #$49
|
||||||
0x79, 0x11, 0xab); // ADC $ab11,Y
|
0x79, 0x11, 0xab); // ADC $ab11,Y
|
||||||
@@ -366,6 +390,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x50, // LDA #$59
|
0xa9, 0x50, // LDA #$59
|
||||||
0x79, 0x11, 0xab); // ADC $ab11,Y
|
0x79, 0x11, 0xab); // ADC $ab11,Y
|
||||||
@@ -390,6 +416,8 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getNegativeFlag());
|
assertFalse(cpu.getNegativeFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
|
|
||||||
cpu.setAccumulator(0x0f);
|
cpu.setAccumulator(0x0f);
|
||||||
bus.loadProgram(0x99, 0x10, 0xab); // STA $ab10,Y
|
bus.loadProgram(0x99, 0x10, 0xab); // STA $ab10,Y
|
||||||
@@ -399,6 +427,7 @@ public class CpuAbsoluteYModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getNegativeFlag());
|
assertFalse(cpu.getNegativeFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setYRegister(0x30);
|
||||||
|
|
||||||
cpu.setAccumulator(0x80);
|
cpu.setAccumulator(0x80);
|
||||||
bus.loadProgram(0x99, 0x10, 0xab); // STA $ab10,Y
|
bus.loadProgram(0x99, 0x10, 0xab); // STA $ab10,Y
|
||||||
|
|||||||
@@ -206,6 +206,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -216,6 +218,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -226,6 +230,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -236,6 +242,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x00, // LDA #$00
|
bus.loadProgram(0xa9, 0x00, // LDA #$00
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -246,6 +254,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -256,6 +266,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -266,6 +278,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -311,6 +325,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x49, // LDA #$49
|
0xa9, 0x49, // LDA #$49
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
@@ -322,6 +338,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x50, // LDA #$50
|
0xa9, 0x50, // LDA #$50
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
@@ -333,6 +351,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x99, // LDA #$99
|
0xa9, 0x99, // LDA #$99
|
||||||
0x7d, 0x10, 0xab); // ADC $ab10,X
|
0x7d, 0x10, 0xab); // ADC $ab10,X
|
||||||
@@ -344,6 +364,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x00, // LDA #$00
|
0xa9, 0x00, // LDA #$00
|
||||||
0x7d, 0x11, 0xab); // ADC $ab10,X
|
0x7d, 0x11, 0xab); // ADC $ab10,X
|
||||||
@@ -355,6 +377,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x49, // LDA #$49
|
0xa9, 0x49, // LDA #$49
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
@@ -366,6 +390,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x50, // LDA #$59
|
0xa9, 0x50, // LDA #$59
|
||||||
0x7d, 0x11, 0xab); // ADC $ab11,X
|
0x7d, 0x11, 0xab); // ADC $ab11,X
|
||||||
@@ -390,6 +416,8 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getNegativeFlag());
|
assertFalse(cpu.getNegativeFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
|
|
||||||
cpu.setAccumulator(0x0f);
|
cpu.setAccumulator(0x0f);
|
||||||
bus.loadProgram(0x9d, 0x10, 0xab); // STA $ab10,X
|
bus.loadProgram(0x9d, 0x10, 0xab); // STA $ab10,X
|
||||||
@@ -399,6 +427,7 @@ public class CpuIndirectXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getNegativeFlag());
|
assertFalse(cpu.getNegativeFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
cpu.setAccumulator(0x80);
|
cpu.setAccumulator(0x80);
|
||||||
bus.loadProgram(0x9d, 0x10, 0xab); // STA $ab10,X
|
bus.loadProgram(0x9d, 0x10, 0xab); // STA $ab10,X
|
||||||
|
|||||||
@@ -423,6 +423,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
||||||
0x75, 0x10); // ADC $10,X
|
0x75, 0x10); // ADC $10,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -433,6 +435,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
||||||
0x75, 0x10); // ADC $10,X
|
0x75, 0x10); // ADC $10,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -443,6 +447,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
||||||
0x75, 0x10); // ADC $10,X
|
0x75, 0x10); // ADC $10,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -453,6 +459,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x00, // LDA #$00
|
bus.loadProgram(0xa9, 0x00, // LDA #$00
|
||||||
0x75, 0x11); // ADC $11,X
|
0x75, 0x11); // ADC $11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -463,6 +471,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
bus.loadProgram(0xa9, 0x7f, // LDA #$7f
|
||||||
0x75, 0x11); // ADC $11,X
|
0x75, 0x11); // ADC $11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -473,6 +483,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
bus.loadProgram(0xa9, 0x80, // LDA #$80
|
||||||
0x75, 0x11); // ADC $11,X
|
0x75, 0x11); // ADC $11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -483,6 +495,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
bus.loadProgram(0xa9, 0xff, // LDA #$ff
|
||||||
0x75, 0x11); // ADC $11,X
|
0x75, 0x11); // ADC $11,X
|
||||||
cpu.step(2);
|
cpu.step(2);
|
||||||
@@ -528,6 +542,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x49, // LDA #$49
|
0xa9, 0x49, // LDA #$49
|
||||||
0x75, 0x10); // ADC $10,X
|
0x75, 0x10); // ADC $10,X
|
||||||
@@ -539,6 +555,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x50, // LDA #$50
|
0xa9, 0x50, // LDA #$50
|
||||||
0x75, 0x10); // ADC $10,X
|
0x75, 0x10); // ADC $10,X
|
||||||
@@ -550,6 +568,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x99, // LDA #$99
|
0xa9, 0x99, // LDA #$99
|
||||||
0x75, 0x10); // ADC $10,X
|
0x75, 0x10); // ADC $10,X
|
||||||
@@ -561,6 +581,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x00, // LDA #$00
|
0xa9, 0x00, // LDA #$00
|
||||||
0x75, 0x11); // ADC $10,X
|
0x75, 0x11); // ADC $10,X
|
||||||
@@ -572,6 +594,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getCarryFlag());
|
assertFalse(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x49, // LDA #$49
|
0xa9, 0x49, // LDA #$49
|
||||||
0x75, 0x11); // ADC $11,X
|
0x75, 0x11); // ADC $11,X
|
||||||
@@ -583,6 +607,8 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertTrue(cpu.getCarryFlag());
|
assertTrue(cpu.getCarryFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
bus.loadProgram(0xf8, // SED
|
bus.loadProgram(0xf8, // SED
|
||||||
0xa9, 0x50, // LDA #$59
|
0xa9, 0x50, // LDA #$59
|
||||||
0x75, 0x11); // ADC $11,X
|
0x75, 0x11); // ADC $11,X
|
||||||
@@ -679,7 +705,6 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
|
|
||||||
public void test_STY() throws MemoryAccessException {
|
public void test_STY() throws MemoryAccessException {
|
||||||
cpu.setXRegister(0x30);
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
cpu.setYRegister(0x00);
|
cpu.setYRegister(0x00);
|
||||||
bus.loadProgram(0x94, 0x10); // STY $10,X
|
bus.loadProgram(0x94, 0x10); // STY $10,X
|
||||||
cpu.step();
|
cpu.step();
|
||||||
@@ -689,6 +714,7 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
cpu.setYRegister(0x0f);
|
cpu.setYRegister(0x0f);
|
||||||
bus.loadProgram(0x94, 0x10); // STY $10,X
|
bus.loadProgram(0x94, 0x10); // STY $10,X
|
||||||
cpu.step();
|
cpu.step();
|
||||||
@@ -698,6 +724,7 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
cpu.setYRegister(0x80);
|
cpu.setYRegister(0x80);
|
||||||
bus.loadProgram(0x94, 0x10); // STY $10,X
|
bus.loadProgram(0x94, 0x10); // STY $10,X
|
||||||
cpu.step();
|
cpu.step();
|
||||||
@@ -719,6 +746,7 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getNegativeFlag());
|
assertFalse(cpu.getNegativeFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
cpu.setAccumulator(0x0f);
|
cpu.setAccumulator(0x0f);
|
||||||
bus.loadProgram(0x95, 0x10); // STA $10,X
|
bus.loadProgram(0x95, 0x10); // STA $10,X
|
||||||
@@ -728,6 +756,7 @@ public class CpuZeroPageXModeTest extends TestCase {
|
|||||||
assertFalse(cpu.getNegativeFlag());
|
assertFalse(cpu.getNegativeFlag());
|
||||||
|
|
||||||
cpu.reset();
|
cpu.reset();
|
||||||
|
cpu.setXRegister(0x30);
|
||||||
|
|
||||||
cpu.setAccumulator(0x80);
|
cpu.setAccumulator(0x80);
|
||||||
bus.loadProgram(0x95, 0x10); // STA $10,X
|
bus.loadProgram(0x95, 0x10); // STA $10,X
|
||||||
|
|||||||
Reference in new issue
Block a user