git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit cce36f1754096810fb8bfb1c48225636d8426068
parent e903333c7e167f583e85d064501d42ad7daafc23
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Tue, 18 Jan 2022 23:42:22 +0200

DMA debugger command

Diffstat:
MCore/debugger.c24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git 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

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.