diff --git a/Core/debugger.c b/Core/debugger.c index becc475..bfbe451 100644 --- a/Core/debugger.c +++ b/Core/debugger.c @@ -1650,6 +1650,29 @@ static bool palettes(GB_gameboy_t *gb, char *arguments, char *modifiers, const d return true; } +static bool dma(GB_gameboy_t *gb, char *arguments, char *modifiers, const debugger_command_t *command) +{ + NO_MODIFIERS + if (strlen(lstrip(arguments))) { + print_usage(gb, command); + return true; + } + + if (!GB_is_dma_active(gb)) { + GB_log(gb, "DMA is inactive\n"); + return true; + } + + if (gb->dma_current_dest == 0xFF) { + GB_log(gb, "DMA warming up\n"); // Shouldn't actually happen, as it only lasts 2 T-cycles + return true; + } + + GB_log(gb, "Next DMA write: [$FF%02X] = [$%04X]\n", gb->dma_current_dest, gb->dma_current_src); + + return true; +} + static bool lcd(GB_gameboy_t *gb, char *arguments, char *modifiers, const debugger_command_t *command) { NO_MODIFIERS @@ -1946,6 +1969,7 @@ static const debugger_command_t commands[] = { "a more (c)ompact one, or a one-(l)iner", "", "(f|c|l)", .modifiers_completer = wave_completer}, {"lcd", 3, lcd, "Displays information about the current state of the LCD controller"}, {"palettes", 3, palettes, "Displays the current CGB palettes"}, + {"dma", 3, dma, "Displays the current OAM DMA status"}, {"softbreak", 2, softbreak, "Enables or disables software breakpoints", "(on|off)", .argument_completer = on_off_completer}, {"breakpoint", 1, breakpoint, "Add a new breakpoint at the specified address/expression" HELP_NEWLINE "Can also modify the condition of existing breakpoints." HELP_NEWLINE