DMA debugger command

This commit is contained in:
Lior Halphon 2022-01-18 23:42:22 +02:00
parent e903333c7e
commit cce36f1754

View File

@ -1650,6 +1650,29 @@ static bool palettes(GB_gameboy_t *gb, char *arguments, char *modifiers, const d
return true; 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) static bool lcd(GB_gameboy_t *gb, char *arguments, char *modifiers, const debugger_command_t *command)
{ {
NO_MODIFIERS 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}, "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"}, {"lcd", 3, lcd, "Displays information about the current state of the LCD controller"},
{"palettes", 3, palettes, "Displays the current CGB palettes"}, {"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}, {"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 {"breakpoint", 1, breakpoint, "Add a new breakpoint at the specified address/expression" HELP_NEWLINE
"Can also modify the condition of existing breakpoints." HELP_NEWLINE "Can also modify the condition of existing breakpoints." HELP_NEWLINE