Esempio n. 1
0

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";
Esempio n. 2
0

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";
Esempio n. 3
0
			ch = dir; dir = None
			stack.swap(ch)
		else:
			stack.swap(None, idl_task)

interrupts = []
def idl_work():
	while 1:
		if len(interrupts):
			stack.swap(None, interrupts.pop(0))
	
################################################################################
import stack
import isr

kbd_task = buf.bss(0x400); stack.init(kbd_task, kbd_work)
clk_task = buf.bss(0x400); stack.init(clk_task, clk_work)
idl_task = buf.bss(0x400); stack.init(idl_task, idl_work)

def kbd_isr(): 
	interrupts.append(kbd_task)
def clk_isr():
	interrupts.append(clk_task)

################################################################################

#--test map--
map = list('     #####               #   #               #   #             ###   ##            #      #          ### # ## #   ###### #   # ## #####  ..# #   .$          ..# ##### ### #@##  ..#     #     #########     #######')

#--easier level--
#map = list('     #####               #   #               #$  #             ###  $##            #  $ $ #          ### # ## #   ###### #   # ## #####  ..# # $  $          ..# ##### ### #@##  ..#     #     #########     #######')