1.1 --- a/ula.py Thu Dec 08 23:37:29 2011 +0100
1.2 +++ b/ula.py Thu Dec 08 23:50:49 2011 +0100
1.3 @@ -4,6 +4,9 @@
1.4 Acorn Electron ULA simulation.
1.5 """
1.6
1.7 +import array
1.8 +import itertools
1.9 +
1.10 WIDTH = 640
1.11 HEIGHT = 512
1.12 INTENSITY = 255
1.13 @@ -267,8 +270,30 @@
1.14
1.15 return result
1.16
1.17 +def get_memory():
1.18 + return array.array("B", itertools.repeat(0, MAX_MEMORY))
1.19 +
1.20 def fill(memory, start, end, value):
1.21 for i in xrange(start, end):
1.22 memory[i] = value
1.23
1.24 +# Test program providing coverage (necessary for compilers like Shedskin).
1.25 +# NOTE: Running this will actually cause an IndexError.
1.26 +
1.27 +if __name__ == "__main__":
1.28 + memory = get_memory()
1.29 + ula = ULA(memory)
1.30 + ula.set_mode(2)
1.31 + fill(memory, 0x5800 - 320, 0x8000, encode((2, 7), 4))
1.32 +
1.33 + # Make a simple two-dimensional array of tuples (three-dimensional in pygame
1.34 + # terminology).
1.35 +
1.36 + a = [
1.37 + [(0, 0, 0), (0, 0, 0), (0, 0, 0)],
1.38 + [(0, 0, 0), (0, 0, 0), (0, 0, 0)],
1.39 + [(0, 0, 0), (0, 0, 0), (0, 0, 0)]
1.40 + ]
1.41 + update(a, ula)
1.42 +
1.43 # vim: tabstop=4 expandtab shiftwidth=4