Пример #1
0
  public Object getValueAt(int row, int column) {
    Object res = "";
    int memLoc = rowToMemLoc(row);
    switch (column) {
      case C_ADDRESS:
        res = Utils.asHex(memLoc);
        break;

      case C_VALUE:
        res = Utils.asHex(memory.getAt(memLoc));
        break;

      case C_REGPTRS:
        {
          String pc, sp, mp;
          pc = sp = mp = "";
          if (memLoc == registers.getReg(Registers.PC)) pc = " PC";
          if (memLoc == registers.getReg(Registers.SP)) sp = " SP";
          if (memLoc == registers.getReg(Registers.MP)) mp = " MP";
          res = pc + sp + mp;
        }
        break;

      case C_ANNOTE:
        MemoryAnnotation ann = memory.getAnnotationAt(memLoc);
        res = ann == null ? ColoredText.blankDefault : ann;
        break;
    }
    return res;
  }
Пример #2
0
 public void reset() {
   if (memory != null) memory.removeMemoryCellListener(this);
   if (registers != null) registers.removeMemoryCellListener(this);
   memory = machineState.getMemory();
   registers = machineState.getRegisters();
   memory.addMemoryCellListener(this);
   registers.addMemoryCellListener(this);
   startAddressOfStack = maxAccessedSP = registers.getReg(Registers.SP);
   fireTableChanged(new TableModelEvent(this));
 }
Пример #3
0
  public void setValueAt(Object aValue, int row, int column) {
    if (column == C_VALUE) {
      String strValue = null;

      if (aValue instanceof String) strValue = (String) aValue;
      else strValue = aValue.toString();

      memory.setAt(rowToMemLoc(row), strValue);
    }
  }