1.1 --- a/ula.py Sat Dec 10 20:23:37 2011 +0100
1.2 +++ b/ula.py Sat Dec 10 20:24:20 2011 +0100
1.3 @@ -271,8 +271,27 @@
1.4 return result
1.5
1.6 def get_memory():
1.7 +
1.8 + "Return an array representing the computer's memory."
1.9 +
1.10 return array.array("B", itertools.repeat(0, MAX_MEMORY))
1.11
1.12 +def get_screen():
1.13 +
1.14 + "Return a list of arrays representing the display."
1.15 +
1.16 + x = 0
1.17 + screen = []
1.18 + while x < WIDTH:
1.19 + y = 0
1.20 + column = []
1.21 + while y < HEIGHT:
1.22 + column.append((0, 0, 0))
1.23 + y += 1
1.24 + screen.append(column)
1.25 + x += 1
1.26 + return screen
1.27 +
1.28 def fill(memory, start, end, value):
1.29 for i in xrange(start, end):
1.30 memory[i] = value
1.31 @@ -289,11 +308,7 @@
1.32 # Make a simple two-dimensional array of tuples (three-dimensional in pygame
1.33 # terminology).
1.34
1.35 - a = [
1.36 - [(0, 0, 0), (0, 0, 0), (0, 0, 0)],
1.37 - [(0, 0, 0), (0, 0, 0), (0, 0, 0)],
1.38 - [(0, 0, 0), (0, 0, 0), (0, 0, 0)]
1.39 - ]
1.40 + a = get_screen()
1.41 update(a, ula)
1.42
1.43 # vim: tabstop=4 expandtab shiftwidth=4