added test_run to run CPU over a fragment of memory with no UI event handling (for automated testings)

This commit is contained in:
James Tauber 2011-08-14 17:21:03 -04:00
parent bdc7b3a1e2
commit fcb1d585a0

View File

@ -773,6 +773,21 @@ class CPU:
pygame.display.flip() pygame.display.flip()
update_cycle = 0 update_cycle = 0
def test_run(self, start, end):
self.program_counter = start
while True:
if self.program_counter == end:
break
op = self.read_pc_byte()
func = self.ops[op]
if func is None:
print "UNKNOWN OP"
print hex(self.program_counter - 1)
print hex(op)
break
else:
self.ops[op]()
#### ####
def get_pc(self, inc=1): def get_pc(self, inc=1):