/** Constructs a new RegisterWithGUI. */
 public RegisterWithGUI() {
   if (GatesManager.getInstance().isChipsGUIEnabled()) {
     gui = new RegisterComponent();
     gui.setName("Reg:");
     gui.setLocation(180, 10);
     gui.reset();
     gui.addListener(this);
     gui.addErrorListener(this);
   }
 }
Esempio n. 2
0
  // Initialization of this component.
  private void jbInit() {
    this.setLayout(null);
    pc.setBounds(new Rectangle(35, 527, pc.getWidth(), pc.getHeight()));
    a.setBounds(new Rectangle(278, 527, a.getWidth(), a.getHeight()));
    d.setBounds(new Rectangle(646, 351, d.getWidth(), d.getHeight()));
    screen.setToolTipText("Screen");
    screen.setBounds(new Rectangle(476, 25, screen.getWidth(), screen.getHeight()));
    keyboard.setBounds(new Rectangle(476, 285, keyboard.getWidth(), keyboard.getHeight()));
    ram.setVisibleRows(29);
    ram.setBounds(new Rectangle(264, 25, ram.getWidth(), ram.getHeight()));
    rom.setVisibleRows(29);
    rom.setBounds(new Rectangle(20, 25, rom.getWidth(), rom.getHeight()));
    alu.setBounds(new Rectangle(551, 414, alu.getWidth(), alu.getHeight()));

    bus.setBounds(new Rectangle(0, 0, EMULATOR_WIDTH, EMULATOR_HEIGHT));

    this.add(bus, null);
    this.add(ram, null);
    this.add(screen, null);
    this.add(rom, null);
    this.add(a, null);
    this.add(pc, null);
    this.add(keyboard, null);
    this.add(alu, null);
    this.add(d, null);
    setSize(EMULATOR_WIDTH, EMULATOR_HEIGHT);
  }
 protected void clockUp() {
   short in = inputPins[0].get(); // 16 bit input
   short load = inputPins[1].get(); // load bit
   if (load == 1) {
     value = in;
     if (gui != null) gui.setValueAt(0, value);
   }
 }
 // updates the given value
 private void updateValue(short newValue) {
   value = newValue;
   outputPins[0].set(newValue);
   evalParent();
   if (gui != null) gui.setValueAt(0, newValue);
 }
Esempio n. 5
0
 // Sets the names of the registers.
 private void setRegistersNames() {
   a.setName("A");
   d.setName("D");
   pc.setName("PC");
 }