Mercurial > repos > blastem
comparison cpu_dsl.py @ 1740:28ab56ff8cea
Implement DD/FD prefixes for instructions that don't reference HL
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 04 Feb 2019 22:20:51 -0800 |
parents | 2207cd2bae14 |
children | 6290c88949bd |
comparison
equal
deleted
inserted
replaced
1739:435877da5837 | 1740:28ab56ff8cea |
---|---|
1314 self.needFlagDisperse = False | 1314 self.needFlagDisperse = False |
1315 self.lastOp = None | 1315 self.lastOp = None |
1316 opmap[val] = inst.generateName(val) | 1316 opmap[val] = inst.generateName(val) |
1317 bodymap[val] = inst.generateBody(val, self, otype) | 1317 bodymap[val] = inst.generateBody(val, self, otype) |
1318 | 1318 |
1319 pieces.append('\ntypedef void (*impl_fun)({pre}context *context);'.format(pre=self.prefix)) | |
1320 pieces.append('\nstatic impl_fun impl_{name}[{sz}] = {{'.format(name = table, sz=len(opmap))) | 1319 pieces.append('\nstatic impl_fun impl_{name}[{sz}] = {{'.format(name = table, sz=len(opmap))) |
1321 for inst in range(0, len(opmap)): | 1320 for inst in range(0, len(opmap)): |
1322 op = opmap[inst] | 1321 op = opmap[inst] |
1323 if op is None: | 1322 if op is None: |
1324 pieces.append('\n\tunimplemented,') | 1323 pieces.append('\n\tunimplemented,') |
1333 pieces = [] | 1332 pieces = [] |
1334 for include in self.includes: | 1333 for include in self.includes: |
1335 body.append('#include "{0}"\n'.format(include)) | 1334 body.append('#include "{0}"\n'.format(include)) |
1336 body.append('\nstatic void unimplemented({pre}context *context)'.format(pre = self.prefix)) | 1335 body.append('\nstatic void unimplemented({pre}context *context)'.format(pre = self.prefix)) |
1337 body.append('\n{') | 1336 body.append('\n{') |
1338 body.append('\n\tfatal_error("Unimplemented instruction");') | 1337 body.append('\n\tfatal_error("Unimplemented instruction\\n");') |
1339 body.append('\n}\n') | 1338 body.append('\n}\n') |
1339 body.append('\ntypedef void (*impl_fun)({pre}context *context);'.format(pre=self.prefix)) | |
1340 for table in self.extra_tables: | |
1341 body.append('\nstatic impl_fun impl_{name}[{sz}];'.format(name = table, sz=(1 << self.opsize))) | |
1342 body.append('\nstatic impl_fun impl_main[{sz}];'.format(sz=(1 << self.opsize))) | |
1340 for table in self.extra_tables: | 1343 for table in self.extra_tables: |
1341 self._buildTable(otype, table, body) | 1344 self._buildTable(otype, table, body) |
1342 self._buildTable(otype, 'main', body) | 1345 self._buildTable(otype, 'main', body) |
1343 if self.body in self.subroutines: | 1346 if self.body in self.subroutines: |
1344 pieces.append('\nvoid {pre}execute({type} *context, uint32_t target_cycle)'.format(pre = self.prefix, type = self.context_type)) | 1347 pieces.append('\nvoid {pre}execute({type} *context, uint32_t target_cycle)'.format(pre = self.prefix, type = self.context_type)) |