Updated to new OmniaFramework version
This commit is contained in:
parent
3123ae6231
commit
6f0bed74d2
18 changed files with 218 additions and 203 deletions
|
|
@ -177,8 +177,8 @@ if (UNIX)
|
||||||
target_link_libraries(${DEBUGGER_TARGET} xcb xcb-randr boost_regex)
|
target_link_libraries(${DEBUGGER_TARGET} xcb xcb-randr boost_regex)
|
||||||
endif (UNIX)
|
endif (UNIX)
|
||||||
|
|
||||||
target_link_libraries(${RUNTIME_TARGET} SDL2main SDL2 SDL2_image)
|
target_link_libraries(${RUNTIME_TARGET} SDL3 SDL3_image)
|
||||||
target_link_libraries(${DEBUGGER_TARGET} SDL2main SDL2 SDL2_image)
|
target_link_libraries(${DEBUGGER_TARGET} SDL3 SDL3_image)
|
||||||
|
|
||||||
target_link_libraries(${RUNTIME_TARGET} ostd ogfx)
|
target_link_libraries(${RUNTIME_TARGET} ostd ogfx)
|
||||||
target_link_libraries(${DEBUGGER_TARGET} ostd ogfx)
|
target_link_libraries(${DEBUGGER_TARGET} ostd ogfx)
|
||||||
|
|
|
||||||
18
build
18
build
|
|
@ -72,5 +72,23 @@ else
|
||||||
./ddb config/testMachine.dvm --verbose-load
|
./ddb config/testMachine.dvm --verbose-load
|
||||||
backtrack_changes
|
backtrack_changes
|
||||||
cd ..
|
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
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -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.
|
## -- Please do not modify this file in any way.
|
||||||
## --
|
## --
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include <ostd/io/Memory.hpp>
|
#include <ostd/io/Memory.hpp>
|
||||||
#include <ostd/string/String.hpp>
|
#include <ostd/string/String.hpp>
|
||||||
#include <ostd/utils/Time.hpp>
|
#include <ostd/utils/Time.hpp>
|
||||||
|
#include <ostd/utils/Signals.hpp>
|
||||||
|
|
||||||
namespace dragon
|
namespace dragon
|
||||||
{
|
{
|
||||||
|
|
@ -15,12 +16,12 @@ namespace dragon
|
||||||
{
|
{
|
||||||
validate();
|
validate();
|
||||||
enableSignals();
|
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();
|
output().fg(ostd::ConsoleColors::Yellow).p("Press <Escape> to enter in step-execution mode...").reset().nl();
|
||||||
while (!userQuit)
|
while (!userQuit)
|
||||||
{
|
{
|
||||||
ostd::SignalHandler::refresh();
|
ostd::SignalHandler::handleDelegateSignals();
|
||||||
if (closeEventListener.hasHappened())
|
if (closeEventListener.hasHappened())
|
||||||
userQuit = true;
|
userQuit = true;
|
||||||
data().command.clr();
|
data().command.clr();
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ namespace dragon
|
||||||
struct tCloseEventListener : public ostd::BaseObject
|
struct tCloseEventListener : public ostd::BaseObject
|
||||||
{
|
{
|
||||||
void init(void);
|
void init(void);
|
||||||
void handleSignal(ostd::tSignal& signal);
|
void handleSignal(ostd::Signal& signal);
|
||||||
inline bool hasHappened(void) const { return m_mainWindowClosed; }
|
inline bool hasHappened(void) const { return m_mainWindowClosed; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
#include "DebuggerNew.hpp"
|
#include "DebuggerNew.hpp"
|
||||||
#include <SDL2/SDL_keycode.h>
|
#include <SDL2/SDL_keycode.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <ogfx/BasicRenderer.hpp>
|
#include <ogfx/render/BasicRenderer.hpp>
|
||||||
#include <ogfx/WindowBase.hpp>
|
#include <ogfx/gui/Window.hpp>
|
||||||
#include <ostd/io/Memory.hpp>
|
#include <ostd/io/Memory.hpp>
|
||||||
#include <ostd/math/Geometry.hpp>
|
#include <ostd/math/Geometry.hpp>
|
||||||
#include <ostd/io/IOHandlers.hpp>
|
#include <ostd/io/IOHandlers.hpp>
|
||||||
#include <ostd/math/Random.hpp>
|
#include <ostd/math/Random.hpp>
|
||||||
#include <ostd/string/String.hpp>
|
#include <ostd/string/String.hpp>
|
||||||
|
#include <ostd/utils/Signals.hpp>
|
||||||
#include "DisassemblyLoader.hpp"
|
#include "DisassemblyLoader.hpp"
|
||||||
#include "../runtime/DragonRuntime.hpp"
|
#include "../runtime/DragonRuntime.hpp"
|
||||||
|
|
||||||
|
|
@ -15,20 +16,20 @@ namespace ogfx
|
||||||
{
|
{
|
||||||
namespace gui
|
namespace gui
|
||||||
{
|
{
|
||||||
Button::EventListener::EventListener(Button& _parent) : parent(_parent)
|
CustomButton::EventListener::EventListener(CustomButton& _parent) : parent(_parent)
|
||||||
{
|
{
|
||||||
connectSignal(ostd::tBuiltinSignals::KeyPressed);
|
connectSignal(ostd::BuiltinSignals::KeyPressed);
|
||||||
connectSignal(ostd::tBuiltinSignals::KeyReleased);
|
connectSignal(ostd::BuiltinSignals::KeyReleased);
|
||||||
connectSignal(ostd::tBuiltinSignals::MouseMoved);
|
connectSignal(ostd::BuiltinSignals::MouseMoved);
|
||||||
connectSignal(ostd::tBuiltinSignals::MousePressed);
|
connectSignal(ostd::BuiltinSignals::MousePressed);
|
||||||
connectSignal(ostd::tBuiltinSignals::MouseReleased);
|
connectSignal(ostd::BuiltinSignals::MouseReleased);
|
||||||
connectSignal(ostd::tBuiltinSignals::OnGuiEvent);
|
connectSignal(ostd::BuiltinSignals::OnGuiEvent);
|
||||||
connectSignal(ostd::tBuiltinSignals::WindowResized);
|
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)
|
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;
|
auto& data = (ogfx::MouseEventData&)signal.userData;
|
||||||
if (parent.contains((float)data.position_x, (float)data.position_y))
|
if (parent.contains((float)data.position_x, (float)data.position_y))
|
||||||
|
|
@ -59,7 +60,7 @@ namespace ogfx
|
||||||
else
|
else
|
||||||
parent.m_mouseInside = false;
|
parent.m_mouseInside = false;
|
||||||
}
|
}
|
||||||
else if (signal.ID == ostd::tBuiltinSignals::MousePressed)
|
else if (signal.ID == ostd::BuiltinSignals::MousePressed)
|
||||||
{
|
{
|
||||||
auto& data = (ogfx::MouseEventData&)signal.userData;
|
auto& data = (ogfx::MouseEventData&)signal.userData;
|
||||||
if (data.button == ogfx::MouseEventData::eButton::Left && parent.m_gfx != nullptr && parent.m_mouseInside)
|
if (data.button == ogfx::MouseEventData::eButton::Left && parent.m_gfx != nullptr && parent.m_mouseInside)
|
||||||
|
|
@ -70,7 +71,7 @@ namespace ogfx
|
||||||
parent.m_pressed = true;
|
parent.m_pressed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (signal.ID == ostd::tBuiltinSignals::MouseReleased)
|
else if (signal.ID == ostd::BuiltinSignals::MouseReleased)
|
||||||
{
|
{
|
||||||
auto& data = (ogfx::MouseEventData&)signal.userData;
|
auto& data = (ogfx::MouseEventData&)signal.userData;
|
||||||
if (data.button == ogfx::MouseEventData::eButton::Left && parent.m_gfx != nullptr)
|
if (data.button == ogfx::MouseEventData::eButton::Left && parent.m_gfx != nullptr)
|
||||||
|
|
@ -78,7 +79,7 @@ namespace ogfx
|
||||||
if (parent.m_pressed)
|
if (parent.m_pressed)
|
||||||
{
|
{
|
||||||
ActionEventData aed(parent, parent.getName(), eActionEventType::Pressed, ostd::BaseObject::InvalidRef());
|
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;
|
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);
|
setPosition(position);
|
||||||
setSize(size);
|
setSize(size);
|
||||||
|
|
@ -100,7 +101,7 @@ namespace ogfx
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::render(ogfx::BasicRenderer2D& gfx)
|
void CustomButton::render(ogfx::BasicRenderer2D& gfx)
|
||||||
{
|
{
|
||||||
m_gfx = &gfx;
|
m_gfx = &gfx;
|
||||||
ostd::Color backgroundColor = m_theme.backgroundColor;
|
ostd::Color backgroundColor = m_theme.backgroundColor;
|
||||||
|
|
@ -121,34 +122,34 @@ namespace ogfx
|
||||||
gfx.outlinedRect(*this, backgroundColor, borderColor, 2);
|
gfx.outlinedRect(*this, backgroundColor, borderColor, 2);
|
||||||
if (m_text.len() > 0)
|
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) };
|
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);
|
gfx.drawString(m_text, txtPos, textColor, m_theme.fontSize);
|
||||||
}
|
}
|
||||||
onRender(gfx);
|
onRender(gfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::update(void)
|
void CustomButton::update(void)
|
||||||
{
|
{
|
||||||
onUpdate();
|
onUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::fixedUpdate(void)
|
void CustomButton::fixedUpdate(void)
|
||||||
{
|
{
|
||||||
onFixedUpdate();
|
onFixedUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::setText(const ostd::String& text)
|
void CustomButton::setText(const ostd::String& text)
|
||||||
{
|
{
|
||||||
m_text = text;
|
m_text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::appendText(const ostd::String& text)
|
void CustomButton::appendText(const ostd::String& text)
|
||||||
{
|
{
|
||||||
m_text.add(text);
|
m_text.add(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::setTheme(Theme theme)
|
void CustomButton::setTheme(Theme theme)
|
||||||
{
|
{
|
||||||
m_theme = theme;
|
m_theme = theme;
|
||||||
}
|
}
|
||||||
|
|
@ -256,7 +257,7 @@ namespace dragon
|
||||||
while (dragon::data::ErrorHandler::hasError())
|
while (dragon::data::ErrorHandler::hasError())
|
||||||
{
|
{
|
||||||
auto err = dragon::data::ErrorHandler::popError();
|
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;
|
debugger.args.step_exec = true;
|
||||||
}
|
}
|
||||||
|
|
@ -265,8 +266,8 @@ namespace dragon
|
||||||
{
|
{
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
out.fg(ostd::ConsoleColors::Red).p("Error: too few arguments.").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();
|
out().fg(ostd::ConsoleColors::Red).p("Use the --help option for more info.").reset().nl();
|
||||||
return DragonRuntime::RETURN_VAL_TOO_FEW_ARGUMENTS;
|
return DragonRuntime::RETURN_VAL_TOO_FEW_ARGUMENTS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -357,12 +358,12 @@ namespace dragon
|
||||||
{
|
{
|
||||||
int32_t rValue = 0;
|
int32_t rValue = 0;
|
||||||
bool userQuit = false;
|
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)
|
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)
|
while (!userQuit)
|
||||||
{
|
{
|
||||||
ostd::SignalHandler::refresh();
|
ostd::SignalHandler::handleDelegateSignals();
|
||||||
// if (closeEventListener.hasHappened())
|
// if (closeEventListener.hasHappened())
|
||||||
// userQuit = true;
|
// userQuit = true;
|
||||||
data().command.clr();
|
data().command.clr();
|
||||||
|
|
@ -372,7 +373,7 @@ namespace dragon
|
||||||
rValue = normal_runtime(userQuit);
|
rValue = normal_runtime(userQuit);
|
||||||
data().currentAddress = DragonRuntime::cpu.readRegister(data::Registers::IP);
|
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;
|
return rValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -383,7 +384,7 @@ namespace dragon
|
||||||
// Display::printStep();
|
// Display::printStep();
|
||||||
processErrors();
|
processErrors();
|
||||||
if (DragonRuntime::cpu.isInDebugBreakPoint())
|
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();
|
// Display::printPrompt();
|
||||||
data().command = getCommandInput();
|
data().command = getCommandInput();
|
||||||
data().command.trim().toLower();
|
data().command.trim().toLower();
|
||||||
|
|
@ -391,7 +392,7 @@ namespace dragon
|
||||||
{
|
{
|
||||||
if (data().command == "q" || data().command == "quit" || data().command == InputCommandQuit)
|
if (data().command == "q" || data().command == "quit" || data().command == InputCommandQuit)
|
||||||
{
|
{
|
||||||
output().nl();
|
out().nl();
|
||||||
outUserQuit = true;
|
outUserQuit = true;
|
||||||
data().command = "";
|
data().command = "";
|
||||||
}
|
}
|
||||||
|
|
@ -399,8 +400,8 @@ namespace dragon
|
||||||
{
|
{
|
||||||
data().args.step_exec = false;
|
data().args.step_exec = false;
|
||||||
data().command = "";
|
data().command = "";
|
||||||
output().clear().fg(ostd::ConsoleColors::Green).p("Program running...").nl();
|
out().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().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 "))
|
else if (data().command.startsWith("p ") || data().command.startsWith("print "))
|
||||||
{
|
{
|
||||||
|
|
@ -442,18 +443,18 @@ namespace dragon
|
||||||
rgx.fg("\\(|\\)|-", "darkgray");
|
rgx.fg("\\(|\\)|-", "darkgray");
|
||||||
rgx.fg("\\*", "red");
|
rgx.fg("\\*", "red");
|
||||||
rgx.fg("0x[0-9A-Fa-f]+|0b[0-1]+|(?<!\\w)[0-9]+(?!\\w)", "cyan"); //Number Constants
|
rgx.fg("0x[0-9A-Fa-f]+|0b[0-1]+|(?<!\\w)[0-9]+(?!\\w)", "cyan"); //Number Constants
|
||||||
output().pStyled(rgx);
|
out().pStyled(rgx);
|
||||||
output().fg(ostd::ConsoleColors::White).p(" = ");
|
out().fg(ostd::ConsoleColors::White).p(" = ");
|
||||||
output().fg(ostd::ConsoleColors::Gray).p("[");
|
out().fg(ostd::ConsoleColors::Gray).p("[");
|
||||||
for (uint16_t a = addr; a <= end_addr; a++)
|
for (uint16_t a = addr; a <= end_addr; a++)
|
||||||
{
|
{
|
||||||
uint8_t value = DragonRuntime::memMap.read8(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)
|
if (a < end_addr)
|
||||||
output().p(" ");
|
out().p(" ");
|
||||||
}
|
}
|
||||||
output().fg(ostd::ConsoleColors::Gray).p("]");
|
out().fg(ostd::ConsoleColors::Gray).p("]");
|
||||||
output().reset().nl();
|
out().reset().nl();
|
||||||
}
|
}
|
||||||
else if (data().command.startsWith("$"))
|
else if (data().command.startsWith("$"))
|
||||||
{
|
{
|
||||||
|
|
@ -462,7 +463,7 @@ namespace dragon
|
||||||
if (addr == 0)
|
if (addr == 0)
|
||||||
addr = findSymbol(debugger.labels, data().command, &size);
|
addr = findSymbol(debugger.labels, data().command, &size);
|
||||||
if (addr == 0)
|
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
|
else
|
||||||
{
|
{
|
||||||
ostd::String tmp = "";
|
ostd::String tmp = "";
|
||||||
|
|
@ -474,32 +475,32 @@ namespace dragon
|
||||||
rgx.fg("\\(|\\)|-", "darkgray");
|
rgx.fg("\\(|\\)|-", "darkgray");
|
||||||
rgx.fg("\\*", "red");
|
rgx.fg("\\*", "red");
|
||||||
rgx.fg("0x[0-9A-Fa-f]+|0b[0-1]+|(?<!\\w)[0-9]+(?!\\w)", "cyan"); //Number Constants
|
rgx.fg("0x[0-9A-Fa-f]+|0b[0-1]+|(?<!\\w)[0-9]+(?!\\w)", "cyan"); //Number Constants
|
||||||
output().pStyled(rgx);
|
out().pStyled(rgx);
|
||||||
output().fg(ostd::ConsoleColors::White).p(" = ");
|
out().fg(ostd::ConsoleColors::White).p(" = ");
|
||||||
output().fg(ostd::ConsoleColors::Gray).p("[");
|
out().fg(ostd::ConsoleColors::Gray).p("[");
|
||||||
if (type == TYPE_STRING)
|
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++)
|
for (uint16_t a = addr; a < addr + size; a++)
|
||||||
{
|
{
|
||||||
uint8_t value = DragonRuntime::memMap.read8(a);
|
uint8_t value = DragonRuntime::memMap.read8(a);
|
||||||
if (type == TYPE_STRING)
|
if (type == TYPE_STRING)
|
||||||
{
|
{
|
||||||
output().fg(ostd::ConsoleColors::BrightRed).pChar((char)value);
|
out().fg(ostd::ConsoleColors::BrightRed).pChar((char)value);
|
||||||
continue;
|
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)
|
if (a < addr + size - 1)
|
||||||
output().p(" ");
|
out().p(" ");
|
||||||
}
|
}
|
||||||
if (type == TYPE_STRING)
|
if (type == TYPE_STRING)
|
||||||
output().fg(ostd::ConsoleColors::BrightRed).p("\"");
|
out().fg(ostd::ConsoleColors::BrightRed).p("\"");
|
||||||
output().fg(ostd::ConsoleColors::Gray).p("]");
|
out().fg(ostd::ConsoleColors::Gray).p("]");
|
||||||
output().reset().nl();
|
out().reset().nl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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();
|
// Display::printPrompt();
|
||||||
data().command = getCommandInput();
|
data().command = getCommandInput();
|
||||||
|
|
@ -518,25 +519,25 @@ namespace dragon
|
||||||
{
|
{
|
||||||
addr = findSymbol(debugger.labels, data().command);
|
addr = findSymbol(debugger.labels, data().command);
|
||||||
if (addr == 0x0000 || addr == 0xFFFF)
|
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
|
else
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
}
|
||||||
else
|
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 (valid)
|
||||||
{
|
{
|
||||||
if (isBreakPoint(addr))
|
if (isBreakPoint(addr))
|
||||||
{
|
{
|
||||||
removeBreakPoint(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
|
else
|
||||||
{
|
{
|
||||||
addBreakPoint(addr);
|
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();
|
// Display::printPrompt();
|
||||||
|
|
@ -670,17 +671,16 @@ namespace dragon
|
||||||
void DebuggerNew::onInitialize(void)
|
void DebuggerNew::onInitialize(void)
|
||||||
{
|
{
|
||||||
enableSignals();
|
enableSignals();
|
||||||
connectSignal(ostd::tBuiltinSignals::KeyReleased);
|
connectSignal(ostd::BuiltinSignals::KeyReleased);
|
||||||
connectSignal(ogfx::gui::RawTextInput::actionEventSignalID);
|
connectSignal(ogfx::gui::RawTextInput::actionEventSignalID);
|
||||||
connectSignal(ogfx::gui::Button::actionEventSignalID);
|
connectSignal(ogfx::gui::CustomButton::actionEventSignalID);
|
||||||
enableMouseDragEvent(false);
|
|
||||||
|
|
||||||
// DisassemblyLoader::loadDirectory("disassembly");
|
// DisassemblyLoader::loadDirectory("disassembly");
|
||||||
// m_codeTable = DisassemblyLoader::getCodeTable();
|
// m_codeTable = DisassemblyLoader::getCodeTable();
|
||||||
// m_codeRandomIndex = ostd::Random::geti32(0, m_codeTable.size() - m_consoleSize.y - 1);
|
// m_codeRandomIndex = ostd::Random::geti32(0, m_codeTable.size() - m_consoleSize.y - 1);
|
||||||
|
|
||||||
m_gfx.init(*this);
|
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 w = m_consolePosition.x - 12;
|
||||||
float h = 40.0f;
|
float h = 40.0f;
|
||||||
|
|
@ -697,15 +697,15 @@ namespace dragon
|
||||||
m_wout.setFontSize(22);
|
m_wout.setFontSize(22);
|
||||||
m_wout.setConsoleMaxCharacters(m_consoleSize);
|
m_wout.setConsoleMaxCharacters(m_consoleSize);
|
||||||
m_wout.setConsolePosition(m_consolePosition);
|
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 });
|
m_wout.setDefaultForegroundColor({ 180, 180, 180, 255 });
|
||||||
|
|
||||||
std::cout << STR_BOOL(ostd::Memory::loadByteStreamFromFile("./bios.bin", m_test)) << "\n";
|
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;
|
auto& evtData = (ogfx::KeyEventData&)signal.userData;
|
||||||
if (evtData.keyCode == SDLK_ESCAPE)
|
if (evtData.keyCode == SDLK_ESCAPE)
|
||||||
|
|
@ -720,23 +720,23 @@ namespace dragon
|
||||||
return;
|
return;
|
||||||
if (data.eventType == ogfx::gui::RawTextInput::eActionEventType::Enter)
|
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("");
|
data.sender.setText("");
|
||||||
}
|
}
|
||||||
else if (data.eventType == ogfx::gui::RawTextInput::eActionEventType::Tab)
|
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");
|
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")
|
if (data.senderName != "TestBTN")
|
||||||
return;
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@
|
||||||
#include <ostd/math/Geometry.hpp>
|
#include <ostd/math/Geometry.hpp>
|
||||||
#include <ostd/data/Types.hpp>
|
#include <ostd/data/Types.hpp>
|
||||||
#include <ostd/io/IOHandlers.hpp>
|
#include <ostd/io/IOHandlers.hpp>
|
||||||
#include <ogfx/WindowBase.hpp>
|
#include <ogfx/gui/Window.hpp>
|
||||||
#include <ogfx/BasicRenderer.hpp>
|
#include <ogfx/render/BasicRenderer.hpp>
|
||||||
#include <ogfx/RawTextInput.hpp>
|
#include <ogfx/gui/RawTextInput.hpp>
|
||||||
#include <ogfx/WindowBaseOutputHandler.hpp>
|
#include <ogfx/gui/WindowOutputHandler.hpp>
|
||||||
#include "../assembler/Assembler.hpp"
|
#include "../assembler/Assembler.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -15,19 +15,19 @@ namespace ogfx
|
||||||
{
|
{
|
||||||
namespace gui
|
namespace gui
|
||||||
{
|
{
|
||||||
class Button : public ostd::Rectangle
|
class CustomButton : public ostd::Rectangle
|
||||||
{
|
{
|
||||||
public: class EventListener : public ostd::BaseObject
|
public: class EventListener : public ostd::BaseObject
|
||||||
{
|
{
|
||||||
public: enum class eEventType { None = 0, MousePressed, KeyPressed, KeyReleased };
|
public: enum class eEventType { None = 0, MousePressed, KeyPressed, KeyReleased };
|
||||||
public:
|
public:
|
||||||
EventListener(Button& _parent);
|
EventListener(CustomButton& _parent);
|
||||||
virtual void handleSignal(ostd::tSignal& signal) override;
|
virtual void handleSignal(ostd::Signal& signal) override;
|
||||||
inline virtual void onSignalHandled(ostd::tSignal& signal) { }
|
inline virtual void onSignalHandled(ostd::Signal& signal) { }
|
||||||
inline Button& getParent(void) { return parent; }
|
inline CustomButton& getParent(void) { return parent; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Button& parent;
|
CustomButton& parent;
|
||||||
eEventType m_lastEvent { eEventType::None };
|
eEventType m_lastEvent { eEventType::None };
|
||||||
};
|
};
|
||||||
public: class Theme
|
public: class Theme
|
||||||
|
|
@ -84,27 +84,27 @@ namespace ogfx
|
||||||
public: class ActionEventData : public ostd::BaseObject
|
public: class ActionEventData : public ostd::BaseObject
|
||||||
{
|
{
|
||||||
public:
|
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),
|
sender(_sender),
|
||||||
senderName(_senderName),
|
senderName(_senderName),
|
||||||
eventType(_eventType),
|
eventType(_eventType),
|
||||||
userData(_userData)
|
userData(_userData)
|
||||||
{
|
{
|
||||||
setTypeName("ogfx::gui::Button::ActionEventData");
|
setTypeName("ogfx::gui::CustomButton::ActionEventData");
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Button& sender;
|
CustomButton& sender;
|
||||||
ostd::String senderName { "" };
|
ostd::String senderName { "" };
|
||||||
eActionEventType eventType { eActionEventType::None };
|
eActionEventType eventType { eActionEventType::None };
|
||||||
ostd::BaseObject& userData { ostd::BaseObject::InvalidRef() };
|
ostd::BaseObject& userData { ostd::BaseObject::InvalidRef() };
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline Button(void) { create({ 0.0f, 0.0f }, { 200.0f, 30.0f }, "UnnamedButton"); }
|
inline CustomButton(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); }
|
inline CustomButton(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);
|
CustomButton& create(const ostd::Vec2& position, const ostd::Vec2& size, const ostd::String& name);
|
||||||
|
|
||||||
virtual void render(ogfx::BasicRenderer2D& gfx);
|
virtual void render(ogfx::BasicRenderer2D& gfx);
|
||||||
virtual void update(void);
|
virtual void update(void);
|
||||||
|
|
@ -149,7 +149,7 @@ namespace dragon
|
||||||
{
|
{
|
||||||
typedef std::vector<dragon::code::Assembler::tDisassemblyLine> DisassemblyList;
|
typedef std::vector<dragon::code::Assembler::tDisassemblyLine> DisassemblyList;
|
||||||
|
|
||||||
class DebuggerNew : public ogfx::WindowBase
|
class DebuggerNew : public ogfx::GraphicsWindow
|
||||||
{
|
{
|
||||||
public: struct tCommandLineArgs
|
public: struct tCommandLineArgs
|
||||||
{
|
{
|
||||||
|
|
@ -197,7 +197,6 @@ namespace dragon
|
||||||
int32_t initRuntime(void);
|
int32_t initRuntime(void);
|
||||||
ostd::String getCommandInput(void);
|
ostd::String getCommandInput(void);
|
||||||
inline tDebuggerData& data(void) { return debugger; }
|
inline tDebuggerData& data(void) { return debugger; }
|
||||||
inline ostd::ConsoleOutputHandler& output(void) { return out; }
|
|
||||||
int32_t executeRuntime(void);
|
int32_t executeRuntime(void);
|
||||||
int32_t step_execution(bool& outUserQuit, bool exec_first_step = true);
|
int32_t step_execution(bool& outUserQuit, bool exec_first_step = true);
|
||||||
int32_t normal_runtime(bool& outUserQuit);
|
int32_t normal_runtime(bool& outUserQuit);
|
||||||
|
|
@ -210,7 +209,7 @@ namespace dragon
|
||||||
//General
|
//General
|
||||||
inline DebuggerNew(void) : m_sigHandler(m_textInput, *this), m_btnSigHandler(m_testBtn) { }
|
inline DebuggerNew(void) : m_sigHandler(m_textInput, *this), m_btnSigHandler(m_testBtn) { }
|
||||||
void onInitialize(void) override;
|
void onInitialize(void) override;
|
||||||
void handleSignal(ostd::tSignal& signal) override;
|
void handleSignal(ostd::Signal& signal) override;
|
||||||
void onRender(void) override;
|
void onRender(void) override;
|
||||||
void onFixedUpdate(double frameTime_s) override;
|
void onFixedUpdate(double frameTime_s) override;
|
||||||
void onUpdate(void) override;
|
void onUpdate(void) override;
|
||||||
|
|
@ -222,10 +221,10 @@ namespace dragon
|
||||||
ogfx::gui::RawTextInputEventListener m_sigHandler;
|
ogfx::gui::RawTextInputEventListener m_sigHandler;
|
||||||
ogfx::gui::RawTextInputNumberCharacterFilter m_numCharFilter;
|
ogfx::gui::RawTextInputNumberCharacterFilter m_numCharFilter;
|
||||||
|
|
||||||
ogfx::gui::Button m_testBtn;
|
ogfx::gui::CustomButton m_testBtn;
|
||||||
ogfx::gui::Button::EventListener m_btnSigHandler;
|
ogfx::gui::CustomButton::EventListener m_btnSigHandler;
|
||||||
|
|
||||||
ogfx::WindowBaseOutputHandler m_wout;
|
ogfx::GraphicsWindowOutputHandler m_wout;
|
||||||
ostd::IPoint m_consoleSize { 300, 50 };
|
ostd::IPoint m_consoleSize { 300, 50 };
|
||||||
ostd::Vec2 m_consolePosition { 650, 8 };
|
ostd::Vec2 m_consolePosition { 650, 8 };
|
||||||
// std::vector<code::Assembler::tDisassemblyLine> m_codeTable;
|
// std::vector<code::Assembler::tDisassemblyLine> m_codeTable;
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
ostd::SignalHandler::init();
|
|
||||||
|
|
||||||
//Loading commandline arguments
|
//Loading commandline arguments
|
||||||
int32_t rValue = dragon::Debugger::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)
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ namespace dragon
|
||||||
interruptData.addr = intValue;
|
interruptData.addr = intValue;
|
||||||
interruptData.inst_addr = 0x0000;
|
interruptData.inst_addr = 0x0000;
|
||||||
interruptData.interrupts_disabled = !readFlag(data::Flags::InterruptsEnabled);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ namespace dragon
|
||||||
|
|
||||||
std::vector<ostd::String> m_debug_stackFrameStrings;
|
std::vector<ostd::String> m_debug_stackFrameStrings;
|
||||||
|
|
||||||
ostd::Timer m_profilerTimer;
|
ostd::Counter m_profilerTimer;
|
||||||
|
|
||||||
friend class dragon::DragonRuntime;
|
friend class dragon::DragonRuntime;
|
||||||
friend class dragon::Debugger::Display;
|
friend class dragon::Debugger::Display;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "VirtualDisplay.hpp"
|
#include "VirtualDisplay.hpp"
|
||||||
#include <ogfx/PixelRenderer.hpp>
|
#include <ogfx/render/PixelRenderer.hpp>
|
||||||
#include "../runtime/DragonRuntime.hpp"
|
#include "../runtime/DragonRuntime.hpp"
|
||||||
#include "../tools/GlobalData.hpp"
|
#include "../tools/GlobalData.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ogfx/WindowBase.hpp>
|
#include <ogfx/gui/Window.hpp>
|
||||||
#include <ogfx/PixelRenderer.hpp>
|
#include <ogfx/render/PixelRenderer.hpp>
|
||||||
#include "../hardware/VirtualIODevices.hpp"
|
#include "../hardware/VirtualIODevices.hpp"
|
||||||
|
|
||||||
namespace dragon
|
namespace dragon
|
||||||
|
|
@ -9,7 +9,7 @@ namespace dragon
|
||||||
namespace data { class IBiosVideoPalette; }
|
namespace data { class IBiosVideoPalette; }
|
||||||
namespace hw
|
namespace hw
|
||||||
{
|
{
|
||||||
class VirtualDisplay : public ogfx::WindowBase
|
class VirtualDisplay : public ogfx::GraphicsWindow
|
||||||
{
|
{
|
||||||
public: struct tRegisters
|
public: struct tRegisters
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#include "VirtualCPU.hpp"
|
#include "VirtualCPU.hpp"
|
||||||
|
|
||||||
#include "../runtime/DragonRuntime.hpp"
|
#include "../runtime/DragonRuntime.hpp"
|
||||||
#include <ogfx/PixelRenderer.hpp>
|
#include <ogfx/render/PixelRenderer.hpp>
|
||||||
#include <ostd/io/Memory.hpp>
|
#include <ostd/io/Memory.hpp>
|
||||||
|
|
||||||
//TODO: Fix all access functions (reads and writes) ensuring the address is not out of bounds.
|
//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);
|
m_data.push_back(0x00);
|
||||||
enableSignals();
|
enableSignals();
|
||||||
validate();
|
validate();
|
||||||
connectSignal(ostd::tBuiltinSignals::KeyPressed);
|
connectSignal(ostd::BuiltinSignals::KeyPressed);
|
||||||
connectSignal(ostd::tBuiltinSignals::KeyReleased);
|
connectSignal(ostd::BuiltinSignals::KeyReleased);
|
||||||
connectSignal(ostd::tBuiltinSignals::TextEntered);
|
connectSignal(ostd::BuiltinSignals::TextEntered);
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t VirtualKeyboard::read8(uint16_t addr)
|
int8_t VirtualKeyboard::read8(uint16_t addr)
|
||||||
|
|
@ -167,11 +167,11 @@ namespace dragon
|
||||||
return &m_data;
|
return &m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualKeyboard::handleSignal(ostd::tSignal& signal)
|
void VirtualKeyboard::handleSignal(ostd::Signal& signal)
|
||||||
{
|
{
|
||||||
auto& cpu = DragonRuntime::cpu;
|
auto& cpu = DragonRuntime::cpu;
|
||||||
const auto& state = SDL_GetKeyboardState(nullptr);
|
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;
|
ogfx::KeyEventData& ked = (ogfx::KeyEventData&)signal.userData;
|
||||||
m_modifiersBitFiels = __construct_modifiers_bitfield();
|
m_modifiersBitFiels = __construct_modifiers_bitfield();
|
||||||
|
|
@ -182,12 +182,12 @@ namespace dragon
|
||||||
else if (ked.eventType == ogfx::KeyEventData::eKeyEvent::Pressed)
|
else if (ked.eventType == ogfx::KeyEventData::eKeyEvent::Pressed)
|
||||||
cpu.handleInterrupt(data::InterruptCodes::KeyReleased, true);
|
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;
|
ogfx::KeyEventData& ked = (ogfx::KeyEventData&)signal.userData;
|
||||||
m_modifiersBitFiels = __construct_modifiers_bitfield();
|
m_modifiersBitFiels = __construct_modifiers_bitfield();
|
||||||
__write16(tRegisters::Modifiers, (int16_t)m_modifiersBitFiels.value);
|
__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);
|
cpu.handleInterrupt(data::InterruptCodes::TextEntered, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -196,17 +196,17 @@ namespace dragon
|
||||||
{
|
{
|
||||||
ostd::BitField_16 bitfield;
|
ostd::BitField_16 bitfield;
|
||||||
auto mod_state = SDL_GetModState();
|
auto mod_state = SDL_GetModState();
|
||||||
ostd::Bits::val(bitfield, tModifierBits::LeftShift, (mod_state & KMOD_LSHIFT));
|
ostd::Bits::val(bitfield, tModifierBits::LeftShift, (mod_state & SDL_KMOD_LSHIFT));
|
||||||
ostd::Bits::val(bitfield, tModifierBits::LeftControl, (mod_state & KMOD_LCTRL));
|
ostd::Bits::val(bitfield, tModifierBits::LeftControl, (mod_state & SDL_KMOD_LCTRL));
|
||||||
ostd::Bits::val(bitfield, tModifierBits::LeftAlt, (mod_state & KMOD_LALT));
|
ostd::Bits::val(bitfield, tModifierBits::LeftAlt, (mod_state & SDL_KMOD_LALT));
|
||||||
ostd::Bits::val(bitfield, tModifierBits::LeftSuper, (mod_state & KMOD_LGUI));
|
ostd::Bits::val(bitfield, tModifierBits::LeftSuper, (mod_state & SDL_KMOD_LGUI));
|
||||||
ostd::Bits::val(bitfield, tModifierBits::RightShift, (mod_state & KMOD_RSHIFT));
|
ostd::Bits::val(bitfield, tModifierBits::RightShift, (mod_state & SDL_KMOD_RSHIFT));
|
||||||
ostd::Bits::val(bitfield, tModifierBits::RightControl, (mod_state & KMOD_RCTRL));
|
ostd::Bits::val(bitfield, tModifierBits::RightControl, (mod_state & SDL_KMOD_RCTRL));
|
||||||
ostd::Bits::val(bitfield, tModifierBits::RightAlt, (mod_state & KMOD_RALT));
|
ostd::Bits::val(bitfield, tModifierBits::RightAlt, (mod_state & SDL_KMOD_RALT));
|
||||||
ostd::Bits::val(bitfield, tModifierBits::RightSuper, (mod_state & KMOD_RGUI));
|
ostd::Bits::val(bitfield, tModifierBits::RightSuper, (mod_state & SDL_KMOD_RGUI));
|
||||||
ostd::Bits::val(bitfield, tModifierBits::CapsLock, (mod_state & KMOD_CAPS));
|
ostd::Bits::val(bitfield, tModifierBits::CapsLock, (mod_state & SDL_KMOD_CAPS));
|
||||||
ostd::Bits::val(bitfield, tModifierBits::NumLock, (mod_state & KMOD_NUM));
|
ostd::Bits::val(bitfield, tModifierBits::NumLock, (mod_state & SDL_KMOD_NUM));
|
||||||
ostd::Bits::val(bitfield, tModifierBits::ScrolLLock, (mod_state & KMOD_SCROLL));
|
ostd::Bits::val(bitfield, tModifierBits::ScrolLLock, (mod_state & SDL_KMOD_SCROLL));
|
||||||
return bitfield;
|
return bitfield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,12 +283,12 @@ namespace dragon
|
||||||
case SDLK_TAB: return (int16_t)eKeys::Tab;
|
case SDLK_TAB: return (int16_t)eKeys::Tab;
|
||||||
case SDLK_SPACE: return (int16_t)eKeys::Spacebar;
|
case SDLK_SPACE: return (int16_t)eKeys::Spacebar;
|
||||||
case SDLK_EXCLAIM: return (int16_t)eKeys::ExclamationMark;
|
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_HASH: return (int16_t)eKeys::Hash;
|
||||||
case SDLK_PERCENT: return (int16_t)eKeys::Percent;
|
case SDLK_PERCENT: return (int16_t)eKeys::Percent;
|
||||||
case SDLK_DOLLAR: return (int16_t)eKeys::DollarSign;
|
case SDLK_DOLLAR: return (int16_t)eKeys::DollarSign;
|
||||||
case SDLK_AMPERSAND: return (int16_t)eKeys::Ampersand;
|
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_LEFTPAREN: return (int16_t)eKeys::LeftParenthesis;
|
||||||
case SDLK_RIGHTPAREN: return (int16_t)eKeys::RightParenthesis;
|
case SDLK_RIGHTPAREN: return (int16_t)eKeys::RightParenthesis;
|
||||||
case SDLK_ASTERISK: return (int16_t)eKeys::Asterisk;
|
case SDLK_ASTERISK: return (int16_t)eKeys::Asterisk;
|
||||||
|
|
@ -319,33 +319,33 @@ namespace dragon
|
||||||
case SDLK_RIGHTBRACKET: return (int16_t)eKeys::RightBracket;
|
case SDLK_RIGHTBRACKET: return (int16_t)eKeys::RightBracket;
|
||||||
case SDLK_CARET: return (int16_t)eKeys::Caret;
|
case SDLK_CARET: return (int16_t)eKeys::Caret;
|
||||||
case SDLK_UNDERSCORE: return (int16_t)eKeys::Underscore;
|
case SDLK_UNDERSCORE: return (int16_t)eKeys::Underscore;
|
||||||
case SDLK_BACKQUOTE: return (int16_t)eKeys::BackQuote;
|
case SDLK_GRAVE: return (int16_t)eKeys::BackQuote;
|
||||||
case SDLK_a: return (int16_t)eKeys::LowerCase_a;
|
case SDLK_A: return (int16_t)eKeys::LowerCase_a;
|
||||||
case SDLK_b: return (int16_t)eKeys::LowerCase_b;
|
case SDLK_B: return (int16_t)eKeys::LowerCase_b;
|
||||||
case SDLK_c: return (int16_t)eKeys::LowerCase_c;
|
case SDLK_C: return (int16_t)eKeys::LowerCase_c;
|
||||||
case SDLK_d: return (int16_t)eKeys::LowerCase_d;
|
case SDLK_D: return (int16_t)eKeys::LowerCase_d;
|
||||||
case SDLK_e: return (int16_t)eKeys::LowerCase_e;
|
case SDLK_E: return (int16_t)eKeys::LowerCase_e;
|
||||||
case SDLK_f: return (int16_t)eKeys::LowerCase_f;
|
case SDLK_F: return (int16_t)eKeys::LowerCase_f;
|
||||||
case SDLK_g: return (int16_t)eKeys::LowerCase_g;
|
case SDLK_G: return (int16_t)eKeys::LowerCase_g;
|
||||||
case SDLK_h: return (int16_t)eKeys::LowerCase_h;
|
case SDLK_H: return (int16_t)eKeys::LowerCase_h;
|
||||||
case SDLK_i: return (int16_t)eKeys::LowerCase_i;
|
case SDLK_I: return (int16_t)eKeys::LowerCase_i;
|
||||||
case SDLK_j: return (int16_t)eKeys::LowerCase_j;
|
case SDLK_J: return (int16_t)eKeys::LowerCase_j;
|
||||||
case SDLK_k: return (int16_t)eKeys::LowerCase_k;
|
case SDLK_K: return (int16_t)eKeys::LowerCase_k;
|
||||||
case SDLK_l: return (int16_t)eKeys::LowerCase_l;
|
case SDLK_L: return (int16_t)eKeys::LowerCase_l;
|
||||||
case SDLK_m: return (int16_t)eKeys::LowerCase_m;
|
case SDLK_M: return (int16_t)eKeys::LowerCase_m;
|
||||||
case SDLK_n: return (int16_t)eKeys::LowerCase_n;
|
case SDLK_N: return (int16_t)eKeys::LowerCase_n;
|
||||||
case SDLK_o: return (int16_t)eKeys::LowerCase_o;
|
case SDLK_O: return (int16_t)eKeys::LowerCase_o;
|
||||||
case SDLK_p: return (int16_t)eKeys::LowerCase_p;
|
case SDLK_P: return (int16_t)eKeys::LowerCase_p;
|
||||||
case SDLK_q: return (int16_t)eKeys::LowerCase_q;
|
case SDLK_Q: return (int16_t)eKeys::LowerCase_q;
|
||||||
case SDLK_r: return (int16_t)eKeys::LowerCase_r;
|
case SDLK_R: return (int16_t)eKeys::LowerCase_r;
|
||||||
case SDLK_s: return (int16_t)eKeys::LowerCase_s;
|
case SDLK_S: return (int16_t)eKeys::LowerCase_s;
|
||||||
case SDLK_t: return (int16_t)eKeys::LowerCase_t;
|
case SDLK_T: return (int16_t)eKeys::LowerCase_t;
|
||||||
case SDLK_u: return (int16_t)eKeys::LowerCase_u;
|
case SDLK_U: return (int16_t)eKeys::LowerCase_u;
|
||||||
case SDLK_v: return (int16_t)eKeys::LowerCase_v;
|
case SDLK_V: return (int16_t)eKeys::LowerCase_v;
|
||||||
case SDLK_w: return (int16_t)eKeys::LowerCase_w;
|
case SDLK_W: return (int16_t)eKeys::LowerCase_w;
|
||||||
case SDLK_x: return (int16_t)eKeys::LowerCase_x;
|
case SDLK_X: return (int16_t)eKeys::LowerCase_x;
|
||||||
case SDLK_y: return (int16_t)eKeys::LowerCase_y;
|
case SDLK_Y: return (int16_t)eKeys::LowerCase_y;
|
||||||
case SDLK_z: return (int16_t)eKeys::LowerCase_z;
|
case SDLK_Z: return (int16_t)eKeys::LowerCase_z;
|
||||||
default: return (int16_t)eKeys::UpperCase_A;
|
default: return (int16_t)eKeys::UpperCase_A;
|
||||||
}
|
}
|
||||||
return (int16_t)eKeys::UpperCase_A;
|
return (int16_t)eKeys::UpperCase_A;
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ namespace dragon
|
||||||
|
|
||||||
ostd::ByteStream* getByteStream(void) override;
|
ostd::ByteStream* getByteStream(void) override;
|
||||||
|
|
||||||
void handleSignal(ostd::tSignal& signal) override;
|
void handleSignal(ostd::Signal& signal) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ostd::BitField_16 __construct_modifiers_bitfield(void);
|
ostd::BitField_16 __construct_modifiers_bitfield(void);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#include "DragonRuntime.hpp"
|
#include "DragonRuntime.hpp"
|
||||||
#include <ogfx/PixelRenderer.hpp>
|
#include <ogfx/render/PixelRenderer.hpp>
|
||||||
#include <ostd/io/Memory.hpp>
|
#include <ostd/io/Memory.hpp>
|
||||||
#include <ostd/utils/Time.hpp>
|
#include <ostd/utils/Time.hpp>
|
||||||
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace dragon
|
||||||
connectSignal(Signal_HardwareInterruptOccurred);
|
connectSignal(Signal_HardwareInterruptOccurred);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DragonRuntime::SignalListener::handleSignal(ostd::tSignal& signal)
|
void DragonRuntime::SignalListener::handleSignal(ostd::Signal& signal)
|
||||||
{
|
{
|
||||||
if (signal.ID == Signal_HardwareInterruptOccurred)
|
if (signal.ID == Signal_HardwareInterruptOccurred)
|
||||||
{
|
{
|
||||||
|
|
@ -135,7 +135,6 @@ namespace dragon
|
||||||
bool trackCallStack,
|
bool trackCallStack,
|
||||||
bool debugModeEnabled)
|
bool debugModeEnabled)
|
||||||
{
|
{
|
||||||
ostd::SignalHandler::init();
|
|
||||||
s_signalListener.init();
|
s_signalListener.init();
|
||||||
vKeyboard.init();
|
vKeyboard.init();
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
|
@ -358,21 +357,21 @@ namespace dragon
|
||||||
uint64_t avg_count = 0;
|
uint64_t avg_count = 0;
|
||||||
uint64_t _time = 0;
|
uint64_t _time = 0;
|
||||||
double avg_tot = 0;
|
double avg_tot = 0;
|
||||||
ostd::Timer clock_timer;
|
ostd::Counter clock_timer;
|
||||||
bool running = true;
|
bool running = true;
|
||||||
bool fixed_clock = machine_config.fixed_clock;
|
bool fixed_clock = machine_config.fixed_clock;
|
||||||
ostd::Timer _timer;
|
ostd::Counter _timer;
|
||||||
while (running || vDiskInterface.isBusy())
|
while (running || vDiskInterface.isBusy())
|
||||||
{
|
{
|
||||||
clock_timer.startCount(ostd::eTimeUnits::Microseconds);
|
clock_timer.startCount(ostd::eTimeUnits::Microseconds);
|
||||||
ostd::SignalHandler::refresh();
|
ostd::SignalHandler::handleDelegateSignals();
|
||||||
uint16_t addr = cpu.readRegister(dragon::data::Registers::IP);
|
uint16_t addr = cpu.readRegister(dragon::data::Registers::IP);
|
||||||
uint16_t spAddr = cpu.readRegister(dragon::data::Registers::SP);
|
uint16_t spAddr = cpu.readRegister(dragon::data::Registers::SP);
|
||||||
uint8_t screenRedrawRate = vCMOS.read8(data::CMOSRegisters::ScreenRedrawRate);
|
uint8_t screenRedrawRate = vCMOS.read8(data::CMOSRegisters::ScreenRedrawRate);
|
||||||
// _timer.start(true, "Profiling", ostd::eTimeUnits::Microseconds, &out);
|
// _timer.start(true, "Profiling", ostd::eTimeUnits::Microseconds, &out);
|
||||||
running = cpu.execute() && vDisplay.isRunning();
|
running = cpu.execute() && vDisplay.isRunning();
|
||||||
// _timer.end(true);
|
// _timer.end(true);
|
||||||
vDisplay.update();
|
vDisplay.mainLoop();
|
||||||
vDiskInterface.cycleStep();
|
vDiskInterface.cycleStep();
|
||||||
if (dragon::data::ErrorHandler::hasError())
|
if (dragon::data::ErrorHandler::hasError())
|
||||||
{
|
{
|
||||||
|
|
@ -407,7 +406,7 @@ namespace dragon
|
||||||
__track_call_stack(&s_machineInfo);
|
__track_call_stack(&s_machineInfo);
|
||||||
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.mainLoop();
|
||||||
if (s_enableScreenRedrawDelay && s_stepAcc2 == (1000.0 / screenRedrawRate))
|
if (s_enableScreenRedrawDelay && s_stepAcc2 == (1000.0 / screenRedrawRate))
|
||||||
{
|
{
|
||||||
vDisplay.redrawScreen();
|
vDisplay.redrawScreen();
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace dragon
|
||||||
public:
|
public:
|
||||||
inline SignalListener(void) { }
|
inline SignalListener(void) { }
|
||||||
void init(void);
|
void init(void);
|
||||||
void handleSignal(ostd::tSignal& signal) override;
|
void handleSignal(ostd::Signal& signal) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline static const int32_t Signal_HardwareInterruptOccurred = ostd::SignalHandler::newCustomSignal(8129);
|
inline static const int32_t Signal_HardwareInterruptOccurred = ostd::SignalHandler::newCustomSignal(8129);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
#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/io/Memory.hpp>
|
#include <ostd/io/Memory.hpp>
|
||||||
#include <ostd/io/Serial.hpp>
|
#include <ostd/io/Serial.hpp>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue