def loop(msg): pyvga.cleartext() pyvga.entertext() while msg.count('\n'): n = msg.index('\n') print msg[:n] msg = msg[n+1:] while 1: stack.swap(None, idl_task)
def recurse(i): if i: print "-- swapped: %d" % i recurse(stack.swap(i - 1)) else: stack.swap(None)
def recurse(i): if i: print "-- swapped: %d" % i recurse(stack.swap(i - 1)) else: stack.swap(None) def worker(): recurse(8) newstack = buf.bss(0x800) stack.init(newstack, worker) i = stack.swap(None, newstack) while i: print "-- swapped back: %d" % i i = stack.swap(i - 1, newstack) print "-- test stacks done" print print "-- test linux emulation" # this hi.c can be built once, then run on either Linux or Cleese # ----------------------------------------------------------------------------- # void _start() # { # char *msg = "Hello, world!\n"; # write(1, msg, strlen(msg)); # _exit(0);
def recurse(i): if i: print '-- swapped: %d' % i recurse(stack.swap(i - 1)) else: stack.swap(None)
def recurse(i): if i: print '-- swapped: %d' % i recurse(stack.swap(i - 1)) else: stack.swap(None) def worker(): recurse(8) newstack = buf.bss(0x800) stack.init(newstack, worker) i = stack.swap(None, newstack) while i: print '-- swapped back: %d' % i i = stack.swap(i - 1, newstack) print '-- test stacks done' print print '-- test linux emulation' # this hi.c can be built once, then run on either Linux or Cleese # ----------------------------------------------------------------------------- #void _start() #{ # char *msg = "Hello, world!\n"; # write(1, msg, strlen(msg)); # _exit(0);
### # ### # ## ### # ### # #### ## # ### # ## ### # ### # ### # ## # # ## # ### # # ### # ### ## # ### ### # #### ### ### ### ## # ### ### ### ## # ## # ### ### ### ## # ### #### ## ### ## ## ### ### ## ## # ### ### ## ### ## ## ### ### ### #### # ### ### ## ### ### ## ### ### ### #### # ### ### ## ### ### ## ### ### ## #### # ### ### ## ### ### ## ### ### ## ### # ### ### ## ### ### ## ### ### ### ### ### ### ## ### ### ## ### ### ### ### ### ### ## ### ## ## ### ### ### ### ### ### ## ### ## ## ### ### # # ### ### ## ### ## # ## #### # # ### ### ## ##### ##### ##### ## # # ######## ## ''') bufchar = stack.swap(None, idl_task) if bufchar == 'q': loop('Thanks for playing') elif bufchar in 'hs': move(-1) elif bufchar in 'jx': move(20) elif bufchar in 'ke': move(-20) elif bufchar in 'ld': move(1) elif bufchar == 'p': dispall()