From 0a2cf66672364ed555c85682e948cff0b54c8f35 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sat, 24 Feb 2024 19:04:00 +0200 Subject: Fix bugs, add basic debugger --- atk16_emu/cli.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'atk16_emu/cli.py') diff --git a/atk16_emu/cli.py b/atk16_emu/cli.py index 7aa4b6b..d6bd46b 100644 --- a/atk16_emu/cli.py +++ b/atk16_emu/cli.py @@ -1,6 +1,7 @@ import sys from dataclasses import dataclass from .emu import Machine +from .debugger import Debugger @dataclass class Options: @@ -43,12 +44,18 @@ def load_rom_image_from_path(path: str) -> bytearray: rom_image = load_rom_image_from_path(options.rom_image_path) -machine = Machine() -machine.load_rom_image(rom_image) -machine.reset() -machine.run_until_halted() +if not options.debugger_enabled: + machine = Machine() + machine.load_rom_image(rom_image) + machine.reset() + machine.run_until_halted() -print("Machine halted.") -print("===============") + print("Machine halted.") + print("===============") -machine.print_state_summary() + machine.print_state_summary() + +else: + debugger = Debugger() + debugger.load_rom_image(rom_image) + debugger.activate() -- cgit v1.3