From 2486e5e4c0abe1ddeea7a372942d61ea725fdc41 Mon Sep 17 00:00:00 2001 From: OmniaX-Dev Date: Fri, 20 Mar 2026 00:25:25 +0100 Subject: [PATCH] Refactor to the new OmniaFramework structure --- extra/config/testMachine.dvm | 4 +- extra/dragon/disk1.dr | Bin 4194304 -> 4194304 bytes .../dss/DragonOS/drivers/keyboard_driver.dss | 2 +- extra/dss/DragonOS/kernel0/kernel0.dss | 29 +++++-- extra/dss/sdk/bios_api.dss | 2 +- other/build.nr | 2 +- src/assembler/Assembler.cpp | 13 +++- src/assembler/Assembler.hpp | 10 +-- src/assembler/DASMApp.cpp | 2 +- src/assembler/IncludePreprocessor.cpp | 6 +- src/assembler/assembler_main.cpp | 3 +- src/debugger/Debugger.cpp | 5 +- src/debugger/Debugger.hpp | 8 +- src/debugger/DebuggerNew.cpp | 13 ++-- src/debugger/DebuggerNew.hpp | 10 +-- src/debugger/DisassemblyLoader.cpp | 4 +- src/debugger/DisassemblyLoader.hpp | 2 +- src/debugger/debugger_main.cpp | 72 +++++++++--------- src/hardware/IMemoryDevice.hpp | 4 +- src/hardware/MemoryMapper.cpp | 6 +- src/hardware/MemoryMapper.hpp | 4 +- src/hardware/VirtualCPU.cpp | 25 +++++- src/hardware/VirtualCPU.hpp | 12 +-- src/hardware/VirtualHardDrive.hpp | 6 +- src/hardware/VirtualIODevices.cpp | 2 +- src/hardware/VirtualIODevices.hpp | 5 +- src/hardware/VirtualMMU.hpp | 6 +- src/hardware/VirtualRAM.hpp | 4 +- src/runtime/ConfigLoader.cpp | 10 +-- src/runtime/ConfigLoader.hpp | 6 +- src/runtime/DragonRuntime.cpp | 5 +- src/runtime/runtime_main.cpp | 3 +- src/tools/GlobalData.hpp | 15 ++-- src/tools/Tools.cpp | 8 +- src/tools/Tools.hpp | 2 +- src/tools/Utils.cpp | 8 +- src/tools/Utils.hpp | 8 +- src/tools/tools_main.cpp | 3 +- 38 files changed, 190 insertions(+), 139 deletions(-) diff --git a/extra/config/testMachine.dvm b/extra/config/testMachine.dvm index ecf8ba2..ded9b57 100644 --- a/extra/config/testMachine.dvm +++ b/extra/config/testMachine.dvm @@ -3,7 +3,7 @@ Bios = dragon/bios.bin CMOS = dragon/cmos.dr cpuext = extmov, extalu -fixed_clock = false +fixed_clock = true clock_rate_sec = 5000 memory_extension_pages = 16 @@ -11,4 +11,4 @@ screen_redraw_rate_per_second = 10 SingleColor_foreground = #009900FF SingleColor_background = #111111FF -16Color_Palette = 0 \ No newline at end of file +16Color_Palette = 0 diff --git a/extra/dragon/disk1.dr b/extra/dragon/disk1.dr index da2a39822ba610dc2f9102abeae7f7a02d8e7fd2..0612569bb8b3bf810437f452e099dfe1e1d88baa 100644 GIT binary patch delta 448 zcmW;GOHRT-9LMn)iU_S}Y4KSfMa1V+P!XS1*RD!P)dP3{6Js<=Vl^Zlfu*jzfF^nY z@8KC-xJ1A0;`9H_{3e;1D2h^1>|Od%_c)RbS?@kX^8Eh9GHoHuf_UkM)z6=;TaRW&gLF>lw-6#Ke?8d%avY@ZOAt=!oBvwIB&1w)PxKfB77_5UQo()OyCGYKZHm(}x%O1bQ)yqGnx-X=8Mw{l zZNXNR-zw8-_rKmG*U_KLk%l-^NTUZC^dgHK44CLc9{m_V0fVq$qlh64V+5lZ!#Et2 zFo8)-p^RzFU>0+zU>*xt#1fXV0)dNFtf7i^)Ubg~Y+)Na*u@_9aezbAar9n}8ejK+ D3VDJ2 diff --git a/extra/dss/DragonOS/drivers/keyboard_driver.dss b/extra/dss/DragonOS/drivers/keyboard_driver.dss index 7b0f9c5..e36ad95 100644 --- a/extra/dss/DragonOS/drivers/keyboard_driver.dss +++ b/extra/dss/DragonOS/drivers/keyboard_driver.dss @@ -10,4 +10,4 @@ _init_keyboard_driver: ## _init_keyboard_driver(func_ptr* key_pressed_handler) mov R10, 0x00 ## int 0x20 param for set_interrupt_handler mov R8, 0xA0 ## 0xA0 is the hardware interrupt for KeyPressed int 0x20 - ret \ No newline at end of file + ret diff --git a/extra/dss/DragonOS/kernel0/kernel0.dss b/extra/dss/DragonOS/kernel0/kernel0.dss index f9a6174..3841000 100644 --- a/extra/dss/DragonOS/kernel0/kernel0.dss +++ b/extra/dss/DragonOS/kernel0/kernel0.dss @@ -4,8 +4,8 @@ .header KERNEL0_BOOT @include <../../sdk/bios_api.dss> -@include <../drivers/keyboard_driver.dss> @include <../drivers/display_driver.dss> +@include <../drivers/keyboard_driver.dss> @include @@ -30,7 +30,7 @@ _kernel0_main: call $_print_string ## debug_break _infinite_loop_0: - jmp $_infinite_loop_0 + ## jmp $_infinite_loop_0 mov [$cursor_x], 0 @@ -58,16 +58,18 @@ _infinite_loop: ## ========================================================================================================================= _key_pressed: - ## debug_break + debug_break mov R1, [Keyboard_Registers.KEYCODE] mov ACC, KeyCodes.Return jeq $_key_pressed_enter, R1 - mov ACC, KeyCodes.LowerCase_a - jls $_key_pressed_end, R1 - mov ACC, KeyCodes.LowerCase_z - jgr $_key_pressed_end, R1 + push R1 + push 1 + call $_is_char_printable + + mov ACC, RV + jne $_key_pressed_end, 1 push R1 mov R2, [$cursor_x] push R2 @@ -87,4 +89,17 @@ _key_pressed_enter: _key_pressed_end: ret + + +_is_char_printable: + arg R9 + mov ACC, KeyCodes.Spacebar + jls $_is_char_printable_false, R9 + mov ACC, KeyCodes.LowerCase_z + jgr $_is_char_printable_false, R9 + mov RV, 1 + ret +_is_char_printable_false: + mov RV, 0 + ret ## ========================================================================================================================= diff --git a/extra/dss/sdk/bios_api.dss b/extra/dss/sdk/bios_api.dss index 6ff681d..b62fc46 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.1641) +## -- This file is automatically generated by the DragonAssembler (version 0.4.1642) ## -- Please do not modify this file in any way. ## -- diff --git a/other/build.nr b/other/build.nr index 9d1731d..138f1a9 100644 --- a/other/build.nr +++ b/other/build.nr @@ -1 +1 @@ -1642 +1643 diff --git a/src/assembler/Assembler.cpp b/src/assembler/Assembler.cpp index 0eb0ff4..508ae09 100644 --- a/src/assembler/Assembler.cpp +++ b/src/assembler/Assembler.cpp @@ -1,10 +1,10 @@ #include "Assembler.hpp" -#include +#include #include #include -#include -#include -#include +#include +#include +#include #include "../tools/GlobalData.hpp" #include "../hardware/VirtualHardDrive.hpp" @@ -1143,6 +1143,11 @@ namespace dragon m_code.push_back(data::OpCodes::DEBUG_Break); return; } + else if (ostd::String(line).toLower().startsWith("debug_ram_dump")) + { + m_code.push_back(data::OpCodes::DEBUG_DumpRAM); + return; + } else if (ostd::String(line).toLower().startsWith("debug_profile_stop")) { m_code.push_back(data::OpCodes::DEBUG_StopProfile); diff --git a/src/assembler/Assembler.hpp b/src/assembler/Assembler.hpp index 6e3f91b..385d6af 100644 --- a/src/assembler/Assembler.hpp +++ b/src/assembler/Assembler.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include +#include #include namespace dragon @@ -26,7 +26,7 @@ namespace dragon inline static std::vector m_lines; inline static std::vector m_guards; inline static ostd::String m_directory { "" }; - }; + }; class Assembler { @@ -170,7 +170,7 @@ namespace dragon inline static std::vector m_structDefs; inline static std::vector m_disassembly; - inline static std::unordered_map m_exports; + inline static std::unordered_map m_exports; inline static ostd::ConsoleOutputHandler out; @@ -180,4 +180,4 @@ namespace dragon inline static std::vector cpuExtensions; }; } -} \ No newline at end of file +} diff --git a/src/assembler/DASMApp.cpp b/src/assembler/DASMApp.cpp index e1a4483..72b90e8 100644 --- a/src/assembler/DASMApp.cpp +++ b/src/assembler/DASMApp.cpp @@ -1,5 +1,5 @@ #include "Assembler.hpp" -#include +#include namespace dragon { diff --git a/src/assembler/IncludePreprocessor.cpp b/src/assembler/IncludePreprocessor.cpp index 926f286..a5271c4 100644 --- a/src/assembler/IncludePreprocessor.cpp +++ b/src/assembler/IncludePreprocessor.cpp @@ -1,6 +1,6 @@ #include "Assembler.hpp" -#include +#include namespace dragon { @@ -12,7 +12,7 @@ namespace dragon m_lines.clear(); m_directory = ""; m_lines = __load_file(filePath); - + if (m_lines.size() == 0) return { }; //TODO: Error if (filePath.contains("/")) m_directory = filePath.new_substr(0, filePath.lastIndexOf("/") + 1); @@ -99,4 +99,4 @@ namespace dragon } } -} \ No newline at end of file +} diff --git a/src/assembler/assembler_main.cpp b/src/assembler/assembler_main.cpp index cf604d9..af9264d 100644 --- a/src/assembler/assembler_main.cpp +++ b/src/assembler/assembler_main.cpp @@ -1,3 +1,4 @@ +#include #include "Assembler.hpp" int main(int argc, char** argv) @@ -16,4 +17,4 @@ int main(int argc, char** argv) if (args.save_disassembly) dragon::code::Assembler::saveDisassemblyToFile(args.disassembly_file_path); return dragon::code::Assembler::Application::RETURN_VAL_EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/src/debugger/Debugger.cpp b/src/debugger/Debugger.cpp index 320e118..358d289 100644 --- a/src/debugger/Debugger.cpp +++ b/src/debugger/Debugger.cpp @@ -1,8 +1,7 @@ #include "Debugger.hpp" #include "../runtime/DragonRuntime.hpp" #include "DisassemblyLoader.hpp" -#include -#include +#include namespace dragon { @@ -1438,6 +1437,8 @@ namespace dragon processErrors(); if (DragonRuntime::cpu.isInDebugBreakPoint()) output().fg(ostd::ConsoleColors::Red).p("Reached Debug Break Point.").reset().nl(); + if (DragonRuntime::cpu.isRamDumped()) + output().fg(ostd::ConsoleColors::Red).p("RAM Dumped to .").reset().nl(); Display::printPrompt(); data().command = getCommandInput(); data().command.trim().toLower(); diff --git a/src/debugger/Debugger.hpp b/src/debugger/Debugger.hpp index 365dd41..50b7c7a 100644 --- a/src/debugger/Debugger.hpp +++ b/src/debugger/Debugger.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include +#include #include "../assembler/Assembler.hpp" namespace dragon @@ -87,7 +87,7 @@ namespace dragon static inline ostd::ConsoleOutputHandler& output(void) { return out; } static int32_t topLevelPrompt(void); static int32_t executeRuntime(void); - + private: static int32_t step_execution(bool& outUserQuit, bool exec_first_step = true); static int32_t normal_runtime(bool& outUserQuit); @@ -103,4 +103,4 @@ namespace dragon public: inline static const ostd::String InputCommandQuit = "//quit//"; }; -} \ No newline at end of file +} diff --git a/src/debugger/DebuggerNew.cpp b/src/debugger/DebuggerNew.cpp index 9f6da9b..ad3ca52 100644 --- a/src/debugger/DebuggerNew.cpp +++ b/src/debugger/DebuggerNew.cpp @@ -3,12 +3,11 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "DisassemblyLoader.hpp" #include "../runtime/DragonRuntime.hpp" @@ -701,7 +700,7 @@ namespace dragon m_wout.setWrapMode(ogfx::WindowBaseOutputHandler::eWrapMode::TripleDots); m_wout.setDefaultForegroundColor({ 180, 180, 180, 255 }); - std::cout << STR_BOOL(ostd::Utils::loadByteStreamFromFile("./test.dds", m_test)) << "\n"; + std::cout << STR_BOOL(ostd::Utils::loadByteStreamFromFile("./bios.bin", m_test)) << "\n"; } void DebuggerNew::handleSignal(ostd::tSignal& signal) diff --git a/src/debugger/DebuggerNew.hpp b/src/debugger/DebuggerNew.hpp index 56b3184..1a71581 100644 --- a/src/debugger/DebuggerNew.hpp +++ b/src/debugger/DebuggerNew.hpp @@ -1,10 +1,10 @@ #pragma once -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include diff --git a/src/debugger/DisassemblyLoader.cpp b/src/debugger/DisassemblyLoader.cpp index cb65e88..88343d2 100644 --- a/src/debugger/DisassemblyLoader.cpp +++ b/src/debugger/DisassemblyLoader.cpp @@ -1,7 +1,7 @@ #include "DisassemblyLoader.hpp" -#include -#include +#include +#include #include diff --git a/src/debugger/DisassemblyLoader.hpp b/src/debugger/DisassemblyLoader.hpp index bd16e48..b3e2684 100644 --- a/src/debugger/DisassemblyLoader.hpp +++ b/src/debugger/DisassemblyLoader.hpp @@ -2,7 +2,7 @@ #include "../assembler/Assembler.hpp" -#include +#include namespace dragon { diff --git a/src/debugger/debugger_main.cpp b/src/debugger/debugger_main.cpp index d52af3f..38479d7 100644 --- a/src/debugger/debugger_main.cpp +++ b/src/debugger/debugger_main.cpp @@ -1,54 +1,56 @@ -// #include "Debugger.hpp" +#include +#include "Debugger.hpp" #include "../runtime/DragonRuntime.hpp" -#include "DebuggerNew.hpp" -#include +// #include "DebuggerNew.hpp" +#include int main(int argc, char** argv) { - // //Loading commandline arguments - // int32_t rValue = dragon::Debugger::loadArguments(argc, argv); - // if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER) - // return 0; - // if (rValue != 0) return rValue; - - // //Initializing the runtime - // rValue = dragon::Debugger::initRuntime(); - // if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER) - // return 0; - // if (rValue != 0) return rValue; - - // //Running top-level prompt - // rValue = dragon::Debugger::topLevelPrompt(); - // if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER) - // return 0; - // if (rValue != 0) return rValue; - - // //Executing the runtime - // return dragon::Debugger::executeRuntime(); - - ostd::SignalHandler::init(); - dragon::DebuggerNew debuggerInstance; - debuggerInstance.initialize(2000, 1090, "DragonVM Live Debugger"); - debuggerInstance.setClearColor({ 5, 0, 0 }); - //Loading commandline arguments - int32_t rValue = debuggerInstance.loadArguments(argc, argv); + int32_t rValue = dragon::Debugger::loadArguments(argc, argv); if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER) return 0; if (rValue != 0) return rValue; //Initializing the runtime - rValue = debuggerInstance.initRuntime(); + rValue = dragon::Debugger::initRuntime(); if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER) return 0; if (rValue != 0) return rValue; - while (debuggerInstance.isRunning()) - { - debuggerInstance.update(); - } + //Running top-level prompt + rValue = dragon::Debugger::topLevelPrompt(); + if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER) + return 0; + if (rValue != 0) return rValue; + + //Executing the runtime + return dragon::Debugger::executeRuntime(); + + + + // dragon::DebuggerNew debuggerInstance; + // debuggerInstance.initialize(2000, 1090, "DragonVM Live Debugger"); + // debuggerInstance.setClearColor({ 5, 0, 0 }); + + // //Loading commandline arguments + // int32_t rValue = debuggerInstance.loadArguments(argc, argv); + // if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER) + // return 0; + // if (rValue != 0) return rValue; + + // //Initializing the runtime + // rValue = debuggerInstance.initRuntime(); + // if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER) + // return 0; + // if (rValue != 0) return rValue; + + // while (debuggerInstance.isRunning()) + // { + // debuggerInstance.update(); + // } return 0; } diff --git a/src/hardware/IMemoryDevice.hpp b/src/hardware/IMemoryDevice.hpp index 46f6311..ac0f776 100644 --- a/src/hardware/IMemoryDevice.hpp +++ b/src/hardware/IMemoryDevice.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace dragon { @@ -16,4 +16,4 @@ namespace dragon virtual inline ostd::ByteStream* getByteStream(void) = 0; }; } -} \ No newline at end of file +} diff --git a/src/hardware/MemoryMapper.cpp b/src/hardware/MemoryMapper.cpp index b220842..8fe11c2 100644 --- a/src/hardware/MemoryMapper.cpp +++ b/src/hardware/MemoryMapper.cpp @@ -1,5 +1,7 @@ #include "MemoryMapper.hpp" -#include +#include +#include +#include #include "../tools/GlobalData.hpp" @@ -71,4 +73,4 @@ namespace dragon return nullptr; //TODO: Error } } -} \ No newline at end of file +} diff --git a/src/hardware/MemoryMapper.hpp b/src/hardware/MemoryMapper.hpp index be1ba90..9479cba 100644 --- a/src/hardware/MemoryMapper.hpp +++ b/src/hardware/MemoryMapper.hpp @@ -1,7 +1,7 @@ #pragma once #include "IMemoryDevice.hpp" -#include +#include #include namespace dragon @@ -39,4 +39,4 @@ namespace dragon std::vector m_regions; }; } -} \ No newline at end of file +} diff --git a/src/hardware/VirtualCPU.cpp b/src/hardware/VirtualCPU.cpp index b685ccf..c061083 100644 --- a/src/hardware/VirtualCPU.cpp +++ b/src/hardware/VirtualCPU.cpp @@ -1,8 +1,8 @@ #include "VirtualCPU.hpp" #include "../tools/GlobalData.hpp" -#include -#include +#include +#include #include "../runtime/DragonRuntime.hpp" @@ -209,6 +209,7 @@ namespace dragon m_currentExtension = nullptr; m_currentExtInst = 0x00; m_isDebugBreakPoint = false; + m_ramDumped = false; m_isOffsetAddressingEnabled = readFlag(data::Flags::OffsetModeEnabled); if (m_isOffsetAddressingEnabled) m_currentOffset = readRegister(data::Registers::OFFSET); @@ -230,6 +231,13 @@ namespace dragon m_isDebugBreakPoint = true; } break; + case data::OpCodes::DEBUG_DumpRAM: + { + ostd::Utils::saveByteStreamToFile(*DragonRuntime::ram.getByteStream(), "ram_dump.bin"); + m_isDebugBreakPoint = true; + m_ramDumped = true; + } + break; case data::OpCodes::BIOSModeImm: { uint16_t tmpAddr = m_currentAddr; @@ -796,9 +804,17 @@ namespace dragon break; case data::OpCodes::CallImm: { + bool test = false; + if (readRegister(data::Registers::IP) == 0x2CF1) + test = true; uint16_t subroutineAddr = fetch16(); pushStackFrame(); writeRegister16(data::Registers::IP, subroutineAddr); + if (test) + { + std::cout << ostd::Utils::getHexStr(subroutineAddr, true, 2) << "\n"; + std::cin.get(); + } m_subroutineCounter++; } break; @@ -820,6 +836,11 @@ namespace dragon break; case data::OpCodes::ArgReg: { + if (isInDebugBreakPoint()) + { + std::cout << ostd::Utils::getHexStr(readRegister(data::Registers::IP)); + std::cin.get(); + } uint8_t regAddr = fetch8(); if (!isInSubRoutine()) break; int16_t pp_val = readRegister(data::Registers::PP); diff --git a/src/hardware/VirtualCPU.hpp b/src/hardware/VirtualCPU.hpp index 3c3e8f9..b8dbdd1 100644 --- a/src/hardware/VirtualCPU.hpp +++ b/src/hardware/VirtualCPU.hpp @@ -1,8 +1,8 @@ #pragma once -#include -#include -#include +#include +#include +#include #include "IMemoryDevice.hpp" #include "../debugger/Debugger.hpp" @@ -43,6 +43,7 @@ namespace dragon inline bool isHalted(void) const { return m_halt; } inline uint8_t getCurrentInstruction(void) const { return m_currentInst; } inline bool isInDebugBreakPoint(void) const { return m_isDebugBreakPoint; } + inline bool isRamDumped(void) const { return m_ramDumped; } inline bool isInBIOSMOde(void) const { return m_biosMode; } inline bool isInSubRoutine(void) const { return m_subroutineCounter > 0; } inline int32_t getSubRoutineCounter(void) const { return m_subroutineCounter; } @@ -50,7 +51,7 @@ namespace dragon inline uint8_t getCurrentCPUExtensionInstruction(void) const { return m_currentExtInst; } inline bool isOffsetAddressingModeEnabled(void) const { return m_isOffsetAddressingEnabled; } inline uint16_t getCurrentOffset(void) const { return m_currentOffset; } - + private: void __debug_store_stack_frame_string_on_push(void); @@ -65,6 +66,7 @@ namespace dragon bool m_biosMode { true }; int32_t m_interruptHandlerCount { 0 }; bool m_isDebugBreakPoint { false }; + bool m_ramDumped { false }; bool m_debugModeEnabled { false }; int32_t m_subroutineCounter { 0 }; bool m_debugProfilerStarted { false }; @@ -85,4 +87,4 @@ namespace dragon friend class dragon::Debugger; }; } -} \ No newline at end of file +} diff --git a/src/hardware/VirtualHardDrive.hpp b/src/hardware/VirtualHardDrive.hpp index c08027c..cfddb76 100644 --- a/src/hardware/VirtualHardDrive.hpp +++ b/src/hardware/VirtualHardDrive.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include +#include namespace dragon { @@ -20,7 +20,7 @@ namespace dragon bool writeBuffer(uint32_t addr); void unmount(void); - + inline bool isInitialized(void) const { return m_initialized; } inline uint64_t getSize(void) const { return m_fileSize; }; inline bool isSame(VirtualHardDrive& vhdd) { return m_diskID == vhdd.m_diskID; } @@ -35,4 +35,4 @@ namespace dragon inline static uint32_t s_nextDiskID = 0; }; } -} \ No newline at end of file +} diff --git a/src/hardware/VirtualIODevices.cpp b/src/hardware/VirtualIODevices.cpp index 85df556..697e055 100644 --- a/src/hardware/VirtualIODevices.cpp +++ b/src/hardware/VirtualIODevices.cpp @@ -1,5 +1,5 @@ #include "VirtualIODevices.hpp" -#include +#include #include "VirtualHardDrive.hpp" #include "MemoryMapper.hpp" diff --git a/src/hardware/VirtualIODevices.hpp b/src/hardware/VirtualIODevices.hpp index 7b3aeb8..0962fae 100644 --- a/src/hardware/VirtualIODevices.hpp +++ b/src/hardware/VirtualIODevices.hpp @@ -2,8 +2,9 @@ #include "IMemoryDevice.hpp" #include "../tools/GlobalData.hpp" -#include +#include #include +#include namespace dragon { @@ -429,4 +430,4 @@ namespace dragon }; } } -} \ No newline at end of file +} diff --git a/src/hardware/VirtualMMU.hpp b/src/hardware/VirtualMMU.hpp index f0b42c6..d307c58 100644 --- a/src/hardware/VirtualMMU.hpp +++ b/src/hardware/VirtualMMU.hpp @@ -1,12 +1,12 @@ #pragma once -#include +#include namespace dragon { namespace hw { - class VirtualMMU //TODO: Implement for later use + class VirtualMMU //TODO: Implement for later use { public: inline VirtualMMU(void) { init(); } @@ -20,4 +20,4 @@ namespace dragon inline static constexpr uint16_t PageSize = 512; }; } -} \ No newline at end of file +} diff --git a/src/hardware/VirtualRAM.hpp b/src/hardware/VirtualRAM.hpp index 472e6b0..b75f563 100644 --- a/src/hardware/VirtualRAM.hpp +++ b/src/hardware/VirtualRAM.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include "IMemoryDevice.hpp" namespace dragon @@ -22,4 +22,4 @@ namespace dragon ostd::serial::SerialIO m_memory; }; } -} \ No newline at end of file +} diff --git a/src/runtime/ConfigLoader.cpp b/src/runtime/ConfigLoader.cpp index d70a107..c5becf5 100644 --- a/src/runtime/ConfigLoader.cpp +++ b/src/runtime/ConfigLoader.cpp @@ -1,6 +1,6 @@ #include "ConfigLoader.hpp" -#include -#include +#include +#include #include "../hardware/CPUExtensions.hpp" namespace dragon @@ -95,8 +95,8 @@ namespace dragon lineEdit.trim().toLower(); if (!lineEdit.isNumeric()) continue; //TODO: Error config.memory_extension_pages = lineEdit.toInt(); - - //TODO: Warnings + + //TODO: Warnings if (config.memory_extension_pages < 0) config.memory_extension_pages = 0; if (config.memory_extension_pages > data::DefaultValues::MaxMemoryExtensionPages) @@ -126,4 +126,4 @@ namespace dragon config.m_valid = true; return config; } -} \ No newline at end of file +} diff --git a/src/runtime/ConfigLoader.hpp b/src/runtime/ConfigLoader.hpp index 5d913c0..1e5ad5d 100644 --- a/src/runtime/ConfigLoader.hpp +++ b/src/runtime/ConfigLoader.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include "../tools/GlobalData.hpp" @@ -19,7 +19,7 @@ namespace dragon ostd::Color singleColor_foreground; uint8_t text16_palette { 0 }; uint8_t screen_redraw_rate_per_second { 10 }; - + inline bool isValid(void) const { return m_valid; } inline void destroy(void) { for (auto& ptr : cpuext_list) delete ptr.second; } @@ -37,4 +37,4 @@ namespace dragon private: static const tMachineConfig& validate_machine_config(tMachineConfig& config); }; -} \ No newline at end of file +} diff --git a/src/runtime/DragonRuntime.cpp b/src/runtime/DragonRuntime.cpp index 7f03cde..5fff6b7 100644 --- a/src/runtime/DragonRuntime.cpp +++ b/src/runtime/DragonRuntime.cpp @@ -1,5 +1,4 @@ #include "DragonRuntime.hpp" -#include #include namespace dragon @@ -386,7 +385,7 @@ namespace dragon // out.fg(ostd::ConsoleColors::Red).p(getAvgClockSpeed()).nl().reset(); acc = 0; } - if (acc2 == (1000 / screenRedrawRate)) + if (acc2 == (1000.0 / screenRedrawRate)) { vDisplay.redrawScreen(); acc2 = 0; @@ -407,7 +406,7 @@ namespace dragon bool running = cpu.execute() && vDisplay.isRunning(); uint8_t screenRedrawRate = vCMOS.read8(data::CMOSRegisters::ScreenRedrawRate); vDisplay.update(); - if (s_enableScreenRedrawDelay && s_stepAcc2 == (1000 / screenRedrawRate)) + if (s_enableScreenRedrawDelay && s_stepAcc2 == (1000.0 / screenRedrawRate)) { vDisplay.redrawScreen(); s_stepAcc2 = 0; diff --git a/src/runtime/runtime_main.cpp b/src/runtime/runtime_main.cpp index 3a5c07c..cce81ec 100644 --- a/src/runtime/runtime_main.cpp +++ b/src/runtime/runtime_main.cpp @@ -1,4 +1,5 @@ -#include +#include +#include #include "DragonRuntime.hpp" int main(int argc, char** argv) diff --git a/src/tools/GlobalData.hpp b/src/tools/GlobalData.hpp index 1f7a73a..6c1397e 100644 --- a/src/tools/GlobalData.hpp +++ b/src/tools/GlobalData.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include +#include namespace dragon { @@ -294,7 +294,8 @@ namespace dragon inline static constexpr uint8_t BIOSModeImm = 0x02; inline static constexpr uint8_t DEBUG_StartProfile = 0x03; inline static constexpr uint8_t DEBUG_StopProfile = 0x04; - + inline static constexpr uint8_t DEBUG_DumpRAM = 0x05; + inline static constexpr uint8_t MovImmReg = 0x10; inline static constexpr uint8_t MovRegReg = 0x11; inline static constexpr uint8_t MovRegMem = 0x12; @@ -352,7 +353,7 @@ namespace dragon inline static constexpr uint8_t NotReg = 0x6A; inline static constexpr uint8_t NegReg = 0x6B; inline static constexpr uint8_t NegByteReg = 0x6C; - + inline static constexpr uint8_t JmpNotEqImm = 0x70; inline static constexpr uint8_t JmpNotEqReg = 0x71; inline static constexpr uint8_t JmpEqImm = 0x72; @@ -383,7 +384,7 @@ namespace dragon inline static constexpr uint8_t Ext14 = 0xED; inline static constexpr uint8_t Ext15 = 0xEE; inline static constexpr uint8_t Ext16 = 0xEF; - + inline static constexpr uint8_t ZeroFlag = 0xF0; inline static constexpr uint8_t SetFlag = 0xF1; inline static constexpr uint8_t ToggleFlag = 0xF2; @@ -394,11 +395,11 @@ namespace dragon static ostd::String getOpCodeString(uint8_t opCode); static uint8_t getInstructionSIze(uint8_t opCode); }; - + class DefaultValues { public: inline static constexpr uint8_t MaxMemoryExtensionPages = 255; }; } -} \ No newline at end of file +} diff --git a/src/tools/Tools.cpp b/src/tools/Tools.cpp index fa81a3b..34ca0f4 100644 --- a/src/tools/Tools.cpp +++ b/src/tools/Tools.cpp @@ -1,13 +1,13 @@ #include "Tools.hpp" -#include -#include -#include +#include +#include +#include #include #include "../hardware/VirtualHardDrive.hpp" #include "GlobalData.hpp" #include "debugger/DisassemblyLoader.hpp" -#include +#include namespace dragon { diff --git a/src/tools/Tools.hpp b/src/tools/Tools.hpp index 07a0c13..c5146cf 100644 --- a/src/tools/Tools.hpp +++ b/src/tools/Tools.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #include "GlobalData.hpp" #include diff --git a/src/tools/Utils.cpp b/src/tools/Utils.cpp index 74b0ee2..4b6720d 100644 --- a/src/tools/Utils.cpp +++ b/src/tools/Utils.cpp @@ -1,7 +1,7 @@ #include "Utils.hpp" -#include -#include -#include +#include +#include +#include namespace dragon { @@ -17,4 +17,4 @@ namespace dragon name.addChar(rnd_char()); return name; } -} \ No newline at end of file +} diff --git a/src/tools/Utils.hpp b/src/tools/Utils.hpp index 9ae90a7..0db4b89 100644 --- a/src/tools/Utils.hpp +++ b/src/tools/Utils.hpp @@ -1,7 +1,7 @@ #pragma once -#include -#include +#include +#include namespace dragon { @@ -9,5 +9,5 @@ namespace dragon { public: static ostd::String genRandomName(uint8_t length); - }; -} \ No newline at end of file + }; +} diff --git a/src/tools/tools_main.cpp b/src/tools/tools_main.cpp index 18d5fef..7b8b637 100644 --- a/src/tools/tools_main.cpp +++ b/src/tools/tools_main.cpp @@ -1,6 +1,7 @@ +#include #include "Tools.hpp" int main(int argc, char** argv) { return dragon::Tools::execute(argc, argv); -} \ No newline at end of file +}