예제 #1
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);
  }
예제 #2
0
  /** Constructs a new CPUEmulatorComponent. */
  public CPUEmulatorComponent() {
    screen = new ScreenComponent();
    keyboard = new KeyboardComponent();
    ram = new PointedMemoryComponent();
    ram.setName("RAM");
    rom = new ROMComponent();
    rom.setName("ROM");
    alu = new ALUComponent();
    a = new RegisterComponent();
    d = new RegisterComponent();
    pc = new RegisterComponent();
    setRegistersNames();
    bus = new BusComponent();
    jbInit();

    // Sets the top level location of RAM and ROM.
    ram.setTopLevelLocation(this);
    rom.setTopLevelLocation(this);
  }