예제 #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
예제 #2
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 --- ")
예제 #3
0
파일: test_base.py 프로젝트: jerch/MC6809
 def setUp(self):
     cfg = TestCfg(self.UNITTEST_CFG_DICT)
     memory = Memory(cfg)
     self.cpu = CPU(memory, cfg)
예제 #4
0
파일: example6809.py 프로젝트: jerch/MC6809
 def __init__(self):
     cfg = Config(CFG_DICT)
     memory = Memory(cfg)
     self.cpu = CPU(memory, cfg)
예제 #5
0
        #for n in sam:
        #    so = so + str(n)
        #print('SAM {}'.format(so))
    else:
        print('Code at {:04X} wrote {:02X} to {:04X}'.format(b, value, addr))


def read_PIA(cycles, b, addr):
    if addr >= 0xFF00 and addr <= 0xFF3F:
        addr = addr & 0xFFC3  #1111_1111_1100_0011
        return 0
    else:
        print('Code at {:04X} read {:02X}'.format(b, addr))


memory = Memory(cfg)
# The CoCo ROM will "accidentally" write to FFFF. Just ignore that as the hardware does.
memory.add_write_byte_callback(lambda a, b, c, d: 0, 0xFFFF, 0xFFFF)
memory.add_write_byte_callback(write_PIA, 0xFF00, 0xFFF0)
memory.add_read_byte_callback(read_PIA, 0xFF00, 0xFFF0)

with open('bas12.rom', 'rb') as f:
    basic_rom = f.read()
    memory.load(0xA000, basic_rom)
    memory.load(0xFFF0, basic_rom[-16:])

with open('extbas11.rom', 'rb') as f:
    ext_rom = f.read()
    memory.load(0x8000, ext_rom)

cpu = CPU(memory, cfg)