Refactor to the new OmniaFramework structure

This commit is contained in:
OmniaX-Dev 2026-03-20 00:25:25 +01:00
parent d0e8f5d43d
commit 2486e5e4c0
38 changed files with 190 additions and 139 deletions

View file

@ -3,7 +3,7 @@ Bios = dragon/bios.bin
CMOS = dragon/cmos.dr CMOS = dragon/cmos.dr
cpuext = extmov, extalu cpuext = extmov, extalu
fixed_clock = false fixed_clock = true
clock_rate_sec = 5000 clock_rate_sec = 5000
memory_extension_pages = 16 memory_extension_pages = 16
@ -11,4 +11,4 @@ screen_redraw_rate_per_second = 10
SingleColor_foreground = #009900FF SingleColor_foreground = #009900FF
SingleColor_background = #111111FF SingleColor_background = #111111FF
16Color_Palette = 0 16Color_Palette = 0

Binary file not shown.

View file

@ -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 R10, 0x00 ## int 0x20 param for set_interrupt_handler
mov R8, 0xA0 ## 0xA0 is the hardware interrupt for KeyPressed mov R8, 0xA0 ## 0xA0 is the hardware interrupt for KeyPressed
int 0x20 int 0x20
ret ret

View file

@ -4,8 +4,8 @@
.header KERNEL0_BOOT .header KERNEL0_BOOT
@include <../../sdk/bios_api.dss> @include <../../sdk/bios_api.dss>
@include <../drivers/keyboard_driver.dss>
@include <../drivers/display_driver.dss> @include <../drivers/display_driver.dss>
@include <../drivers/keyboard_driver.dss>
@include <memory.dss> @include <memory.dss>
@ -30,7 +30,7 @@ _kernel0_main:
call $_print_string call $_print_string
## debug_break ## debug_break
_infinite_loop_0: _infinite_loop_0:
jmp $_infinite_loop_0 ## jmp $_infinite_loop_0
mov [$cursor_x], 0 mov [$cursor_x], 0
@ -58,16 +58,18 @@ _infinite_loop:
## ========================================================================================================================= ## =========================================================================================================================
_key_pressed: _key_pressed:
## debug_break debug_break
mov R1, [Keyboard_Registers.KEYCODE] mov R1, [Keyboard_Registers.KEYCODE]
mov ACC, KeyCodes.Return mov ACC, KeyCodes.Return
jeq $_key_pressed_enter, R1 jeq $_key_pressed_enter, R1
mov ACC, KeyCodes.LowerCase_a push R1
jls $_key_pressed_end, R1 push 1
mov ACC, KeyCodes.LowerCase_z call $_is_char_printable
jgr $_key_pressed_end, R1
mov ACC, RV
jne $_key_pressed_end, 1
push R1 push R1
mov R2, [$cursor_x] mov R2, [$cursor_x]
push R2 push R2
@ -87,4 +89,17 @@ _key_pressed_enter:
_key_pressed_end: _key_pressed_end:
ret 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
## ========================================================================================================================= ## =========================================================================================================================

View file

@ -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. ## -- Please do not modify this file in any way.
## -- ## --

View file

@ -1 +1 @@
1642 1643

View file

@ -1,10 +1,10 @@
#include "Assembler.hpp" #include "Assembler.hpp"
#include <ostd/File.hpp> #include <ostd/io/File.hpp>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <ostd/Utils.hpp> #include <ostd/utils/Utils.hpp>
#include <ostd/Serial.hpp> #include <ostd/io/Serial.hpp>
#include <ostd/IOHandlers.hpp> #include <ostd/io/IOHandlers.hpp>
#include "../tools/GlobalData.hpp" #include "../tools/GlobalData.hpp"
#include "../hardware/VirtualHardDrive.hpp" #include "../hardware/VirtualHardDrive.hpp"
@ -1143,6 +1143,11 @@ namespace dragon
m_code.push_back(data::OpCodes::DEBUG_Break); m_code.push_back(data::OpCodes::DEBUG_Break);
return; 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")) else if (ostd::String(line).toLower().startsWith("debug_profile_stop"))
{ {
m_code.push_back(data::OpCodes::DEBUG_StopProfile); m_code.push_back(data::OpCodes::DEBUG_StopProfile);

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <ostd/Utils.hpp> #include <ostd/utils/Utils.hpp>
#include <ostd/IOHandlers.hpp> #include <ostd/io/IOHandlers.hpp>
#include <unordered_map> #include <unordered_map>
namespace dragon namespace dragon
@ -26,7 +26,7 @@ namespace dragon
inline static std::vector<ostd::String> m_lines; inline static std::vector<ostd::String> m_lines;
inline static std::vector<ostd::String> m_guards; inline static std::vector<ostd::String> m_guards;
inline static ostd::String m_directory { "" }; inline static ostd::String m_directory { "" };
}; };
class Assembler class Assembler
{ {
@ -170,7 +170,7 @@ namespace dragon
inline static std::vector<tStructDefinition> m_structDefs; inline static std::vector<tStructDefinition> m_structDefs;
inline static std::vector<tDisassemblyLine> m_disassembly; inline static std::vector<tDisassemblyLine> m_disassembly;
inline static std::unordered_map<ostd::String, tExportSpec> m_exports; inline static std::unordered_map<ostd::String, tExportSpec> m_exports;
inline static ostd::ConsoleOutputHandler out; inline static ostd::ConsoleOutputHandler out;
@ -180,4 +180,4 @@ namespace dragon
inline static std::vector<ostd::String> cpuExtensions; inline static std::vector<ostd::String> cpuExtensions;
}; };
} }
} }

View file

@ -1,5 +1,5 @@
#include "Assembler.hpp" #include "Assembler.hpp"
#include <ostd/Random.hpp> #include <ostd/math/Random.hpp>
namespace dragon namespace dragon
{ {

View file

@ -1,6 +1,6 @@
#include "Assembler.hpp" #include "Assembler.hpp"
#include <ostd/File.hpp> #include <ostd/io/File.hpp>
namespace dragon namespace dragon
{ {
@ -12,7 +12,7 @@ namespace dragon
m_lines.clear(); m_lines.clear();
m_directory = ""; m_directory = "";
m_lines = __load_file(filePath); m_lines = __load_file(filePath);
if (m_lines.size() == 0) return { }; //TODO: Error if (m_lines.size() == 0) return { }; //TODO: Error
if (filePath.contains("/")) if (filePath.contains("/"))
m_directory = filePath.new_substr(0, filePath.lastIndexOf("/") + 1); m_directory = filePath.new_substr(0, filePath.lastIndexOf("/") + 1);
@ -99,4 +99,4 @@ namespace dragon
} }
} }
} }

View file

@ -1,3 +1,4 @@
#include <ostd/utils/Defines.hpp>
#include "Assembler.hpp" #include "Assembler.hpp"
int main(int argc, char** argv) int main(int argc, char** argv)
@ -16,4 +17,4 @@ int main(int argc, char** argv)
if (args.save_disassembly) if (args.save_disassembly)
dragon::code::Assembler::saveDisassemblyToFile(args.disassembly_file_path); dragon::code::Assembler::saveDisassemblyToFile(args.disassembly_file_path);
return dragon::code::Assembler::Application::RETURN_VAL_EXIT_SUCCESS; return dragon::code::Assembler::Application::RETURN_VAL_EXIT_SUCCESS;
} }

View file

