1.1 --- a/ula.py Sun Dec 18 18:59:08 2011 +0100
1.2 +++ b/ula.py Sun Dec 18 19:19:11 2011 +0100
1.3 @@ -4,6 +4,9 @@
1.4 Acorn Electron ULA simulation.
1.5 """
1.6
1.7 +from array import array
1.8 +from itertools import repeat
1.9 +
1.10 LINES_PER_ROW = 8 # the number of pixel lines per character row
1.11 MAX_HEIGHT = 256 # the height of the screen in pixels
1.12 MAX_SCANLINE = 312 # the number of scanlines in each frame
1.13 @@ -13,6 +16,8 @@
1.14 MAX_MEMORY = 0x10000 # the number of addressable memory locations
1.15 BLANK = (0, 0, 0)
1.16
1.17 +screen = array("B", repeat(0, MAX_WIDTH * 3 * MAX_HEIGHT))
1.18 +
1.19 def update(ula):
1.20
1.21 """
1.22 @@ -21,24 +26,22 @@
1.23 ULA.
1.24 """
1.25
1.26 - screen = []
1.27 -
1.28 ula.vsync()
1.29 + pos = 0
1.30 y = 0
1.31 while y < MAX_SCANLINE:
1.32 - row = []
1.33 x = 0
1.34 while x < MAX_SCANPOS:
1.35 colour = ula.get_pixel_colour()
1.36 if x < MAX_WIDTH and y < MAX_HEIGHT:
1.37 - row.append(colour)
1.38 + screen[pos] = colour[0]; pos += 1
1.39 + screen[pos] = colour[1]; pos += 1
1.40 + screen[pos] = colour[2]; pos += 1
1.41 x += 1
1.42 ula.hsync()
1.43 - if y < MAX_HEIGHT:
1.44 - screen.append(row)
1.45 y += 1
1.46
1.47 - return screen
1.48 + return screen.tolist()
1.49
1.50 class ULA:
1.51