Exemplo n.º 1
0
 def testCPUB(self):
     session = Session()
     session.parse_args(["--platform=NES", "--cpu=2A07"])
     session.initialize_target()
     self.assertIsInstance(session._target, NES)
     self.assertEqual(session._target._cpu, "2a07")
     Types._shared_state = {}
Exemplo n.º 2
0
 def testMultipleFiles(self):
     session = Session()
     session.parse_args(["--cpu=6502", "bar.s", "foo.s"])
     self.assertIsInstance(session.get_args(), list)
     self.assertEquals(session.get_args()[0], "bar.s")
     self.assertEquals(session.get_args()[1], "foo.s")
     Types._shared_state = {}
Exemplo n.º 3
0
 def testGeneric6502Platform(self):
     session = Session()
     session.parse_args(["--cpu=6502"])
     session.initialize_target()
     self.assertIsInstance(session._target, Generic)
     self.assertEqual(session._target._cpu, "6502")
     Types._shared_state = {}
Exemplo n.º 4
0
    def reset_block(self):
        root_file = Session().get_root_file()
        if root_file not in self._blocks:
            self._blocks[root_file] = []

        self._blocks[root_file].append(self._block)
        self._init_block()
Exemplo n.º 5
0
 def testGeneric6502Platform(self):
     session = Session()
     session.parse_args(['--cpu=6502'])
     session.initialize_target()
     self.assertIsInstance(session._target, Generic)
     self.assertEqual(session._target._cpu, '6502')
     Types._shared_state = {}
Exemplo n.º 6
0
 def testCPUB(self):
     session = Session()
     session.parse_args(['--platform=NES', '--cpu=2A07'])
     session.initialize_target()
     self.assertIsInstance(session._target, NES)
     self.assertEqual(session._target._cpu, '2a07')
     Types._shared_state = {}
Exemplo n.º 7
0
 def testMultipleFiles(self):
     session = Session()
     session.parse_args(['--cpu=6502', 'bar.s', 'foo.s'])
     self.assertIsInstance(session.get_args(), list)
     self.assertEquals(session.get_args()[0], 'bar.s')
     self.assertEquals(session.get_args()[1], 'foo.s')
     Types._shared_state = {}
Exemplo n.º 8
0
    def p_nes_pp_ines_statement(self, p):
        '''nes_pp_ines_statement : PPINESOFF NL
                                 | PPINESMAPPER nes_pp_value NL
                                 | PPINESMIRRORING nes_pp_value NL
                                 | PPINESFOURSCREEN nes_pp_value NL
                                 | PPINESBATTERY nes_pp_value NL
                                 | PPINESTRAINER nes_pp_value NL
                                 | PPINESPRGREPEAT nes_pp_value NL
                                 | PPINESCHRREPEAT nes_pp_value NL'''
        value = None
        if len(p) == 3:
            value = True
        else:
            # strip quotes off if they exist
            value = self._clean_value(p[2])

        # store the ines setting in the target
        Session().get_target()[p[1]] = value
Exemplo n.º 9
0
    def __init__(self, cpu=None):
        if not cpu:
            raise CommandLineError("no CPU specified for generic platform")

        super(Generic, self).__init__()

        self._cpu = cpu

        cpu_spec = Session().get_cpu_spec(cpu)
        if not cpu_spec:
            raise CommandLineError("unknown CPU type: %s" % cpu)

        # get the platform data
        cpu_class = cpu_spec['class']
        cpu_module = 'hlakit.' + cpu_spec['module']
        cpu_symbols = __import__(cpu_module, fromlist=[cpu_class])
        cpu_ctor = getattr(cpu_symbols, cpu_class)

        # initialize the target
        self._cpu_obj = cpu_ctor()
Exemplo n.º 10
0
 def p_error(self, p):
     if p != None:
         print "Syntax error in input! File: %s, Line: %s" % (
             Session().get_cur_file(), p.lineno)
     import pdb
     pdb.set_trace()
Exemplo n.º 11
0
 def testDrawShort(self):
     session = Session()
     session.parse_args(['--cpu=6502', '-d'])
     self.assertTrue(session.is_graph())
     Types._shared_state = {}
Exemplo n.º 12
0
 def testDebugShort(self):
     session = Session()
     session.parse_args(['--cpu=6502', '-g'])
     self.assertTrue(session.is_debug())
     Types._shared_state = {}
Exemplo n.º 13
0
 def testBogusPlatform(self):
     session = Session()
     self.assertRaises(CommandLineError, session.parse_args,
                       ['--platform=blah'])
     Types._shared_state = {}
Exemplo n.º 14
0
 def testNoParameters(self):
     session = Session()
     self.assertRaises(CommandLineError, session.parse_args, [])
     Types._shared_state = {}
Exemplo n.º 15
0
 def testIncludeShort(self):
     session = Session()
     session.parse_args(['--cpu=6502', '-Itests'])
     self.assertIsInstance(session.get_include_dirs(), list)
     self.assertEquals(session.get_include_dirs(), ['tests'])
     Types._shared_state = {}
Exemplo n.º 16
0
 def start_block(self, type_=None):
     self._block['type'] = type_
     self._block['started'] = True
     self._block['banksize'] = self._banksize[type_]
     self._block['source'] = copy.copy(Session()._cur_file)
Exemplo n.º 17
0
 def testDrawShort(self):
     session = Session()
     session.parse_args(["--cpu=6502", "-d"])
     self.assertTrue(session.is_graph())
     Types._shared_state = {}
Exemplo n.º 18
0
 def testDebugShort(self):
     session = Session()
     session.parse_args(["--cpu=6502", "-g"])
     self.assertTrue(session.is_debug())
     Types._shared_state = {}
Exemplo n.º 19
0
 def testIncludeShort(self):
     session = Session()
     session.parse_args(["--cpu=6502", "-Itests"])
     self.assertIsInstance(session.get_include_dirs(), list)
     self.assertEquals(session.get_include_dirs(), ["tests"])
     Types._shared_state = {}