@ -1,8 +1,7 @@
#include "Debugger.hpp" #include "Debugger.hpp"
#include "../runtime/DragonRuntime.hpp" #include "../runtime/DragonRuntime.hpp"
#include "DisassemblyLoader.hpp" #include "DisassemblyLoader.hpp"
#include <ostd/Defines.hpp> #include <ostd/io/Console.hpp>
#include <ostd/Console.hpp>
namespace dragon namespace dragon
{ {
@ -1438,6 +1437,8 @@ namespace dragon
processErrors(); processErrors();
if (DragonRuntime::cpu.isInDebugBreakPoint()) if (DragonRuntime::cpu.isInDebugBreakPoint())
output().fg(ostd::ConsoleColors::Red).p("Reached Debug Break Point.").reset().nl(); 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 <ram_dump.bin>.").reset().nl();
Display::printPrompt(); Display::printPrompt();
data().command = getCommandInput(); data().command = getCommandInput();
data().command.trim().toLower(); data().command.trim().toLower();

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <ostd/Utils.hpp> #include <ostd/utils/Utils.hpp>
#include <ostd/IOHandlers.hpp> #include <ostd/io/IOHandlers.hpp>
#include "../assembler/Assembler.hpp" #include "../assembler/Assembler.hpp"
namespace dragon namespace dragon
@ -87,7 +87,7 @@ namespace dragon
static inline ostd::ConsoleOutputHandler& output(void) { return out; } static inline ostd::ConsoleOutputHandler& output(void) { return out; }
static int32_t topLevelPrompt(void); static int32_t topLevelPrompt(void);
static int32_t executeRuntime(void); static int32_t executeRuntime(void);
private: private:
static int32_t step_execution(bool& outUserQuit, bool exec_first_step = true); static int32_t step_execution(bool& outUserQuit, bool exec_first_step = true);
static int32_t normal_runtime(bool& outUserQuit); static int32_t normal_runtime(bool& outUserQuit);
@ -103,4 +103,4 @@ namespace dragon
public: public:
inline static const ostd::String InputCommandQuit = "//quit//"; inline static const ostd::String InputCommandQuit = "//quit//";
}; };
} }

View file

@ -3,12 +3,11 @@
#include <cstdint> #include <cstdint>
#include <ogfx/BasicRenderer.hpp> #include <ogfx/BasicRenderer.hpp>
#include <ogfx/WindowBase.hpp> #include <ogfx/WindowBase.hpp>
#include <ostd/Defines.hpp> #include <ostd/math/Geometry.hpp>
#include <ostd/Geometry.hpp> #include <ostd/io/IOHandlers.hpp>
#include <ostd/IOHandlers.hpp> #include <ostd/math/Random.hpp>
#include <ostd/Random.hpp> #include <ostd/string/String.hpp>
#include <ostd/String.hpp> #include <ostd/utils/Utils.hpp>
#include <ostd/Utils.hpp>
#include "DisassemblyLoader.hpp" #include "DisassemblyLoader.hpp"
#include "../runtime/DragonRuntime.hpp" #include "../runtime/DragonRuntime.hpp"
@ -701,7 +700,7 @@ namespace dragon
m_wout.setWrapMode(ogfx::WindowBaseOutputHandler::eWrapMode::TripleDots); m_wout.setWrapMode(ogfx::WindowBaseOutputHandler::eWrapMode::TripleDots);
m_wout.setDefaultForegroundColor({ 180, 180, 180, 255 }); 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) void DebuggerNew::handleSignal(ostd::tSignal& signal)

View file

@ -1,10 +1,10 @@
#pragma once #pragma once
#include <ostd/Color.hpp> #include <ostd/data_types/Color.hpp>
#include <ostd/Geometry.hpp> #include <ostd/math/Geometry.hpp>
#include <ostd/Types.hpp> #include <ostd/data_types/Types.hpp>
#include <ostd/Utils.hpp> #include <ostd/utils/Utils.hpp>
#include <ostd/IOHandlers.hpp> #include <ostd/io/IOHandlers.hpp>
#include <ogfx/WindowBase.hpp> #include <ogfx/WindowBase.hpp>
#include <ogfx/BasicRenderer.hpp> #include <ogfx/BasicRenderer.hpp>
#include <ogfx/RawTextInput.hpp> #include <ogfx/RawTextInput.hpp>

View file

@ -1,7 +1,7 @@
#include "DisassemblyLoader.hpp" #include "DisassemblyLoader.hpp"
#include <ostd/File.hpp> #include <ostd/io/File.hpp>
#include <ostd/Serial.hpp> #include <ostd/io/Serial.hpp>
#include <algorithm> #include <algorithm>

