/** Updates the debugger display. */ public void update() { memoryAddressValue = longTo16BitInt(memoryAddress.getState()); for (int i = 0; i < NUMBER_BREAKPOINTS; i++) { breakpointValues.set(i, longTo16BitInt(breakpoints[i].getState())); } cpu.setPC(longTo16BitInt(programCounter.getState())); log.fine("Debugger display updated"); }
/** * Creates a new debugger hardware object. * * @param cpu the CPU object */ public DebuggerHardware(final Intel8080A cpu) { log.fine("New DebuggerHardware creation started"); this.cpu = cpu; memoryAddress.addChangeListener(new UpdateMemoryDump()); for (int i = 0; i < NUMBER_MEMORY_DATA; i++) { memoryData[i] = new SiSDBlock(blockModel, 2, false, false); } for (int i = 0; i < NUMBER_BREAKPOINTS; i++) { breakpoints[i] = new SiSDBlock(blockModel, 4, false, true); breakpointValues.add(0xffff); } lookUpBCButton.addMouseListener(new LookUpBC()); lookUpDEButton.addMouseListener(new LookUpDE()); lookUpHLButton.addMouseListener(new LookUpHL()); lookUpSPButton.addMouseListener(new LookUpSP()); programCounter.addChangeListener(new UpdateDisassembly()); log.fine("New DebuggerHardware created"); }
/** Activates the debugger display. */ public void activate() { memoryAddress.setState(memoryAddressValue); memoryAddress.fireStateChanged(); registerA.setState(cpu.getA()); registerBC.setState(cpu.getBC()); registerDE.setState(cpu.getDE()); registerHL.setState(cpu.getHL()); registerSP.setState(cpu.getSP()); ledS.setState(cpu.isSF()); ledZ.setState(cpu.isZF()); ledAC.setState(cpu.isACF()); ledP.setState(cpu.isPF()); ledCY.setState(cpu.isCF()); ledIE.setState(cpu.isIE()); for (int i = 0; i < NUMBER_BREAKPOINTS; i++) { breakpoints[i].setState((long) breakpointValues.get(i)); } programCounter.setState(cpu.getPC()); programCounter.fireStateChanged(); log.fine("Debugger display activated"); }
// auxiliary look-up method private void lookUp(final SiSDBlock block) { if (!block.isBlank()) { memoryAddress.setState(block.getState()); memoryAddress.fireStateChanged(); } }
/** Deactivates (blanks) the debugger display. */ public void deactivate() { memoryAddress.setBlank(); for (SiSDBlock block : memoryData) { block.setBlank(); } registerA.setBlank(); registerBC.setBlank(); registerDE.setBlank(); registerHL.setBlank(); registerSP.setBlank(); ledS.setState(false); ledZ.setState(false); ledAC.setState(false); ledP.setState(false); ledCY.setState(false); ledIE.setState(false); for (SiSDBlock block : breakpoints) { block.setBlank(); } programCounter.setBlank(); instructionDisplay.setState(Application.getString(this, "running")); log.fine("Debugger display deactivated"); }