1.1 --- a/ula.py Sun Dec 18 18:56:39 2011 +0100
1.2 +++ b/ula.py Sun Dec 18 18:59:08 2011 +0100
1.3 @@ -13,26 +13,33 @@
1.4 MAX_MEMORY = 0x10000 # the number of addressable memory locations
1.5 BLANK = (0, 0, 0)
1.6
1.7 -def update(screen, ula):
1.8 +def update(ula):
1.9
1.10 """
1.11 - Update the 'screen' array by reading from the 'ula'. This function
1.12 - effectively has the role of the video circuit, but also provides the clock
1.13 - signal to the ULA.
1.14 + Return a screen array by reading from the 'ula'. This function effectively
1.15 + has the role of the video circuit, but also provides the clock signal to the
1.16 + ULA.
1.17 """
1.18
1.19 + screen = []
1.20 +
1.21 ula.vsync()
1.22 y = 0
1.23 while y < MAX_SCANLINE:
1.24 + row = []
1.25 x = 0
1.26 while x < MAX_SCANPOS:
1.27 colour = ula.get_pixel_colour()
1.28 if x < MAX_WIDTH and y < MAX_HEIGHT:
1.29 - screen[x][y] = colour
1.30 + row.append(colour)
1.31 x += 1
1.32 ula.hsync()
1.33 + if y < MAX_HEIGHT:
1.34 + screen.append(row)
1.35 y += 1
1.36
1.37 + return screen
1.38 +
1.39 class ULA:
1.40
1.41 "The ULA functionality."
1.42 @@ -276,17 +283,6 @@
1.43
1.44 return [0] * MAX_MEMORY
1.45
1.46 -def get_screen():
1.47 -
1.48 - "Return a list of arrays representing the display."
1.49 -
1.50 - x = 0
1.51 - screen = []
1.52 - while x < MAX_WIDTH:
1.53 - screen.append([(0, 0, 0)] * MAX_HEIGHT)
1.54 - x += 1
1.55 - return screen
1.56 -
1.57 def fill(memory, start, end, value):
1.58 i = start
1.59 while i < end:
1.60 @@ -303,7 +299,6 @@
1.61 # Make a simple two-dimensional array of tuples (three-dimensional in pygame
1.62 # terminology).
1.63
1.64 - a = get_screen()
1.65 - update(a, ula)
1.66 + a = update(ula)
1.67
1.68 # vim: tabstop=4 expandtab shiftwidth=4