View file

@ -2,7 +2,7 @@
#include "../assembler/Assembler.hpp" #include "../assembler/Assembler.hpp"
#include <ostd/Types.hpp> #include <ostd/data_types/Types.hpp>
namespace dragon namespace dragon
{ {

View file

@ -1,54 +1,56 @@
// #include "Debugger.hpp" #include <ostd/utils/Defines.hpp>
#include "Debugger.hpp"
#include "../runtime/DragonRuntime.hpp" #include "../runtime/DragonRuntime.hpp"
#include "DebuggerNew.hpp" // #include "DebuggerNew.hpp"
#include <ostd/Signals.hpp> #include <ostd/utils/Signals.hpp>
int main(int argc, char** argv) 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(); ostd::SignalHandler::init();
dragon::DebuggerNew debuggerInstance;
debuggerInstance.initialize(2000, 1090, "DragonVM Live Debugger");
debuggerInstance.setClearColor({ 5, 0, 0 });
//Loading commandline arguments //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) if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER)
return 0; return 0;
if (rValue != 0) return rValue; if (rValue != 0) return rValue;
//Initializing the runtime //Initializing the runtime
rValue = debuggerInstance.initRuntime(); rValue = dragon::Debugger::initRuntime();
if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER) if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER)
return 0; return 0;
if (rValue != 0) return rValue; if (rValue != 0) return rValue;
while (debuggerInstance.isRunning()) //Running top-level prompt
{ rValue = dragon::Debugger::topLevelPrompt();
debuggerInstance.update(); 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; return 0;
} }

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <ostd/BaseObject.hpp> #include <ostd/data_types/BaseObject.hpp>
namespace dragon namespace dragon
{ {
@ -16,4 +16,4 @@ namespace dragon
virtual inline ostd::ByteStream* getByteStream(void) = 0; virtual inline ostd::ByteStream* getByteStream(void) = 0;
}; };
} }
} }

View file

@ -1,5 +1,7 @@
#include "MemoryMapper.hpp" #include "MemoryMapper.hpp"
#include <ostd/Utils.hpp> #include <ostd/io/Serial.hpp>
#include <ostd/data_types/Types.hpp>
#include <ostd/utils/Utils.hpp>
#include "../tools/GlobalData.hpp" #include "../tools/GlobalData.hpp"
@ -71,4 +73,4 @@ namespace dragon
return nullptr; //TODO: Error return nullptr; //TODO: Error
} }
} }
} }

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "IMemoryDevice.hpp" #include "IMemoryDevice.hpp"
#include <ostd/String.hpp> #include <ostd/string/String.hpp>
#include <vector> #include <vector>
namespace dragon namespace dragon
@ -39,4 +39,4 @@ namespace dragon
std::vector<tMemoryRegion> m_regions; std::vector<tMemoryRegion> m_regions;
}; };
} }
} }

View file

