コード例 #1
0
 /** Called when the contents of the memory are changed through the memory gui. */
 public void valueChanged(ComputerPartEvent event) {
   short newValue = event.getValue();
   int newIndex = event.getIndex();
   clearErrorListeners();
   if ((newValue < minValue || newValue > maxValue) && newValue != nullValue) {
     notifyErrorListeners("Value must be in the range " + minValue + ".." + maxValue);
     quietUpdateGUI(newIndex, getValueAt(newIndex));
   } else setValueAt(newIndex, newValue, true);
 }
コード例 #2
0
ファイル: ROM.java プロジェクト: kingpinzs/nand2tetris-emu
 /** Called when the contents of the memory are changed through the memory gui. */
 public void valueChanged(ComputerPartEvent event) {
   short newValue = event.getValue();
   int newAddress = event.getIndex();
   clearErrorListeners();
   try {
     HackAssemblerTranslator.getInstance().codeToText(newValue);
     setValueAt(newAddress, newValue, true);
   } catch (AssemblerException ae) {
     notifyErrorListeners("Illegal instruction");
     quietUpdateGUI(newAddress, mem[newAddress]);
   }
 }