Exemple #1
0
import ports
import buf
import blit

splashscreen=buf.sym('splashscreen')
framebuffer =buf.abs(0xa0000, 0x10000)
textbuffer  =buf.abs(0xb8000, 4000)
savebuffer  =buf.bss(4000)
font0	    =buf.bss(8192)

textmode = 1

def exittext():
	savebuffer[:] = textbuffer
	set320x200x256()
	savefonts()
	global textmode; textmode = 0

def entertext():
	global textmode; textmode = 1
	restorefonts()
	set80x25()
	textbuffer[:] = savebuffer

def cleartext():
	if textmode:	tb = textbuffer
	else:		tb = savebuffer
	blit.fill(tb, 4000, 0,0, 4000,1, ' \015 \015 \015 \015')

def set640x480x16():
	ports.inb(0x3DA)
Exemple #2
0
print "-- test stacks"


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()
# {
Exemple #3
0
import ports
import buf
import blit

splashscreen = buf.sym('splashscreen')
framebuffer = buf.abs(0xa0000, 0x10000)
textbuffer = buf.abs(0xb8000, 4000)
savebuffer = buf.bss(4000)
font0 = buf.bss(8192)

textmode = 1


def exittext():
    savebuffer[:] = textbuffer
    set320x200x256()
    savefonts()
    global textmode
    textmode = 0


def entertext():
    global textmode
    textmode = 1
    restorefonts()
    set80x25()
    textbuffer[:] = savebuffer


def cleartext():
    if textmode: tb = textbuffer
Exemple #4
0
print '-- test stacks'


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()
#{
Exemple #5
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('     #####               #   #               #$  #             ###  $##            #  $ $ #          ### # ## #   ###### #   # ## #####  ..# # $  $          ..# ##### ### #@##  ..#     #     #########     #######')