Mercurial > repos > blastem
comparison gentests.py @ 325:8db584faac4b
Fixed decoding of CHK destination
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 12 May 2013 01:34:29 -0700 |
parents | 42123feab62d |
children | bfbb8613efb4 |
comparison
equal
deleted
inserted
replaced
324:4f2711899866 | 325:8db584faac4b |
---|---|
22 return str(self.inst).replace('.', '_').replace('#', '_').replace(',', '_').replace(' ', '_').replace('(', '[').replace(')', ']') | 22 return str(self.inst).replace('.', '_').replace('#', '_').replace(',', '_').replace(' ', '_').replace('(', '[').replace(')', ']') |
23 | 23 |
24 def write_rom_test(self, outfile): | 24 def write_rom_test(self, outfile): |
25 outfile.write('\tdc.l $0, start\n') | 25 outfile.write('\tdc.l $0, start\n') |
26 needdivzero = self.inst.name.startswith('div') | 26 needdivzero = self.inst.name.startswith('div') |
27 needchk = self.inst.name.startswith('chk') | |
27 for i in xrange(0x8, 0x100, 0x4): | 28 for i in xrange(0x8, 0x100, 0x4): |
28 if needdivzero and i == 0x14: | 29 if needdivzero and i == 0x14: |
29 outfile.write('\tdc.l div_zero_handler\n') | 30 outfile.write('\tdc.l div_zero_handler\n') |
31 elif needchk and i == 0x18: | |
32 outfile.write('\tdc.l chk_handler\n') | |
30 else: | 33 else: |
31 outfile.write('\tdc.l empty_handler\n') | 34 outfile.write('\tdc.l empty_handler\n') |
32 outfile.write('\tdc.b "SEGA"\nempty_handler:\n\trte\n') | 35 outfile.write('\tdc.b "SEGA"\nempty_handler:\n\trte\n') |
33 if needdivzero: | 36 if needdivzero: |
34 outfile.write('div_zero_handler:\n') | 37 outfile.write('div_zero_handler:\n') |
35 div_zero_count = self.get_dreg() | 38 div_zero_count = self.get_dreg() |
36 outfile.write('\taddq #1, ' + str(div_zero_count) + '\n') | 39 outfile.write('\taddq #1, ' + str(div_zero_count) + '\n') |
40 outfile.write('\trte\n') | |
41 if needchk: | |
42 outfile.write('chk_handler:\n') | |
43 chk_count = self.get_dreg() | |
44 outfile.write('\taddq #1, ' + str(chk_count) + '\n') | |
37 outfile.write('\trte\n') | 45 outfile.write('\trte\n') |
38 outfile.write('start:\n\tmove #0, CCR\n') | 46 outfile.write('start:\n\tmove #0, CCR\n') |
39 if needdivzero: | 47 if needdivzero: |
40 outfile.write('\tmoveq #0, ' + str(div_zero_count) + '\n') | 48 outfile.write('\tmoveq #0, ' + str(div_zero_count) + '\n') |
41 already = {} | 49 already = {} |