# HG changeset patch # User Paul Boddie # Date 1323545017 -3600 # Node ID 0ac34bc9f1179e82f873552cdb91fdde7d1cba81 # Parent 2c9de9fafab8696de72306f94d6dfbbbb06049ea Made the ULA's buffer use element types consistently. Changed class attribute accesses to be explicit for Shedskin. Changed the test program to use data less likely to be optimised by Shedskin or similar compilers. diff -r 2c9de9fafab8 -r 0ac34bc9f117 ula.py --- a/ula.py Thu Dec 08 23:51:47 2011 +0100 +++ b/ula.py Sat Dec 10 20:23:37 2011 +0100 @@ -56,7 +56,7 @@ # Internal state. - self.buffer = [0] * 8 + self.buffer = [(0, 0, 0)] * 8 def set_mode(self, mode): @@ -75,7 +75,7 @@ * number of entries in the pixel buffer """ - self.width, self.depth, rows = self.modes[mode] + self.width, self.depth, rows = ULA.modes[mode] row_size = (self.width * self.depth * LINES_PER_ROW) / 8 # bits per row -> bytes per row @@ -206,7 +206,7 @@ i = 0 for colour in decode(byte_value, self.depth): - self.buffer[i] = get_physical_colour(self.palette[colour]) + self.buffer[i] = get_physical_colour(ULA.palette[colour]) i += 1 # Advance to the next column. @@ -283,8 +283,8 @@ if __name__ == "__main__": memory = get_memory() ula = ULA(memory) - ula.set_mode(2) - fill(memory, 0x5800 - 320, 0x8000, encode((2, 7), 4)) + ula.set_mode(6) + fill(memory, 0x6000, 0x8000, encode((1, 0, 1, 0, 1, 0, 1, 0), 1)) # Make a simple two-dimensional array of tuples (three-dimensional in pygame # terminology).