protected boolean execute(int address, String expectedOutput) {
   boolean isSuccess = false;
   Cpu cpu = computer.getCpu();
   cpu.writeRegister(false, Cpu.PC, address);
   long startTime = System.currentTimeMillis();
   while ((System.currentTimeMillis() - startTime) < MAX_EXECUTION_TIME
       || terminal.getWrittenData().length() > Terminal.MAX_DATA_LENGTH) {
     try {
       cpu.executeNextOperation();
       if (cpu.isHaltMode()) {
         throw new IllegalStateException("HALT mode");
       }
     } catch (Exception e) {
       e.printStackTrace();
       fail(
           "can't execute operation, PC: 0"
               + Integer.toOctalString(cpu.readRegister(false, Cpu.PC)));
     }
     if (expectedOutput.equals(terminal.getWrittenData())) {
       isSuccess = true;
       break;
     }
   }
   return isSuccess;
 }
 /** @throws java.lang.Exception */
 @Before
 public void setUp() throws Exception {
   computer = new Computer();
   computer.setClockFrequency(Computer.CLOCK_FREQUENCY_BK0010);
   workMemory = new RandomAccessMemory("TestWorkMemory", 0, 020000);
   computer.addMemory(workMemory);
   RandomAccessMemory videoMemory = new RandomAccessMemory("TestVideoMemory", 040000, 020000);
   computer.addMemory(videoMemory);
   computer.addMemory(new ReadOnlyMemory("TestReadOnlyMemory", 0100000, new byte[010000]));
   terminal = new Terminal();
   computer.addDevice(terminal);
   computer.getCpu().setPswState(0);
   computer.getCpu().writeRegister(false, Cpu.SP, 020000);
   computer.getCpu().writeRegister(false, Cpu.PC, 4);
 }