1.1 --- a/main.py Sun Dec 18 18:59:08 2011 +0100
1.2 +++ b/main.py Sun Dec 18 19:19:11 2011 +0100
1.3 @@ -25,7 +25,7 @@
1.4 # Copy the array to a surface and apply a pixel intensity.
1.5
1.6 try:
1.7 - a[:] = screen_array
1.8 + a.flat[:] = screen_array
1.9 a *= INTENSITY
1.10 finally:
1.11 del a, sa
2.1 --- a/ula.py Sun Dec 18 18:59:08 2011 +0100
2.2 +++ b/ula.py Sun Dec 18 19:19:11 2011 +0100
2.3 @@ -4,6 +4,9 @@
2.4 Acorn Electron ULA simulation.
2.5 """
2.6
2.7 +from array import array
2.8 +from itertools import repeat
2.9 +
2.10 LINES_PER_ROW = 8 # the number of pixel lines per character row
2.11 MAX_HEIGHT = 256 # the height of the screen in pixels
2.12 MAX_SCANLINE = 312 # the number of scanlines in each frame
2.13 @@ -13,6 +16,8 @@
2.14 MAX_MEMORY = 0x10000 # the number of addressable memory locations
2.15 BLANK = (0, 0, 0)
2.16
2.17 +screen = array("B", repeat(0, MAX_WIDTH * 3 * MAX_HEIGHT))
2.18 +
2.19 def update(ula):
2.20
2.21 """
2.22 @@ -21,24 +26,22 @@
2.23 ULA.
2.24 """
2.25
2.26 - screen = []
2.27 -
2.28 ula.vsync()
2.29 + pos = 0
2.30 y = 0
2.31 while y < MAX_SCANLINE:
2.32 - row = []
2.33 x = 0
2.34 while x < MAX_SCANPOS:
2.35 colour = ula.get_pixel_colour()
2.36 if x < MAX_WIDTH and y < MAX_HEIGHT:
2.37 - row.append(colour)
2.38 + screen[pos] = colour[0]; pos += 1
2.39 + screen[pos] = colour[1]; pos += 1
2.40 + screen[pos] = colour[2]; pos += 1
2.41 x += 1
2.42 ula.hsync()
2.43 - if y < MAX_HEIGHT:
2.44 - screen.append(row)
2.45 y += 1
2.46
2.47 - return screen
2.48 + return screen.tolist()
2.49
2.50 class ULA:
2.51