private void singleStep(HackSimulator simulator, Script script) {

        singleStepLocked = true;

        try {
            byte terminatorType;
            singleStepRunning = true;

            do {
                terminatorType = miniStep(simulator, script);
            } while (terminatorType == Command.MINI_STEP_TERMINATOR && singleStepRunning);

            singleStepRunning = false;

            if (terminatorType == Command.STOP_TERMINATOR) {
                displayMessage("Script reached a '!' terminator", false);
                stopMode();
            }
        } catch (ControllerException ce) {
            stopWithError(ce);
        } catch (ProgramException pe) {
            stopWithError(pe);
        } catch (CommandException ce) {
            stopWithError(ce);
        } catch (VariableException ve) {
            stopWithError(ve);
        }

        singleStepLocked = false;
//        notifyAll();
    }