@ -1,8 +1,8 @@
#include "VirtualCPU.hpp" #include "VirtualCPU.hpp"
#include "../tools/GlobalData.hpp" #include "../tools/GlobalData.hpp"
#include <ostd/Defines.hpp> #include <iostream>
#include <ostd/Utils.hpp> #include <ostd/utils/Utils.hpp>
#include "../runtime/DragonRuntime.hpp" #include "../runtime/DragonRuntime.hpp"
@ -209,6 +209,7 @@ namespace dragon
m_currentExtension = nullptr; m_currentExtension = nullptr;
m_currentExtInst = 0x00; m_currentExtInst = 0x00;
m_isDebugBreakPoint = false; m_isDebugBreakPoint = false;
m_ramDumped = false;
m_isOffsetAddressingEnabled = readFlag(data::Flags::OffsetModeEnabled); m_isOffsetAddressingEnabled = readFlag(data::Flags::OffsetModeEnabled);
if (m_isOffsetAddressingEnabled) if (m_isOffsetAddressingEnabled)
m_currentOffset = readRegister(data::Registers::OFFSET); m_currentOffset = readRegister(data::Registers::OFFSET);
@ -230,6 +231,13 @@ namespace dragon
m_isDebugBreakPoint = true; m_isDebugBreakPoint = true;
} }
break; 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: case data::OpCodes::BIOSModeImm:
{ {
uint16_t tmpAddr = m_currentAddr; uint16_t tmpAddr = m_currentAddr;
@ -796,9 +804,17 @@ namespace dragon
break; break;
case data::OpCodes::CallImm: case data::OpCodes::CallImm:
{ {
bool test = false;
if (readRegister(data::Registers::IP) == 0x2CF1)
test = true;
uint16_t subroutineAddr = fetch16(); uint16_t subroutineAddr = fetch16();
pushStackFrame(); pushStackFrame();
writeRegister16(data::Registers::IP, subroutineAddr); writeRegister16(data::Registers::IP, subroutineAddr);
if (test)
{
std::cout << ostd::Utils::getHexStr(subroutineAddr, true, 2) << "\n";
std::cin.get();
}
m_subroutineCounter++; m_subroutineCounter++;
} }
break; break;
@ -820,6 +836,11 @@ namespace dragon
break; break;
case data::OpCodes::ArgReg: case data::OpCodes::ArgReg:
{ {
if (isInDebugBreakPoint())
{
std::cout << ostd::Utils::getHexStr(readRegister(data::Registers::IP));
std::cin.get();
}
uint8_t regAddr = fetch8(); uint8_t regAddr = fetch8();
if (!isInSubRoutine()) break; if (!isInSubRoutine()) break;
int16_t pp_val = readRegister(data::Registers::PP); int16_t pp_val = readRegister(data::Registers::PP);

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
#include <ostd/Types.hpp> #include <ostd/data_types/Types.hpp>
#include <ostd/Utils.hpp> #include <ostd/utils/Utils.hpp>
#include <ostd/Bitfields.hpp> #include <ostd/data_types/Bitfields.hpp>
#include "IMemoryDevice.hpp" #include "IMemoryDevice.hpp"
#include "../debugger/Debugger.hpp" #include "../debugger/Debugger.hpp"
@ -43,6 +43,7 @@ namespace dragon
inline bool isHalted(void) const { return m_halt; } inline bool isHalted(void) const { return m_halt; }
inline uint8_t getCurrentInstruction(void) const { return m_currentInst; } inline uint8_t getCurrentInstruction(void) const { return m_currentInst; }
inline bool isInDebugBreakPoint(void) const { return m_isDebugBreakPoint; } 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 isInBIOSMOde(void) const { return m_biosMode; }
inline bool isInSubRoutine(void) const { return m_subroutineCounter > 0; } inline bool isInSubRoutine(void) const { return m_subroutineCounter > 0; }
inline int32_t getSubRoutineCounter(void) const { return m_subroutineCounter; } 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 uint8_t getCurrentCPUExtensionInstruction(void) const { return m_currentExtInst; }
inline bool isOffsetAddressingModeEnabled(void) const { return m_isOffsetAddressingEnabled; } inline bool isOffsetAddressingModeEnabled(void) const { return m_isOffsetAddressingEnabled; }
inline uint16_t getCurrentOffset(void) const { return m_currentOffset; } inline uint16_t getCurrentOffset(void) const { return m_currentOffset; }
private: private:
void __debug_store_stack_frame_string_on_push(void); void __debug_store_stack_frame_string_on_push(void);
@ -65,6 +66,7 @@ namespace dragon
bool m_biosMode { true }; bool m_biosMode { true };
int32_t m_interruptHandlerCount { 0 }; int32_t m_interruptHandlerCount { 0 };
bool m_isDebugBreakPoint { false }; bool m_isDebugBreakPoint { false };
bool m_ramDumped { false };
bool m_debugModeEnabled { false }; bool m_debugModeEnabled { false };
int32_t m_subroutineCounter { 0 }; int32_t m_subroutineCounter { 0 };
bool m_debugProfilerStarted { false }; bool m_debugProfilerStarted { false };
@ -85,4 +87,4 @@ namespace dragon
friend class dragon::Debugger; friend class dragon::Debugger;
}; };
} }
} }

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <fstream> #include <fstream>
#include <ostd/Utils.hpp> #include <ostd/utils/Utils.hpp>
namespace dragon namespace dragon
{ {
@ -20,7 +20,7 @@ namespace dragon
bool writeBuffer(uint32_t addr); bool writeBuffer(uint32_t addr);
void unmount(void); void unmount(void);
inline bool isInitialized(void) const { return m_initialized; } inline bool isInitialized(void) const { return m_initialized; }
inline uint64_t getSize(void) const { return m_fileSize; }; inline uint64_t getSize(void) const { return m_fileSize; };
inline bool isSame(VirtualHardDrive& vhdd) { return m_diskID == vhdd.m_diskID; } inline bool isSame(VirtualHardDrive& vhdd) { return m_diskID == vhdd.m_diskID; }
@ -35,4 +35,4 @@ namespace dragon
inline static uint32_t s_nextDiskID = 0; inline static uint32_t s_nextDiskID = 0;
}; };
} }
} }

