Example #1
0
    def __init__(self, cols=NUM_COLUMNS):

        logging.getLogger('MC6809').disabled = True

        fn = os.path.join(os.path.dirname(__file__), 'coco_raaka_tu.bin')
        with open(fn, 'rb') as f:
            self.binary = f.read()
        self.binary = list(b'\x00' * 0x600 + self.binary)

        CFG_DICT = {
            "verbosity": None,
            "trace": None,
        }

        class Config(BaseConfig):
            RAM_START = 0x0000
            RAM_END = 0x7FFF
            ROM_START = 0x8000
            ROM_END = 0xFFFF

        cfg = Config(CFG_DICT)

        # Memory management -- defer everything to our read/write functions
        #
        memory = Memory(cfg)
        memory.add_read_byte_callback(self.read_memory, 0, 0xFFFF)
        memory.add_write_byte_callback(self.write_memory, 0, 0xFFFF)

        # Start of program is 0x600
        #
        self.cpu = CPU(memory, cfg)
        self.still_running = False

        self.buffer = ''
        self.cols = cols
Example #2
0
    def __init__(self, cfg, periphery_class, display_callback,
                 user_input_queue):
        self.cfg = cfg
        self.machine_api = cfg.machine_api
        self.periphery_class = periphery_class

        # "write into Display RAM" for render them in DragonTextDisplayCanvas():
        self.display_callback = display_callback

        # Queue to send keyboard inputs to CPU Thread:
        self.user_input_queue = user_input_queue

        memory = Memory(self.cfg)
        self.cpu = CPU(memory, self.cfg)
        memory.cpu = self.cpu  # FIXME

        try:
            self.periphery = self.periphery_class(self.cfg, self.cpu, memory,
                                                  self.display_callback,
                                                  self.user_input_queue)
        except TypeError as err:
            raise TypeError("%s - class: %s" %
                            (err, self.periphery_class.__name__))

        self.cpu_init_state = self.cpu.get_state()  # Used for hard reset
        #        from dragonpy.tests.test_base import print_cpu_state_data
        #        print_cpu_state_data(self.cpu_init_state)

        self.cpu.reset()

        self.max_ops = self.cfg.cfg_dict["max_ops"]
        self.op_count = 0
Example #3
0
                InstructionClass = PrepagedInstructions

            instrution_class = InstructionClass(self.cpu, instr_func)
            func = getattr(instrution_class, func_name)

            self.opcode_dict[op_code] = (op_code_data["cycles"], func)


if __name__ == "__main__":
    from MC6809.components.cpu6809 import CPU
    from MC6809.tests.test_base import BaseCPUTestCase
    from dragonpy.Dragon32.config import Dragon32Cfg
    from MC6809.components.memory import Memory

    cmd_args = BaseCPUTestCase.UNITTEST_CFG_DICT
    cfg = Dragon32Cfg(cmd_args)
    memory = Memory(cfg)
    cpu = CPU(memory, cfg)

    for op_code, data in sorted(cpu.opcode_dict.items()):
        cycles, func = data
        if op_code > 0xff:
            op_code = "$%04x" % op_code
        else:
            op_code = "  $%02x" % op_code

        print("Op %s - cycles: %2i - func: %s" %
              (op_code, cycles, func.__name__))

    print(" --- END --- ")
Example #4
0
 def setUp(self):
     cfg = TestCfg(self.UNITTEST_CFG_DICT)
     memory = Memory(cfg)
     self.cpu = CPU(memory, cfg)
     memory.cpu = self.cpu  # FIXME
     self.cpu.cc.set(0x00)
Example #5
0
 def __init__(self):
     cfg = Config(CFG_DICT)
     memory = Memory(cfg)
     self.cpu = CPU(memory, cfg)
Example #6
0
 def setUp(self):
     cfg = TestCfg(self.UNITTEST_CFG_DICT)
     memory = Memory(cfg)
     self.cpu = CPU(memory, cfg)