   MILLIS_FOR_SCROLLED_INSTRUCTIONS_TENTH = 5
 
   constructor: (line_height, setTimeout, code_mirror) ->
+    @program = null
     @state = 'OFF'
     @next_line = null
     @line_height = line_height

    @_showNextLine (->)

  _executeNextLineGettingOutput: ->
    if @next_line == 1
      @next_line = 2
      return "1\n"
    else if @next_line == 2
      @next_line = 3
      return "2\n"
    else if @next_line == 3
      @state = 'WAITING'
      @next_line = null
      return "3\n"

  clickRun: ->
    return unless @state == 'WAITING'

    @setTimeout scrollConsole, 1 # timeout to avoid weird layout bug

  _codeWithLineNums: ->
    lines = @code_mirror.getValue().split("\n")
    new_lines = ["<br>\n"] # blank line at beginning
    line_num = 1
    for line in lines
      new_lines.push "<div class='num _#{line_num}'>#{line_num}</div> " +
        "<div class='code _#{line_num}'>#{escapeHTML(line)}</div>"
      line_num += 1

    # blank lines at end, so we can scroll if program is short
    new_lines.join("\n") + "<br><br><br>"

  clickPower: ->
    if @state == 'OFF'
      @state = 'WAITING'
      @program = compile(@code_mirror.getValue())
      @next_line = @program.map['start']
      $one('div.machine .before-cursor').textContent = ''
      $one('div.machine .instructions .content').innerHTML =
        @_codeWithLineNums()
