/**
* Update the display based on the current state of the CPU.
*/
public void updateState() {
Cpu cpu = machine.getCpu();
Cpu.CpuState cpuState = cpu.getCpuState();
// Update the Processor Status Flag display
int status = cpuState.getStatusFlag();
carryFlagLabel.setIcon(iconForFlag(status, 0));
zeroFlagLabel.setIcon(iconForFlag(status, 1));
irqDisableFlagLabel.setIcon(iconForFlag(status, 2));
decimalModeFlagLabel.setIcon(iconForFlag(status, 3));
breakFlagLabel.setIcon(iconForFlag(status, 4));
overflowFlagLabel.setIcon(iconForFlag(status, 6));
negativeFlagLabel.setIcon(iconForFlag(status, 7));
// Update the register and address displays
opcodeField.setText(cpu.getCpuState().disassembleOp());
pcField.setText(cpu.getProgramCounterStatus());
spField.setText(cpu.getStackPointerStatus());
aField.setText(cpu.getAccumulatorStatus());
xField.setText(cpu.getXRegisterStatus());
yField.setText(cpu.getYRegisterStatus());
repaint();
}