Exemplo n.º 1
0
def doVblank():
	try :
		uc = vice.get_mem(0xd018)
		bg = vice.get_mem(0xd021) & 0xf
		if bg != old_bg :
			setupColors(viccolors[bg])

		x = stdscr.getch()
		if x != curses.ERR :
			if x >= curses.KEY_F1 and x <= curses.KEY_F8 :
				x = x - curses.KEY_F1
			elif x == curses.KEY_RIGHT :
				x = 0x10
			elif x == curses.KEY_LEFT :
				x = 0x11
			elif x == curses.KEY_DOWN :
				x = 0x12
			elif x == curses.KEY_UP :
				x = 0x13
			elif x == curses.KEY_HOME :
				x = 0xc
			elif x == curses.KEY_F9 :
				x = 0xf
			elif x == curses.KEY_BACKSPACE :
				x = 8
			vice.put_key(x)
		mem = vice.read_memory(0x400, 25*40)
		colors = vice.read_memory(0xd800, 25*40)

		for i in range(0,len(mem)) :
			x = i % 40
			y = i / 40
			code = ord(mem[i])
			c = ord(colors[i]) & 0xf
			a = curses.color_pair(c + 1)
			if c in (1,10,13,14,7,2) :
				a |= curses.A_BOLD

			if code >= 0x80 :
				code %= 0x80
				a |= curses.A_REVERSE
			if code < len(screencodes) :
				if uc & 2 == 0 :
					stdscr.addstr(y, x, screencodes[code].encode('utf-8'), a)
				else :
					stdscr.addstr(y, x, screencodes2[code].encode('utf-8'), a)
		#stdscr.refresh()
	except :
		print "Unexpected error:", sys.exc_info()[1]
Exemplo n.º 2
0
def putString(s) :
	for c in s :
		vice.put_key(ord(c))
Exemplo n.º 3
0
import sys
import vice

vice.warp_frames(150)
#vice.run_frames(25)
vice.put_key(ord('a'))
vice.run_frames(30000)