Example #1
0
 def test_zexdoc(self):
     print(">>> RUNNING ZEXDOC")
     debugger = Debugger()
     debugger.stopOnError = False
     debugger.setHook(0x5, self.systemFunction)
     debugger.setHook(0x0, self.stop)
     rom = ROM(mapAt=0x100)
     rom.loadFrom('./zexdoc.com', False)
     cpu = CPU(rom=rom, debugger=debugger)
     cpu.SP = 0xF000
     cpu.run(0x100)
     self.assertTrue(True)
Example #2
0
    options, args = getopt.getopt(argv, "",
                                  ["attach-logger", "rom=", "mapAt="])
    debugger = Debugger()
    debugger.setBreakpoint(0x100)

    attach_logger = False
    rom_loaded = False
    mapAt = 0x0
    rom = ROM()
    for name, value in options:
        if name == '--mapAt':
            mapAt = int(value, 16)
            rom = ROM(mapAt=mapAt)
            print(f'[+] Mapping ROM at 0x{mapAt:4X}.')
        if name == '--rom':
            rom.loadFrom(value, False)
            print(f'[+] ROM loaded from {value}.')
            rom_loaded = True
        if name == '--attach-logger':
            attach_logger = True
            print(f'[+] Logger attached.')

    if not rom_loaded:
        rom.loadFrom('../rom/tc2048.rom')

    timex = CPU(debugger=debugger, rom=rom)

    if attach_logger:
        timex.logger = Logger(timex)

    print("Starting execution...")