예제 #1
0
파일: IdeMain.java 프로젝트: aimozg/ja-dcpu
 private void breakpointHit(char pc) {
   registersModel.fireUpdate();
   memoryModel.fireUpdate(0, RAM_SIZE - 1); // TODO optimize
   Integer srcline = asmMap.bin2src(pc);
   if (srcline != null) {
     try {
       sourceTextarea.requestFocus();
       sourceTextarea.setCaretPosition(sourceTextarea.getLineStartOffset(srcline - 1));
     } catch (BadLocationException e) {
       e.printStackTrace();
     }
   }
 }
예제 #2
0
파일: IdeMain.java 프로젝트: aimozg/ja-dcpu
  private void toggleBreakpoint() {
    try {
      int lineno = sourceTextarea.getLineOfOffset(sourceTextarea.getCaretPosition()) + 1;
      Character asmaddr = asmMap.src2bin(lineno);
      if (srcBreakpoints.contains(lineno)) {
        srcBreakpoints.remove(lineno);
        if (asmaddr != null) debugger.setBreakpoint(asmaddr, false);
      } else {
        srcBreakpoints.add(lineno);
        if (asmaddr != null) debugger.setBreakpoint(asmaddr, true);
      }

      sourceRowHeader.breakpointChanged(lineno);
    } catch (BadLocationException e1) {
      e1.printStackTrace();
    }
  }
예제 #3
0
파일: IdeMain.java 프로젝트: aimozg/ja-dcpu
 private void assemble() {
   Assembler assembler = new Assembler();
   assembler.genMap = true;
   try {
     binary = new char[] {};
     binary = assembler.assemble(sourceTextarea.getText());
     cpu.upload(binary);
     memoryModel.fireUpdate(0, binary.length);
     asmMap = assembler.asmmap;
     for (Character addr : debugger.getBreakpoints()) {
       debugger.setBreakpoint(addr, false);
     }
     for (Integer breakpoint : srcBreakpoints) {
       Character addr = asmMap.src2bin(breakpoint);
       if (addr != null) { // TODO if null, mark breakpoint somehow
         debugger.setBreakpoint(addr, true);
       }
     }
   } catch (Exception ex) {
     JOptionPane.showMessageDialog(
         frame, "Compilation error " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
     ex.printStackTrace();
   }
 }