View file

@ -1,5 +1,5 @@
#include "VirtualIODevices.hpp" #include "VirtualIODevices.hpp"
#include <ostd/Utils.hpp> #include <ostd/utils/Utils.hpp>
#include "VirtualHardDrive.hpp" #include "VirtualHardDrive.hpp"
#include "MemoryMapper.hpp" #include "MemoryMapper.hpp"

View file

@ -2,8 +2,9 @@
#include "IMemoryDevice.hpp" #include "IMemoryDevice.hpp"
#include "../tools/GlobalData.hpp" #include "../tools/GlobalData.hpp"
#include <ostd/Serial.hpp> #include <ostd/io/Serial.hpp>
#include <fstream> #include <fstream>
#include <unordered_map>
namespace dragon namespace dragon
{ {
@ -429,4 +430,4 @@ namespace dragon
}; };
} }
} }
} }

View file

@ -1,12 +1,12 @@
#pragma once #pragma once
#include <ostd/Serial.hpp> #include <ostd/io/Serial.hpp>
namespace dragon namespace dragon
{ {
namespace hw namespace hw
{ {
class VirtualMMU //TODO: Implement for later use class VirtualMMU //TODO: Implement for later use
{ {
public: public:
inline VirtualMMU(void) { init(); } inline VirtualMMU(void) { init(); }
@ -20,4 +20,4 @@ namespace dragon
inline static constexpr uint16_t PageSize = 512; inline static constexpr uint16_t PageSize = 512;
}; };
} }
} }

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <ostd/Serial.hpp> #include <ostd/io/Serial.hpp>
#include "IMemoryDevice.hpp" #include "IMemoryDevice.hpp"
namespace dragon namespace dragon
@ -22,4 +22,4 @@ namespace dragon
ostd::serial::SerialIO m_memory; ostd::serial::SerialIO m_memory;
}; };
} }
} }

View file

