diff --git a/build.nr b/build.nr index ff0ba09..fed8f61 100644 --- a/build.nr +++ b/build.nr @@ -1 +1 @@ -1621 +1622 diff --git a/extra/dragon/disk1.dr b/extra/dragon/disk1.dr index f259415..433ada3 100644 Binary files a/extra/dragon/disk1.dr and b/extra/dragon/disk1.dr differ diff --git a/extra/dss/DragonOS/kernel0/kernel0.dss b/extra/dss/DragonOS/kernel0/kernel0.dss index 49aa64f..27e1815 100644 --- a/extra/dss/DragonOS/kernel0/kernel0.dss +++ b/extra/dss/DragonOS/kernel0/kernel0.dss @@ -4,7 +4,6 @@ .header KERNEL0_BOOT @include <../../sdk/bios_api.dss> -@include <../../sdk/palette.dss> @include <../drivers/keyboard_driver.dss> @include <../drivers/display_driver.dss> @include diff --git a/extra/dss/sdk/bios_api.dss b/extra/dss/sdk/bios_api.dss index 850645d..22650a1 100644 --- a/extra/dss/sdk/bios_api.dss +++ b/extra/dss/sdk/bios_api.dss @@ -1,5 +1,5 @@ ## -- -## -- This file is automatically generated by the DragonAssembler (version 0.4.1620) +## -- This file is automatically generated by the DragonAssembler (version 0.4.1622) ## -- Please do not modify this file in any way. ## -- diff --git a/src/assembler/IncludePreprocessor.cpp b/src/assembler/IncludePreprocessor.cpp index cf292f2..926f286 100644 --- a/src/assembler/IncludePreprocessor.cpp +++ b/src/assembler/IncludePreprocessor.cpp @@ -66,8 +66,6 @@ namespace dragon { ostd::String line = lines[i]; line.trim(); - if (line.new_toLower().contains("memory.dss")) - std::cout << line << "\n"; if (line.new_toLower().startsWith("@include") && line.len() > 8) { line.substr(8).trim(); diff --git a/src/debugger/Debugger.cpp b/src/debugger/Debugger.cpp index e3849d4..396d0bd 100644 --- a/src/debugger/Debugger.cpp +++ b/src/debugger/Debugger.cpp @@ -126,6 +126,34 @@ namespace dragon return out; } + void Debugger::Utils::removeBreakPoint(uint16_t addr) + { + if (debugger.manualBreakPoints.size() == 0) + return; + int32_t i = 0; + for ( ; i < debugger.manualBreakPoints.size(); i++) + { + if (debugger.manualBreakPoints[i] == addr) + break; + } + if (i >= debugger.manualBreakPoints.size()) + return; + debugger.manualBreakPoints.erase(debugger.manualBreakPoints.begin() + i); + } + + bool Debugger::Utils::isBreakPoint(uint16_t addr) + { + for (const auto& b : debugger.manualBreakPoints) + if (b == addr) return true; + return false; + } + + void Debugger::Utils::addBreakPoint(uint16_t addr) + { + debugger.manualBreakPoints.push_back(addr); + } + + @@ -1530,6 +1558,44 @@ namespace dragon Display::printPrompt(); data().command = getCommandInput(); } + else if (data().command.startsWith("b ") || data().command.startsWith("break ")) + {//0x2C1D + data().command.substr(data().command.indexOf(" ") + 1).trim(); + uint16_t addr = 0; + bool valid = false; + if (data().command.isNumeric()) + { + addr = (uint16_t)data().command.toInt(); + valid = true; + } + else if (data().command.startsWith("$")) + { + addr = Utils::findSymbol(debugger.labels, data().command); + if (addr == 0x0000 || addr == 0xFFFF) + output().fg(ostd::ConsoleColors::Red).p("Invalid symbol: ").p(data().command).reset().nl(); + else + valid = true; + } + else + { + output().fg(ostd::ConsoleColors::Red).p("Invalid value for command.").reset().nl(); + } + if (valid) + { + if (Utils::isBreakPoint(addr)) + { + Utils::removeBreakPoint(addr); + output().fg(ostd::ConsoleColors::Yellow).p("Breakpoint removed at address: ").p(ostd::Utils::getHexStr(addr, true, 2)).reset().nl(); + } + else + { + Utils::addBreakPoint(addr); + output().fg(ostd::ConsoleColors::Yellow).p("Breakpoint set at address: ").p(ostd::Utils::getHexStr(addr, true, 2)).reset().nl(); + } + } + Display::printPrompt(); + data().command = getCommandInput(); + } else data().command = Display::changeScreen(); } diff --git a/src/debugger/Debugger.hpp b/src/debugger/Debugger.hpp index d28455c..a09e2ff 100644 --- a/src/debugger/Debugger.hpp +++ b/src/debugger/Debugger.hpp @@ -34,10 +34,11 @@ namespace dragon DisassemblyList data; std::vector trackedAddresses; ostd::String command; - int32_t labelLineLength { 20 }; + int32_t labelLineLength { 40 }; uint16_t currentAddress { 0 }; bool userQuit { false }; ostd::String disassemblyDirectory { "disassembly" }; + std::vector manualBreakPoints; }; struct tCloseEventListener : public ostd::BaseObject { @@ -59,7 +60,10 @@ namespace dragon static bool isEscapeKeyPressed(bool blocking = false); static ostd::ConsoleOutputHandler& printFullLine(char c, const ostd::ConsoleColors::tConsoleColor& foreground); static ostd::ConsoleOutputHandler& printFullLine(char c, const ostd::ConsoleColors::tConsoleColor& foreground, const ostd::ConsoleColors::tConsoleColor& background); - }; + static void removeBreakPoint(uint16_t addr); + static bool isBreakPoint(uint16_t addr); + static void addBreakPoint(uint16_t addr); + }; public: class Display { public: