Updated to new OmniaFramework version

This commit is contained in:
OmniaX-Dev 2026-05-15 05:37:12 +02:00
parent 3123ae6231
commit 6f0bed74d2
18 changed files with 218 additions and 203 deletions

View file

@ -177,8 +177,8 @@ if (UNIX)
target_link_libraries(${DEBUGGER_TARGET} xcb xcb-randr boost_regex)
endif (UNIX)
target_link_libraries(${RUNTIME_TARGET} SDL2main SDL2 SDL2_image)
target_link_libraries(${DEBUGGER_TARGET} SDL2main SDL2 SDL2_image)
target_link_libraries(${RUNTIME_TARGET} SDL3 SDL3_image)
target_link_libraries(${DEBUGGER_TARGET} SDL3 SDL3_image)
target_link_libraries(${RUNTIME_TARGET} ostd ogfx)
target_link_libraries(${DEBUGGER_TARGET} ostd ogfx)

18
build
View file

@ -72,5 +72,23 @@ else
./ddb config/testMachine.dvm --verbose-load
backtrack_changes
cd ..
elif [[ "$1" == "gdb" ]]; then
printf "\n\033[0;32mDebugging Test Application...\n\n\033[0m"
cd bin
./reload_env.sh
gdb -batch \
-ex 'set pagination off' \
-ex 'set print pretty on' \
-ex 'set logging file gdb-last.log' \
-ex 'set logging overwrite on' \
-ex 'set logging on' \
-ex 'handle SIGPIPE nostop noprint pass' \
-ex run \
-ex 'bt full' \
-ex 'info locals' \
-ex 'info args' \
-ex quit \
--args ./dvm config/testMachine.dvm
cd ..
fi
fi

Binary file not shown.

View file

@ -1,5 +1,5 @@
## --
## -- This file is automatically generated by the DragonAssembler (version 0.4.1645)
## -- This file is automatically generated by the DragonAssembler (version 0.4.1646)
## -- Please do not modify this file in any way.
## --

View file

@ -5,6 +5,7 @@
#include <ostd/io/Memory.hpp>
#include <ostd/string/String.hpp>
#include <ostd/utils/Time.hpp>
#include <ostd/utils/Signals.hpp>
namespace dragon
{
@ -15,12 +16,12 @@ namespace dragon
{
validate();
enableSignals();
connectSignal(ostd::tBuiltinSignals::WindowClosed);
connectSignal(ostd::BuiltinSignals::WindowClosed);
}
void Debugger::tCloseEventListener::handleSignal(ostd::tSignal& signal)
void Debugger::tCloseEventListener::handleSignal(ostd::Signal& signal)
{
m_mainWindowClosed = signal.ID == ostd::tBuiltinSignals::WindowClosed;
m_mainWindowClosed = signal.ID == ostd::BuiltinSignals::WindowClosed;
}
@ -1418,7 +1419,7 @@ namespace dragon
output().fg(ostd::ConsoleColors::Yellow).p("Press <Escape> to enter in step-execution mode...").reset().nl();
while (!userQuit)
{
ostd::SignalHandler::refresh();
ostd::SignalHandler::handleDelegateSignals();
if (closeEventListener.hasHappened())
userQuit = true;
data().command.clr();

View file

@ -42,7 +42,7 @@ namespace dragon
struct tCloseEventListener : public ostd::BaseObject
{
void init(void);
void handleSignal(ostd::tSignal& signal);
void handleSignal(ostd::Signal& signal);
inline bool hasHappened(void) const { return m_mainWindowClosed; }
private:

View file

@ -1,13 +1,14 @@
#include "DebuggerNew.hpp"
#include <SDL2/SDL_keycode.h>
#include <cstdint>
#include <ogfx/BasicRenderer.hpp>
#include <ogfx/WindowBase.hpp>
#include <ogfx/render/BasicRenderer.hpp>
#include <ogfx/gui/Window.hpp>
#include <ostd/io/Memory.hpp>
#include <ostd/math/Geometry.hpp>
#include <ostd/io/IOHandlers.hpp>
#include <ostd/math/Random.hpp>
#include <ostd/string/String.hpp>
#include <ostd/utils/Signals.hpp>
#include "DisassemblyLoader.hpp"
#include "../runtime/DragonRuntime.hpp"
@ -15,20 +16,20 @@ namespace ogfx
{
namespace gui
{
Button::EventListener::EventListener(Button& _parent) : parent(_parent)
CustomButton::EventListener::EventListener(CustomButton& _parent) : parent(_parent)
{
connectSignal(ostd::tBuiltinSignals::KeyPressed);
connectSignal(ostd::tBuiltinSignals::KeyReleased);
connectSignal(ostd::tBuiltinSignals::MouseMoved);
connectSignal(ostd::tBuiltinSignals::MousePressed);
connectSignal(ostd::tBuiltinSignals::MouseReleased);
connectSignal(ostd::tBuiltinSignals::OnGuiEvent);
connectSignal(ostd::tBuiltinSignals::WindowResized);
connectSignal(ostd::BuiltinSignals::KeyPressed);
connectSignal(ostd::BuiltinSignals::KeyReleased);
connectSignal(ostd::BuiltinSignals::MouseMoved);
connectSignal(ostd::BuiltinSignals::MousePressed);
connectSignal(ostd::BuiltinSignals::MouseReleased);
connectSignal(ostd::BuiltinSignals::OnGuiEvent);
connectSignal(ostd::BuiltinSignals::WindowResized);
}
void Button::EventListener::handleSignal(ostd::tSignal& signal)
void CustomButton::EventListener::handleSignal(ostd::Signal& signal)
{
if (signal.ID == ostd::tBuiltinSignals::KeyPressed)
if (signal.ID == ostd::BuiltinSignals::KeyPressed)
{
if (m_lastEvent != eEventType::KeyPressed)
{
@ -51,7 +52,7 @@ namespace ogfx
{
}
}
else if (signal.ID == ostd::tBuiltinSignals::MouseMoved)
else if (signal.ID == ostd::BuiltinSignals::MouseMoved)
{
auto& data = (ogfx::MouseEventData&)signal.userData;
if (parent.contains((float)data.position_x, (float)data.position_y))
@ -59,7 +60,7 @@ namespace ogfx
else
parent.m_mouseInside = false;
}
else if (signal.ID == ostd::tBuiltinSignals::MousePressed)
else if (signal.ID == ostd::BuiltinSignals::MousePressed)
{
auto& data = (ogfx::MouseEventData&)signal.userData;
if (data.button == ogfx::MouseEventData::eButton::Left && parent.m_gfx != nullptr && parent.m_mouseInside)
@ -70,7 +71,7 @@ namespace ogfx
parent.m_pressed = true;
}
}
else if (signal.ID == ostd::tBuiltinSignals::MouseReleased)
else if (signal.ID == ostd::BuiltinSignals::MouseReleased)
{
auto& data = (ogfx::MouseEventData&)signal.userData;
if (data.button == ogfx::MouseEventData::eButton::Left && parent.m_gfx != nullptr)
@ -78,7 +79,7 @@ namespace ogfx
if (parent.m_pressed)
{
ActionEventData aed(parent, parent.getName(), eActionEventType::Pressed, ostd::BaseObject::InvalidRef());
ostd::SignalHandler::emitSignal(Button::actionEventSignalID, ostd::tSignalPriority::RealTime, aed);
ostd::SignalHandler::emitSignal(CustomButton::actionEventSignalID, ostd::Signal::Priority::RealTime, aed);
}
parent.m_pressed = false;
}
@ -90,7 +91,7 @@ namespace ogfx
Button& Button::create(const ostd::Vec2& position, const ostd::Vec2& size, const ostd::String& name)
CustomButton& CustomButton::create(const ostd::Vec2& position, const ostd::Vec2& size, const ostd::String& name)
{
setPosition(position);
setSize(size);
@ -100,7 +101,7 @@ namespace ogfx
return *this;
}
void Button::render(ogfx::BasicRenderer2D& gfx)
void CustomButton::render(ogfx::BasicRenderer2D& gfx)
{
m_gfx = &gfx;
ostd::Color backgroundColor = m_theme.backgroundColor;
@ -121,34 +122,34 @@ namespace ogfx
gfx.outlinedRect(*this, backgroundColor, borderColor, 2);
if (m_text.len() > 0)
{
ostd::IPoint strSize = gfx.getStringSize(m_text, m_theme.fontSize);
ostd::IPoint strSize = gfx.getStringDimensions(m_text, m_theme.fontSize);
ostd::Vec2 txtPos = getPosition() + ostd::Vec2 { (getw() / 2.0f) - (strSize.x / 2.0f), (geth() / 2.0f) - (strSize.y / 2.0f) };
gfx.drawString(m_text, txtPos, textColor, m_theme.fontSize);
}
onRender(gfx);
}
void Button::update(void)
void CustomButton::update(void)
{
onUpdate();
}
void Button::fixedUpdate(void)
void CustomButton::fixedUpdate(void)
{
onFixedUpdate();
}
void Button::setText(const ostd::String& text)
void CustomButton::setText(const ostd::String& text)
{
m_text = text;
}
void Button::appendText(const ostd::String& text)
void CustomButton::appendText(const ostd::String& text)
{
m_text.add(text);
}
void Button::setTheme(Theme theme)
void CustomButton::setTheme(Theme theme)
{
m_theme = theme;
}
@ -256,7 +257,7 @@ namespace dragon
while (dragon::data::ErrorHandler::hasError())
{
auto err = dragon::data::ErrorHandler::popError();
out.nl().fg(ostd::ConsoleColors::Red).p("Error ").p(ostd::String::getHexStr(err.code, true, 8).cpp_str()).p(": ").p(err.text.cpp_str()).nl();
out().nl().fg(ostd::ConsoleColors::Red).p("Error ").p(ostd::String::getHexStr(err.code, true, 8).cpp_str()).p(": ").p(err.text.cpp_str()).nl();
}
debugger.args.step_exec = true;
}
@ -265,8 +266,8 @@ namespace dragon
{
if (argc < 2)
{
out.fg(ostd::ConsoleColors::Red).p("Error: too few arguments.").nl();
out.fg(ostd::ConsoleColors::Red).p("Use the --help option for more info.").reset().nl();
out().fg(ostd::ConsoleColors::Red).p("Error: too few arguments.").nl();
out().fg(ostd::ConsoleColors::Red).p("Use the --help option for more info.").reset().nl();
return DragonRuntime::RETURN_VAL_TOO_FEW_ARGUMENTS;
}
else
@ -357,12 +358,12 @@ namespace dragon
{
int32_t rValue = 0;
bool userQuit = false;
output().clear().fg(ostd::ConsoleColors::Green).p("Program running...").nl();
out().clear().fg(ostd::ConsoleColors::Green).p("Program running...").nl();
if (!data().args.step_exec)
output().fg(ostd::ConsoleColors::Yellow).p("Press <Escape> to enter in step-execution mode...").reset().nl();
out().fg(ostd::ConsoleColors::Yellow).p("Press <Escape> to enter in step-execution mode...").reset().nl();
while (!userQuit)
{
ostd::SignalHandler::refresh();
ostd::SignalHandler::handleDelegateSignals();
// if (closeEventListener.hasHappened())
// userQuit = true;
data().command.clr();
@ -372,7 +373,7 @@ namespace dragon
rValue = normal_runtime(userQuit);
data().currentAddress = DragonRuntime::cpu.readRegister(data::Registers::IP);
}
output().nl().fg(ostd::ConsoleColors::Yellow).p("Execution terminated.").nl().nl().reset();
out().nl().fg(ostd::ConsoleColors::Yellow).p("Execution terminated.").nl().nl().reset();
return rValue;
}
@ -383,7 +384,7 @@ namespace dragon
// Display::printStep();
processErrors();
if (DragonRuntime::cpu.isInDebugBreakPoint())
output().fg(ostd::ConsoleColors::Red).p("Reached Debug Break Point.").reset().nl();
out().fg(ostd::ConsoleColors::Red).p("Reached Debug Break Point.").reset().nl();
// Display::printPrompt();
data().command = getCommandInput();
data().command.trim().toLower();
@ -391,7 +392,7 @@ namespace dragon
{
if (data().command == "q" || data().command == "quit" || data().command == InputCommandQuit)
{
output().nl();
out().nl();
outUserQuit = true;
data().command = "";
}
@ -399,8 +400,8 @@ namespace dragon
{
data().args.step_exec = false;
data().command = "";
output().clear().fg(ostd::ConsoleColors::Green).p("Program running...").nl();
output().fg(ostd::ConsoleColors::Yellow).p("Press <Escape> to enter in step-execution mode...").reset().nl();
out().clear().fg(ostd::ConsoleColors::Green).p("Program running...").nl();
out().fg(ostd::ConsoleColors::Yellow).p("Press <Escape> to enter in step-execution mode...").reset().nl();
}
else if (data().command.startsWith("p ") || data().command.startsWith("print "))
{
@ -442,18 +443,18 @@ namespace dragon
rgx.fg("\\(|\\)|-", "darkgray");
rgx.fg("\\*", "red");
rgx.fg("0x[0-9A-Fa-f]+|0b[0-1]+|(?<!\\w)[0-9]+(?!\\w)", "cyan"); //Number Constants
output().pStyled(rgx);
output().fg(ostd::ConsoleColors::White).p(" = ");
output().fg(ostd::ConsoleColors::Gray).p("[");
out().pStyled(rgx);
out().fg(ostd::ConsoleColors::White).p(" = ");
out().fg(ostd::ConsoleColors::Gray).p("[");
for (uint16_t a = addr; a <= end_addr; a++)
{
uint8_t value = DragonRuntime::memMap.read8(a);
output().fg(ostd::ConsoleColors::BrightRed).p(ostd::String::getHexStr(value, true, 1));
out().fg(ostd::ConsoleColors::BrightRed).p(ostd::String::getHexStr(value, true, 1));
if (a < end_addr)
output().p(" ");
out().p(" ");
}
output().fg(ostd::ConsoleColors::Gray).p("]");
output().reset().nl();
out().fg(ostd::ConsoleColors::Gray).p("]");
out().reset().nl();
}
else if (data().command.startsWith("$"))
{
@ -462,7 +463,7 @@ namespace dragon
if (addr == 0)
addr = findSymbol(debugger.labels, data().command, &size);
if (addr == 0)
output().fg(ostd::ConsoleColors::Red).p("Unknown symbol for <print> command.").reset().nl();
out().fg(ostd::ConsoleColors::Red).p("Unknown symbol for <print> command.").reset().nl();
else
{
ostd::String tmp = "";
@ -474,32 +475,32 @@ namespace dragon
rgx.fg("\\(|\\)|-", "darkgray");
rgx.fg("\\*", "red");
rgx.fg("0x[0-9A-Fa-f]+|0b[0-1]+|(?<!\\w)[0-9]+(?!\\w)", "cyan"); //Number Constants
output().pStyled(rgx);
output().fg(ostd::ConsoleColors::White).p(" = ");
output().fg(ostd::ConsoleColors::Gray).p("[");
out().pStyled(rgx);
out().fg(ostd::ConsoleColors::White).p(" = ");
out().fg(ostd::ConsoleColors::Gray).p("[");
if (type == TYPE_STRING)
output().fg(ostd::ConsoleColors::BrightRed).p("\"");
out().fg(ostd::ConsoleColors::BrightRed).p("\"");
for (uint16_t a = addr; a < addr + size; a++)
{
uint8_t value = DragonRuntime::memMap.read8(a);
if (type == TYPE_STRING)
{
output().fg(ostd::ConsoleColors::BrightRed).pChar((char)value);
out().fg(ostd::ConsoleColors::BrightRed).pChar((char)value);
continue;
}
output().fg(ostd::ConsoleColors::BrightRed).p(ostd::String::getHexStr(value, true, 1));
out().fg(ostd::ConsoleColors::BrightRed).p(ostd::String::getHexStr(value, true, 1));
if (a < addr + size - 1)
output().p(" ");
out().p(" ");
}
if (type == TYPE_STRING)
output().fg(ostd::ConsoleColors::BrightRed).p("\"");
output().fg(ostd::ConsoleColors::Gray).p("]");
output().reset().nl();
out().fg(ostd::ConsoleColors::BrightRed).p("\"");
out().fg(ostd::ConsoleColors::Gray).p("]");
out().reset().nl();
}
}
else
{
output().fg(ostd::ConsoleColors::Red).p("Invalid value for <print> command.").reset().nl();
out().fg(ostd::ConsoleColors::Red).p("Invalid value for <print> command.").reset().nl();
}
// Display::printPrompt();
data().command = getCommandInput();
@ -518,25 +519,25 @@ namespace dragon
{
addr = findSymbol(debugger.labels, data().command);
if (addr == 0x0000 || addr == 0xFFFF)
output().fg(ostd::ConsoleColors::Red).p("Invalid symbol: ").p(data().command).reset().nl();
out().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 <break> command.").reset().nl();
out().fg(ostd::ConsoleColors::Red).p("Invalid value for <break> command.").reset().nl();
}
if (valid)
{
if (isBreakPoint(addr))
{
removeBreakPoint(addr);
output().fg(ostd::ConsoleColors::Yellow).p("Breakpoint removed at address: ").p(ostd::String::getHexStr(addr, true, 2)).reset().nl();
out().fg(ostd::ConsoleColors::Yellow).p("Breakpoint removed at address: ").p(ostd::String::getHexStr(addr, true, 2)).reset().nl();
}
else
{
addBreakPoint(addr);
output().fg(ostd::ConsoleColors::Yellow).p("Breakpoint set at address: ").p(ostd::String::getHexStr(addr, true, 2)).reset().nl();
out().fg(ostd::ConsoleColors::Yellow).p("Breakpoint set at address: ").p(ostd::String::getHexStr(addr, true, 2)).reset().nl();
}
}
// Display::printPrompt();
@ -670,17 +671,16 @@ namespace dragon
void DebuggerNew::onInitialize(void)
{
enableSignals();
connectSignal(ostd::tBuiltinSignals::KeyReleased);
connectSignal(ostd::BuiltinSignals::KeyReleased);
connectSignal(ogfx::gui::RawTextInput::actionEventSignalID);
connectSignal(ogfx::gui::Button::actionEventSignalID);
enableMouseDragEvent(false);
connectSignal(ogfx::gui::CustomButton::actionEventSignalID);
// DisassemblyLoader::loadDirectory("disassembly");
// m_codeTable = DisassemblyLoader::getCodeTable();
// m_codeRandomIndex = ostd::Random::geti32(0, m_codeTable.size() - m_consoleSize.y - 1);
m_gfx.init(*this);
m_gfx.setFont("res/Courier Prime.ttf");
m_gfx.openFont("res/Courier Prime.ttf");
float w = m_consolePosition.x - 12;
float h = 40.0f;
@ -697,15 +697,15 @@ namespace dragon
m_wout.setFontSize(22);
m_wout.setConsoleMaxCharacters(m_consoleSize);
m_wout.setConsolePosition(m_consolePosition);
m_wout.setWrapMode(ogfx::WindowBaseOutputHandler::eWrapMode::TripleDots);
m_wout.setWrapMode(ogfx::GraphicsWindowOutputHandler::eWrapMode::TripleDots);
m_wout.setDefaultForegroundColor({ 180, 180, 180, 255 });
std::cout << STR_BOOL(ostd::Memory::loadByteStreamFromFile("./bios.bin", m_test)) << "\n";
}
void DebuggerNew::handleSignal(ostd::tSignal& signal)
void DebuggerNew::handleSignal(ostd::Signal& signal)
{
if (signal.ID == ostd::tBuiltinSignals::KeyReleased)
if (signal.ID == ostd::BuiltinSignals::KeyReleased)
{
auto& evtData = (ogfx::KeyEventData&)signal.userData;
if (evtData.keyCode == SDLK_ESCAPE)
@ -720,23 +720,23 @@ namespace dragon
return;
if (data.eventType == ogfx::gui::RawTextInput::eActionEventType::Enter)
{
out.fg(ostd::ConsoleColors::Green).p(data.sender.getText()).reset().nl();
out().fg(ostd::ConsoleColors::Green).p(data.sender.getText()).reset().nl();
data.sender.setText("");
}
else if (data.eventType == ogfx::gui::RawTextInput::eActionEventType::Tab)
{
out.fg(ostd::ConsoleColors::Red).p("TAB").reset().nl();
out().fg(ostd::ConsoleColors::Red).p("TAB").reset().nl();
data.sender.appendText("TAB");
}
}
else if (signal.ID == ogfx::gui::Button::actionEventSignalID)
else if (signal.ID == ogfx::gui::CustomButton::actionEventSignalID)
{
auto& data = (ogfx::gui::Button::ActionEventData&)signal.userData;
auto& data = (ogfx::gui::CustomButton::ActionEventData&)signal.userData;
if (data.senderName != "TestBTN")
return;
if (data.eventType == ogfx::gui::Button::eActionEventType::Pressed)
if (data.eventType == ogfx::gui::CustomButton::eActionEventType::Pressed)
{
out.fg(ostd::ConsoleColors::Green).p(data.sender.getText()).reset().nl();
out().fg(ostd::ConsoleColors::Green).p(data.sender.getText()).reset().nl();
}
}
}

View file

@ -4,10 +4,10 @@
#include <ostd/math/Geometry.hpp>
#include <ostd/data/Types.hpp>
#include <ostd/io/IOHandlers.hpp>
#include <ogfx/WindowBase.hpp>
#include <ogfx/BasicRenderer.hpp>
#include <ogfx/RawTextInput.hpp>
#include <ogfx/WindowBaseOutputHandler.hpp>
#include <ogfx/gui/Window.hpp>
#include <ogfx/render/BasicRenderer.hpp>
#include <ogfx/gui/RawTextInput.hpp>
#include <ogfx/gui/WindowOutputHandler.hpp>
#include "../assembler/Assembler.hpp"
@ -15,19 +15,19 @@ namespace ogfx
{
namespace gui
{
class Button : public ostd::Rectangle
class CustomButton : public ostd::Rectangle
{
public: class EventListener : public ostd::BaseObject
{
public: enum class eEventType { None = 0, MousePressed, KeyPressed, KeyReleased };
public:
EventListener(Button& _parent);
virtual void handleSignal(ostd::tSignal& signal) override;
inline virtual void onSignalHandled(ostd::tSignal& signal) { }
inline Button& getParent(void) { return parent; }
EventListener(CustomButton& _parent);
virtual void handleSignal(ostd::Signal& signal) override;
inline virtual void onSignalHandled(ostd::Signal& signal) { }
inline CustomButton& getParent(void) { return parent; }
private:
Button& parent;
CustomButton& parent;
eEventType m_lastEvent { eEventType::None };
};
public: class Theme
@ -84,27 +84,27 @@ namespace ogfx
public: class ActionEventData : public ostd::BaseObject
{
public:
inline ActionEventData(Button& _sender, const ostd::String& _senderName, eActionEventType _eventType, ostd::BaseObject& _userData) :
inline ActionEventData(CustomButton& _sender, const ostd::String& _senderName, eActionEventType _eventType, ostd::BaseObject& _userData) :
sender(_sender),
senderName(_senderName),
eventType(_eventType),
userData(_userData)
{
setTypeName("ogfx::gui::Button::ActionEventData");
setTypeName("ogfx::gui::CustomButton::ActionEventData");
validate();
}
public:
Button& sender;
CustomButton& sender;
ostd::String senderName { "" };
eActionEventType eventType { eActionEventType::None };
ostd::BaseObject& userData { ostd::BaseObject::InvalidRef() };
};
public:
inline Button(void) { create({ 0.0f, 0.0f }, { 200.0f, 30.0f }, "UnnamedButton"); }
inline Button(const ostd::Vec2& position, const ostd::Vec2& size, const ostd::String& name) { create(position, size, name); }
Button& create(const ostd::Vec2& position, const ostd::Vec2& size, const ostd::String& name);
inline CustomButton(void) { create({ 0.0f, 0.0f }, { 200.0f, 30.0f }, "UnnamedButton"); }
inline CustomButton(const ostd::Vec2& position, const ostd::Vec2& size, const ostd::String& name) { create(position, size, name); }
CustomButton& create(const ostd::Vec2& position, const ostd::Vec2& size, const ostd::String& name);
virtual void render(ogfx::BasicRenderer2D& gfx);
virtual void update(void);
@ -149,7 +149,7 @@ namespace dragon
{
typedef std::vector<dragon::code::Assembler::tDisassemblyLine> DisassemblyList;
class DebuggerNew : public ogfx::WindowBase
class DebuggerNew : public ogfx::GraphicsWindow
{
public: struct tCommandLineArgs
{
@ -197,7 +197,6 @@ namespace dragon
int32_t initRuntime(void);
ostd::String getCommandInput(void);
inline tDebuggerData& data(void) { return debugger; }
inline ostd::ConsoleOutputHandler& output(void) { return out; }
int32_t executeRuntime(void);
int32_t step_execution(bool& outUserQuit, bool exec_first_step = true);
int32_t normal_runtime(bool& outUserQuit);
@ -210,7 +209,7 @@ namespace dragon
//General
inline DebuggerNew(void) : m_sigHandler(m_textInput, *this), m_btnSigHandler(m_testBtn) { }
void onInitialize(void) override;
void handleSignal(ostd::tSignal& signal) override;
void handleSignal(ostd::Signal& signal) override;
void onRender(void) override;
void onFixedUpdate(double frameTime_s) override;
void onUpdate(void) override;
@ -222,10 +221,10 @@ namespace dragon
ogfx::gui::RawTextInputEventListener m_sigHandler;
ogfx::gui::RawTextInputNumberCharacterFilter m_numCharFilter;
ogfx::gui::Button m_testBtn;
ogfx::gui::Button::EventListener m_btnSigHandler;
ogfx::gui::CustomButton m_testBtn;
ogfx::gui::CustomButton::EventListener m_btnSigHandler;
ogfx::WindowBaseOutputHandler m_wout;
ogfx::GraphicsWindowOutputHandler m_wout;
ostd::IPoint m_consoleSize { 300, 50 };
ostd::Vec2 m_consolePosition { 650, 8 };
// std::vector<code::Assembler::tDisassemblyLine> m_codeTable;

View file

@ -6,8 +6,6 @@
int main(int argc, char** argv)
{
ostd::SignalHandler::init();
//Loading commandline arguments
int32_t rValue = dragon::Debugger::loadArguments(argc, argv);
if (rValue == dragon::DragonRuntime::RETURN_VAL_CLOSE_DEBUGGER)

View file

@ -180,7 +180,7 @@ namespace dragon
interruptData.addr = intValue;
interruptData.inst_addr = 0x0000;
interruptData.interrupts_disabled = !readFlag(data::Flags::InterruptsEnabled);
ostd::SignalHandler::emitSignal(DragonRuntime::SignalListener::Signal_HardwareInterruptOccurred, ostd::tSignalPriority::RealTime, interruptData);
ostd::SignalHandler::emitSignal(DragonRuntime::SignalListener::Signal_HardwareInterruptOccurred, ostd::Signal::Priority::RealTime, interruptData);
}
}

View file

@ -80,7 +80,7 @@ namespace dragon
std::vector<ostd::String> m_debug_stackFrameStrings;
ostd::Timer m_profilerTimer;
ostd::Counter m_profilerTimer;
friend class dragon::DragonRuntime;
friend class dragon::Debugger::Display;

View file

@ -1,5 +1,5 @@
#include "VirtualDisplay.hpp"
#include <ogfx/PixelRenderer.hpp>
#include <ogfx/render/PixelRenderer.hpp>
#include "../runtime/DragonRuntime.hpp"
#include "../tools/GlobalData.hpp"

View file

@ -1,7 +1,7 @@
#pragma once
#include <ogfx/WindowBase.hpp>
#include <ogfx/PixelRenderer.hpp>
#include <ogfx/gui/Window.hpp>
#include <ogfx/render/PixelRenderer.hpp>
#include "../hardware/VirtualIODevices.hpp"
namespace dragon
@ -9,7 +9,7 @@ namespace dragon
namespace data { class IBiosVideoPalette; }
namespace hw
{
class VirtualDisplay : public ogfx::WindowBase
class VirtualDisplay : public ogfx::GraphicsWindow
{
public: struct tRegisters
{

View file

@ -5,7 +5,7 @@
#include "VirtualCPU.hpp"
#include "../runtime/DragonRuntime.hpp"
#include <ogfx/PixelRenderer.hpp>
#include <ogfx/render/PixelRenderer.hpp>
#include <ostd/io/Memory.hpp>
//TODO: Fix all access functions (reads and writes) ensuring the address is not out of bounds.
@ -118,9 +118,9 @@ namespace dragon
m_data.push_back(0x00);
enableSignals();
validate();
connectSignal(ostd::tBuiltinSignals::KeyPressed);
connectSignal(ostd::tBuiltinSignals::KeyReleased);
connectSignal(ostd::tBuiltinSignals::TextEntered);
connectSignal(ostd::BuiltinSignals::KeyPressed);
connectSignal(ostd::BuiltinSignals::KeyReleased);
connectSignal(ostd::BuiltinSignals::TextEntered);
}
int8_t VirtualKeyboard::read8(uint16_t addr)
@ -167,11 +167,11 @@ namespace dragon
return &m_data;
}
void VirtualKeyboard::handleSignal(ostd::tSignal& signal)
void VirtualKeyboard::handleSignal(ostd::Signal& signal)
{
auto& cpu = DragonRuntime::cpu;
const auto& state = SDL_GetKeyboardState(nullptr);
if (signal.ID == ostd::tBuiltinSignals::KeyPressed || signal.ID == ostd::tBuiltinSignals::KeyReleased)
if (signal.ID == ostd::BuiltinSignals::KeyPressed || signal.ID == ostd::BuiltinSignals::KeyReleased)
{
ogfx::KeyEventData& ked = (ogfx::KeyEventData&)signal.userData;
m_modifiersBitFiels = __construct_modifiers_bitfield();
@ -182,12 +182,12 @@ namespace dragon
else if (ked.eventType == ogfx::KeyEventData::eKeyEvent::Pressed)
cpu.handleInterrupt(data::InterruptCodes::KeyReleased, true);
}
else if (signal.ID == ostd::tBuiltinSignals::TextEntered)
else if (signal.ID == ostd::BuiltinSignals::TextEntered)
{
ogfx::KeyEventData& ked = (ogfx::KeyEventData&)signal.userData;
m_modifiersBitFiels = __construct_modifiers_bitfield();
__write16(tRegisters::Modifiers, (int16_t)m_modifiersBitFiels.value);
__write16(tRegisters::KeyCode, (int16_t)ked.text);
__write16(tRegisters::KeyCode, (int16_t)ked.text[0]);
cpu.handleInterrupt(data::InterruptCodes::TextEntered, true);
}
}
@ -196,17 +196,17 @@ namespace dragon
{
ostd::BitField_16 bitfield;
auto mod_state = SDL_GetModState();
ostd::Bits::val(bitfield, tModifierBits::LeftShift, (mod_state & KMOD_LSHIFT));
ostd::Bits::val(bitfield, tModifierBits::LeftControl, (mod_state & KMOD_LCTRL));
ostd::Bits::val(bitfield, tModifierBits::LeftAlt, (mod_state & KMOD_LALT));
ostd::Bits::val(bitfield, tModifierBits::LeftSuper, (mod_state & KMOD_LGUI));
ostd::Bits::val(bitfield, tModifierBits::RightShift, (mod_state & KMOD_RSHIFT));
ostd::Bits::val(bitfield, tModifierBits::RightControl, (mod_state & KMOD_RCTRL));
ostd::Bits::val(bitfield, tModifierBits::RightAlt, (mod_state & KMOD_RALT));
ostd::Bits::val(bitfield, tModifierBits::RightSuper, (mod_state & KMOD_RGUI));
ostd::Bits::val(bitfield, tModifierBits::CapsLock, (mod_state & KMOD_CAPS));
ostd::Bits::val(bitfield, tModifierBits::NumLock, (mod_state & KMOD_NUM));
ostd::Bits::val(bitfield, tModifierBits::ScrolLLock, (mod_state & KMOD_SCROLL));
ostd::Bits::val(bitfield, tModifierBits::LeftShift, (mod_state & SDL_KMOD_LSHIFT));
ostd::Bits::val(bitfield, tModifierBits::LeftControl, (mod_state & SDL_KMOD_LCTRL));
ostd::Bits::val(bitfield, tModifierBits::LeftAlt, (mod_state & SDL_KMOD_LALT));
ostd::Bits::val(bitfield, tModifierBits::LeftSuper, (mod_state & SDL_KMOD_LGUI));
ostd::Bits::val(bitfield, tModifierBits::RightShift, (mod_state & SDL_KMOD_RSHIFT));
ostd::Bits::val(bitfield, tModifierBits::RightControl, (mod_state & SDL_KMOD_RCTRL));
ostd::Bits::val(bitfield, tModifierBits::RightAlt, (mod_state & SDL_KMOD_RALT));
ostd::Bits::val(bitfield, tModifierBits::RightSuper, (mod_state & SDL_KMOD_RGUI));
ostd::Bits::val(bitfield, tModifierBits::CapsLock, (mod_state & SDL_KMOD_CAPS));
ostd::Bits::val(bitfield, tModifierBits::NumLock, (mod_state & SDL_KMOD_NUM));
ostd::Bits::val(bitfield, tModifierBits::ScrolLLock, (mod_state & SDL_KMOD_SCROLL));
return bitfield;
}
@ -283,12 +283,12 @@ namespace dragon
case SDLK_TAB: return (int16_t)eKeys::Tab;
case SDLK_SPACE: return (int16_t)eKeys::Spacebar;
case SDLK_EXCLAIM: return (int16_t)eKeys::ExclamationMark;
case SDLK_QUOTEDBL: return (int16_t)eKeys::DoubleQuote;
case SDLK_DBLAPOSTROPHE: return (int16_t)eKeys::DoubleQuote;
case SDLK_HASH: return (int16_t)eKeys::Hash;
case SDLK_PERCENT: return (int16_t)eKeys::Percent;
case SDLK_DOLLAR: return (int16_t)eKeys::DollarSign;
case SDLK_AMPERSAND: return (int16_t)eKeys::Ampersand;
case SDLK_QUOTE: return (int16_t)eKeys::SingleQuote;
case SDLK_APOSTROPHE: return (int16_t)eKeys::SingleQuote;
case SDLK_LEFTPAREN: return (int16_t)eKeys::LeftParenthesis;
case SDLK_RIGHTPAREN: return (int16_t)eKeys::RightParenthesis;
case SDLK_ASTERISK: return (int16_t)eKeys::Asterisk;
@ -319,33 +319,33 @@ namespace dragon
case SDLK_RIGHTBRACKET: return (int16_t)eKeys::RightBracket;
case SDLK_CARET: return (int16_t)eKeys::Caret;
case SDLK_UNDERSCORE: return (int16_t)eKeys::Underscore;
case SDLK_BACKQUOTE: return (int16_t)eKeys::BackQuote;
case SDLK_a: return (int16_t)eKeys::LowerCase_a;
case SDLK_b: return (int16_t)eKeys::LowerCase_b;
case SDLK_c: return (int16_t)eKeys::LowerCase_c;
case SDLK_d: return (int16_t)eKeys::LowerCase_d;
case SDLK_e: return (int16_t)eKeys::LowerCase_e;
case SDLK_f: return (int16_t)eKeys::LowerCase_f;
case SDLK_g: return (int16_t)eKeys::LowerCase_g;
case SDLK_h: return (int16_t)eKeys::LowerCase_h;
case SDLK_i: return (int16_t)eKeys::LowerCase_i;
case SDLK_j: return (int16_t)eKeys::LowerCase_j;
case SDLK_k: return (int16_t)eKeys::LowerCase_k;
case SDLK_l: return (int16_t)eKeys::LowerCase_l;
case SDLK_m: return (int16_t)eKeys::LowerCase_m;
case SDLK_n: return (int16_t)eKeys::LowerCase_n;
case SDLK_o: return (int16_t)eKeys::LowerCase_o;
case SDLK_p: return (int16_t)eKeys::LowerCase_p;
case SDLK_q: return (int16_t)eKeys::LowerCase_q;
case SDLK_r: return (int16_t)eKeys::LowerCase_r;
case SDLK_s: return (int16_t)eKeys::LowerCase_s;
case SDLK_t: return (int16_t)eKeys::LowerCase_t;
case SDLK_u: return (int16_t)eKeys::LowerCase_u;
case SDLK_v: return (int16_t)eKeys::LowerCase_v;
case SDLK_w: return (int16_t)eKeys::LowerCase_w;
case SDLK_x: return (int16_t)eKeys::LowerCase_x;
case SDLK_y: return (int16_t)eKeys::LowerCase_y;
case SDLK_z: return (int16_t)eKeys::LowerCase_z;
case SDLK_GRAVE: return (int16_t)eKeys::BackQuote;
case SDLK_A: return (int16_t)eKeys::LowerCase_a;
case SDLK_B: return (int16_t)eKeys::LowerCase_b;
case SDLK_C: return (int16_t)eKeys::LowerCase_c;
case SDLK_D: return (int16_t)eKeys::LowerCase_d;
case SDLK_E: return (int16_t)eKeys::LowerCase_e;
case SDLK_F: return (int16_t)eKeys::LowerCase_f;
case SDLK_G: return (int16_t)eKeys::LowerCase_g;
case SDLK_H: return (int16_t)eKeys::LowerCase_h;
case SDLK_I: return (int16_t)eKeys::LowerCase_i;
case SDLK_J: return (int16_t)eKeys::LowerCase_j;
case SDLK_K: return (int16_t)eKeys::LowerCase_k;
case SDLK_L: return (int16_t)eKeys::LowerCase_l;
case SDLK_M: return (int16_t)eKeys::LowerCase_m;
case SDLK_N: return (int16_t)eKeys::LowerCase_n;
case SDLK_O: return (int16_t)eKeys::LowerCase_o;
case SDLK_P: return (int16_t)eKeys::LowerCase_p;
case SDLK_Q: return (int16_t)eKeys::LowerCase_q;
case SDLK_R: return (int16_t)eKeys::LowerCase_r;
case SDLK_S: return (int16_t)eKeys::LowerCase_s;
case SDLK_T: return (int16_t)eKeys::LowerCase_t;
case SDLK_U: return (int16_t)eKeys::LowerCase_u;
case SDLK_V: return (int16_t)eKeys::LowerCase_v;
case SDLK_W: return (int16_t)eKeys::LowerCase_w;
case SDLK_X: return (int16_t)eKeys::LowerCase_x;
case SDLK_Y: return (int16_t)eKeys::LowerCase_y;
case SDLK_Z: return (int16_t)eKeys::LowerCase_z;
default: return (int16_t)eKeys::UpperCase_A;
}
return (int16_t)eKeys::UpperCase_A;

View file

@ -233,7 +233,7 @@ namespace dragon
ostd::ByteStream* getByteStream(void) override;
void handleSignal(ostd::tSignal& signal) override;
void handleSignal(ostd::Signal& signal) override;
private:
ostd::BitField_16 __construct_modifiers_bitfield(void);

View file

@ -1,5 +1,5 @@
#include "DragonRuntime.hpp"
#include <ogfx/PixelRenderer.hpp>
#include <ogfx/render/PixelRenderer.hpp>
#include <ostd/io/Memory.hpp>
#include <ostd/utils/Time.hpp>
@ -13,7 +13,7 @@ namespace dragon
connectSignal(Signal_HardwareInterruptOccurred);
}
void DragonRuntime::SignalListener::handleSignal(ostd::tSignal& signal)
void DragonRuntime::SignalListener::handleSignal(ostd::Signal& signal)
{
if (signal.ID == Signal_HardwareInterruptOccurred)
{
@ -135,7 +135,6 @@ namespace dragon
bool trackCallStack,
bool debugModeEnabled)
{
ostd::SignalHandler::init();
s_signalListener.init();
vKeyboard.init();
if (verbose)
@ -358,21 +357,21 @@ namespace dragon
uint64_t avg_count = 0;
uint64_t _time = 0;
double avg_tot = 0;
ostd::Timer clock_timer;
ostd::Counter clock_timer;
bool running = true;
bool fixed_clock = machine_config.fixed_clock;
ostd::Timer _timer;
ostd::Counter _timer;
while (running || vDiskInterface.isBusy())
{
clock_timer.startCount(ostd::eTimeUnits::Microseconds);
ostd::SignalHandler::refresh();
ostd::SignalHandler::handleDelegateSignals();
uint16_t addr = cpu.readRegister(dragon::data::Registers::IP);
uint16_t spAddr = cpu.readRegister(dragon::data::Registers::SP);
uint8_t screenRedrawRate = vCMOS.read8(data::CMOSRegisters::ScreenRedrawRate);
// _timer.start(true, "Profiling", ostd::eTimeUnits::Microseconds, &out);
running = cpu.execute() && vDisplay.isRunning();
// _timer.end(true);
vDisplay.update();
vDisplay.mainLoop();
vDiskInterface.cycleStep();
if (dragon::data::ErrorHandler::hasError())
{
@ -407,7 +406,7 @@ namespace dragon
__track_call_stack(&s_machineInfo);
bool running = cpu.execute() && vDisplay.isRunning();
uint8_t screenRedrawRate = vCMOS.read8(data::CMOSRegisters::ScreenRedrawRate);
vDisplay.update();
vDisplay.mainLoop();
if (s_enableScreenRedrawDelay && s_stepAcc2 == (1000.0 / screenRedrawRate))
{
vDisplay.redrawScreen();

View file

@ -20,7 +20,7 @@ namespace dragon
public:
inline SignalListener(void) { }
void init(void);
void handleSignal(ostd::tSignal& signal) override;
void handleSignal(ostd::Signal& signal) override;
public:
inline static const int32_t Signal_HardwareInterruptOccurred = ostd::SignalHandler::newCustomSignal(8129);

View file

@ -5,7 +5,7 @@
#include <fstream>
#include "../hardware/VirtualHardDrive.hpp"
#include "GlobalData.hpp"
#include "debugger/DisassemblyLoader.hpp"
#include "../debugger/DisassemblyLoader.hpp"
#include <ostd/io/Memory.hpp>
#include <ostd/io/Serial.hpp>