@ -1,6 +1,6 @@
#include "ConfigLoader.hpp" #include "ConfigLoader.hpp"
#include <ostd/File.hpp> #include <ostd/io/File.hpp>
#include <ostd/Utils.hpp> #include <ostd/utils/Utils.hpp>
#include "../hardware/CPUExtensions.hpp" #include "../hardware/CPUExtensions.hpp"
namespace dragon namespace dragon
@ -95,8 +95,8 @@ namespace dragon
lineEdit.trim().toLower(); lineEdit.trim().toLower();
if (!lineEdit.isNumeric()) continue; //TODO: Error if (!lineEdit.isNumeric()) continue; //TODO: Error
config.memory_extension_pages = lineEdit.toInt(); config.memory_extension_pages = lineEdit.toInt();
//TODO: Warnings //TODO: Warnings
if (config.memory_extension_pages < 0) if (config.memory_extension_pages < 0)
config.memory_extension_pages = 0; config.memory_extension_pages = 0;
if (config.memory_extension_pages > data::DefaultValues::MaxMemoryExtensionPages) if (config.memory_extension_pages > data::DefaultValues::MaxMemoryExtensionPages)
@ -126,4 +126,4 @@ namespace dragon
config.m_valid = true; config.m_valid = true;
return config; return config;
} }
} }

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <ostd/Color.hpp> #include <ostd/data_types/Color.hpp>
#include <map> #include <map>
#include "../tools/GlobalData.hpp" #include "../tools/GlobalData.hpp"
@ -19,7 +19,7 @@ namespace dragon
ostd::Color singleColor_foreground; ostd::Color singleColor_foreground;
uint8_t text16_palette { 0 }; uint8_t text16_palette { 0 };
uint8_t screen_redraw_rate_per_second { 10 }; uint8_t screen_redraw_rate_per_second { 10 };
inline bool isValid(void) const { return m_valid; } inline bool isValid(void) const { return m_valid; }
inline void destroy(void) { for (auto& ptr : cpuext_list) delete ptr.second; } inline void destroy(void) { for (auto& ptr : cpuext_list) delete ptr.second; }
@ -37,4 +37,4 @@ namespace dragon
private: private:
static const tMachineConfig& validate_machine_config(tMachineConfig& config); static const tMachineConfig& validate_machine_config(tMachineConfig& config);
}; };
} }

View file

@ -1,5 +1,4 @@
#include "DragonRuntime.hpp" #include "DragonRuntime.hpp"
#include <ostd/Defines.hpp>
#include <ogfx/PixelRenderer.hpp> #include <ogfx/PixelRenderer.hpp>
namespace dragon namespace dragon
@ -386,7 +385,7 @@ namespace dragon
// out.fg(ostd::ConsoleColors::Red).p(getAvgClockSpeed()).nl().reset(); // out.fg(ostd::ConsoleColors::Red).p(getAvgClockSpeed()).nl().reset();
acc = 0; acc = 0;
} }
if (acc2 == (1000 / screenRedrawRate)) if (acc2 == (1000.0 / screenRedrawRate))
{ {
vDisplay.redrawScreen(); vDisplay.redrawScreen();
acc2 = 0; acc2 = 0;
@ -407,7 +406,7 @@ namespace dragon
bool running = cpu.execute() && vDisplay.isRunning(); bool running = cpu.execute() && vDisplay.isRunning();
uint8_t screenRedrawRate = vCMOS.read8(data::CMOSRegisters::ScreenRedrawRate); uint8_t screenRedrawRate = vCMOS.read8(data::CMOSRegisters::ScreenRedrawRate);
vDisplay.update(); vDisplay.update();
if (s_enableScreenRedrawDelay && s_stepAcc2 == (1000 / screenRedrawRate)) if (s_enableScreenRedrawDelay && s_stepAcc2 == (1000.0 / screenRedrawRate))
{ {
vDisplay.redrawScreen(); vDisplay.redrawScreen();
s_stepAcc2 = 0; s_stepAcc2 = 0;

View file

@ -1,4 +1,5 @@
#include <ostd/Utils.hpp> #include <ostd/utils/Defines.hpp>
#include <ostd/utils/Utils.hpp>
#include "DragonRuntime.hpp" #include "DragonRuntime.hpp"
int main(int argc, char** argv) int main(int argc, char** argv)

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <ostd/Types.hpp> #include <ostd/data_types/Types.hpp>
#include <ostd/Color.hpp> #include <ostd/data_types/Color.hpp>
namespace dragon namespace dragon
{ {
@ -294,7 +294,8 @@ namespace dragon
inline static constexpr uint8_t BIOSModeImm = 0x02; inline static constexpr uint8_t BIOSModeImm = 0x02;
inline static constexpr uint8_t DEBUG_StartProfile = 0x03; inline static constexpr uint8_t DEBUG_StartProfile = 0x03;
inline static constexpr uint8_t DEBUG_StopProfile = 0x04; 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 MovImmReg = 0x10;
inline static constexpr uint8_t MovRegReg = 0x11; inline static constexpr uint8_t MovRegReg = 0x11;
inline static constexpr uint8_t MovRegMem = 0x12; 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 NotReg = 0x6A;
inline static constexpr uint8_t NegReg = 0x6B; inline static constexpr uint8_t NegReg = 0x6B;
inline static constexpr uint8_t NegByteReg = 0x6C; inline static constexpr uint8_t NegByteReg = 0x6C;
inline static constexpr uint8_t JmpNotEqImm = 0x70; inline static constexpr uint8_t JmpNotEqImm = 0x70;
inline static constexpr uint8_t JmpNotEqReg = 0x71; inline static constexpr uint8_t JmpNotEqReg = 0x71;
inline static constexpr uint8_t JmpEqImm = 0x72; 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 Ext14 = 0xED;
inline static constexpr uint8_t Ext15 = 0xEE; inline static constexpr uint8_t Ext15 = 0xEE;
inline static constexpr uint8_t Ext16 = 0xEF; inline static constexpr uint8_t Ext16 = 0xEF;
inline static constexpr uint8_t ZeroFlag = 0xF0; inline static constexpr uint8_t ZeroFlag = 0xF0;
inline static constexpr uint8_t SetFlag = 0xF1; inline static constexpr uint8_t SetFlag = 0xF1;
inline static constexpr uint8_t ToggleFlag = 0xF2; inline static constexpr uint8_t ToggleFlag = 0xF2;
@ -394,11 +395,11 @@ namespace dragon
static ostd::String getOpCodeString(uint8_t opCode); static ostd::String getOpCodeString(uint8_t opCode);
static uint8_t getInstructionSIze(uint8_t opCode); static uint8_t getInstructionSIze(uint8_t opCode);
}; };
class DefaultValues class DefaultValues
{ {
public: public:
inline static constexpr uint8_t MaxMemoryExtensionPages = 255; inline static constexpr uint8_t MaxMemoryExtensionPages = 255;
}; };
} }
} }

