 nes = injector.getInstance "nes"
 nes.insertCartridge cartridge
 
-stdin = process.stdin
-stdout = process.stdout
+print = console.log
 
 ###########################################################
 # Commands

        when "j", "jump"  then jumpCommand param
        when "b", "break" then breakCommand param
        when "x", "exec"  then execCommand param
        when "q", "quit"  then quitCommand param
        else stdout.write "Type 'help' to print available commands.\n"
    rl.prompt()

rl.on "close", ->
    stdout.write "\n"
    process.exit 0

            try
                result = eval breakCondition
                if result
                    print "Break condition '#{breakCondition}' evaluated to #{result}"
                    break
            catch error
                print "Error when evaluating break condition '#{breakCondition}': #{error.message}"
                break
        nes.step()