View file

@ -1,13 +1,13 @@
#include "Tools.hpp" #include "Tools.hpp"
#include <ostd/Color.hpp> #include <ostd/data_types/Color.hpp>
#include <ostd/IOHandlers.hpp> #include <ostd/io/IOHandlers.hpp>
#include <ostd/Utils.hpp> #include <ostd/utils/Utils.hpp>
#include <fstream> #include <fstream>
#include "../hardware/VirtualHardDrive.hpp" #include "../hardware/VirtualHardDrive.hpp"
#include "GlobalData.hpp" #include "GlobalData.hpp"
#include "debugger/DisassemblyLoader.hpp" #include "debugger/DisassemblyLoader.hpp"
#include <ostd/Serial.hpp> #include <ostd/io/Serial.hpp>
namespace dragon namespace dragon
{ {

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <ostd/IOHandlers.hpp> #include <ostd/io/IOHandlers.hpp>
#include "GlobalData.hpp" #include "GlobalData.hpp"
#include <unordered_map> #include <unordered_map>

View file

@ -1,7 +1,7 @@
#include "Utils.hpp" #include "Utils.hpp"
#include <ostd/Serial.hpp> #include <ostd/io/Serial.hpp>
#include <ostd/Utils.hpp> #include <ostd/utils/Utils.hpp>
#include <ostd/Random.hpp> #include <ostd/math/Random.hpp>
namespace dragon namespace dragon
{ {
@ -17,4 +17,4 @@ namespace dragon
name.addChar(rnd_char()); name.addChar(rnd_char());
return name; return name;
} }
} }

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <ostd/Types.hpp> #include <ostd/data_types/Types.hpp>
#include <ostd/String.hpp> #include <ostd/string/String.hpp>
namespace dragon namespace dragon
{ {
@ -9,5 +9,5 @@ namespace dragon
{ {
public: public:
static ostd::String genRandomName(uint8_t length); static ostd::String genRandomName(uint8_t length);
}; };
} }

View file

@ -1,6 +1,7 @@
#include <ostd/utils/Defines.hpp>
#include "Tools.hpp" #include "Tools.hpp"
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
return dragon::Tools::execute(argc, argv); return dragon::Tools::execute(argc, argv);
} }