diff --git a/README.md b/README.md
index ca8e07a..7507b73 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
[![Build status](https://github.com/indigodarkwolf/box16/actions/workflows/build.yml/badge.svg)](https://github.com/indigodarkwolf/box16/actions/workflows/build.yml)
[![Release](https://img.shields.io/github/v/release/indigodarkwolf/box16)](https://github.com/indigodarkwolf/box16/releases)
-This is an emulator for the Commander X16 computer system. Unlike [the official emulator](https://github.com/commanderx16/x16-emulator), this has a few more dependencies, see the build instructions below. It compiles on Windows, Debian Linux, and Raspbian, and probably
+This is an emulator for the Commander X16 computer system. Unlike [the official emulator](https://github.com/X16Community/x16-emulator), this has a few more dependencies, see the build instructions below. It compiles on Windows, Debian Linux, and Raspbian, and probably
other Linux-based platforms.
Don't expect official "releases" until the physical X16 is out. Until then, there will be "non-releases" of Box16.
@@ -49,7 +49,7 @@ loaded from the directory containing the emulator binary, or you can use the `-r
> __WARNING:__ Older versions of the ROM might not work in newer versions of the emulator, and vice versa.
-You can build a ROM image yourself using the [build instructions](https://github.com/commanderx16/x16-rom#releases-and-building) in the [x16-rom](https://github.com/commanderx16/x16-rom) repo. The `rom.bin` included in the [_latest_ release](https://github.com/commanderx16/x16-emulator/releases) of the emulator may also work with the HEAD of this repo, but this is not guaranteed.
+You can build a ROM image yourself using the [build instructions](https://github.com/X16Community/x16-rom#releases-and-building) in the [x16-rom](https://github.com/X16Community/x16-rom) repo. The `rom.bin` included in the [_latest_ release](https://github.com/X16Community/x16-emulator/releases) of the emulator may also work with the HEAD of this repo, but this is not guaranteed.
### Linux Build
@@ -355,7 +355,7 @@ Forum
Wiki
----
-[https://github.com/commanderx16/x16-emulator/wiki](https://github.com/commanderx16/x16-emulator/wiki)
+[https://github.com/commanderx16/x16-emulator/wiki](https://github.com/X16Community/x16-emulator/wiki)
License
diff --git a/src/boxmon/boxmon.cpp b/src/boxmon/boxmon.cpp
index 287ce9d..5ed0f8f 100644
--- a/src/boxmon/boxmon.cpp
+++ b/src/boxmon/boxmon.cpp
@@ -23,7 +23,6 @@ enum class parse_command_result {
void boxmon_system_init()
{
- boxmon::boxmon_command::finalize_list();
}
void boxmon_system_shutdown()
diff --git a/src/boxmon/command.cpp b/src/boxmon/command.cpp
index a0b3687..2a84032 100644
--- a/src/boxmon/command.cpp
+++ b/src/boxmon/command.cpp
@@ -1,7 +1,7 @@
#include "command.h"
#include
-#include
+#include
#include "boxmon.h"
#include "parser.h"
@@ -20,7 +20,7 @@ namespace boxmon
m_run(fn)
{
auto &command_list = get_command_list();
- command_list.push_back(this);
+ command_list.insert({ name, this });
}
std::strong_ordering boxmon_command::operator<=>(char const *name) const
@@ -48,35 +48,13 @@ namespace boxmon
return m_description;
}
- void boxmon_command::finalize_list()
- {
- auto &command_list = get_command_list();
- std::sort(begin(command_list), end(command_list), [](const boxmon_command *a, const boxmon_command *b) { return *a > *b; });
- }
-
const boxmon_command *boxmon_command::find(char const *name)
{
const auto &command_list = get_command_list();
-
- size_t search_min = 0;
- size_t search_max = command_list.size()-1;
-
- while (search_min != search_max) {
- const auto search_i = (search_min + search_max) >> 1;
- const auto cmp_i = *command_list[search_i] <=> name;
- if (is_eq(cmp_i)) {
- return command_list[search_i];
- } else if (is_lt(cmp_i)) {
- search_max = std::max(search_min, search_i - 1);
- } else {
- search_min = std::min(search_max, search_i + 1);
- }
- }
-
- if (is_eq(*command_list[search_min] <=> name)) {
- return command_list[search_min];
+ const auto icmd = command_list.find(name);
+ if (icmd != command_list.end()) {
+ return icmd->second;
}
-
return nullptr;
}
@@ -84,7 +62,7 @@ namespace boxmon
{
const auto &command_list = get_command_list();
for (auto cmd : command_list) {
- fn(cmd);
+ fn(cmd.second);
}
}
@@ -92,17 +70,17 @@ namespace boxmon
{
const auto &command_list = get_command_list();
for (auto cmd : command_list) {
- if (strstr(cmd->get_name(), name) != nullptr) {
- fn(cmd);
- } else if (strstr(cmd->get_description(), name) != nullptr) {
- fn(cmd);
+ if (strstr(cmd.second->get_name(), name) != nullptr) {
+ fn(cmd.second);
+ } else if (strstr(cmd.second->get_description(), name) != nullptr) {
+ fn(cmd.second);
}
}
}
- std::vector &boxmon_command::get_command_list()
+ std::map &boxmon_command::get_command_list()
{
- static std::vector command_list;
+ static std::map command_list;
return command_list;
}
@@ -196,7 +174,7 @@ BOXMON_ALIAS(al, add_label);
BOXMON_COMMAND(backtrace, "backtrace")
{
char const *names[] = { "N", "V", "-", "B", "D", "I", "Z", "C" };
- for (size_t i = 0; i < stack6502.count(); ++i) {
+ for (size_t i = 0; i < state6502.sp_depth; ++i) {
const auto &ss = stack6502[static_cast(i)];
char const *op = [&]() -> char const * {
switch (ss.op_type) {
@@ -206,6 +184,9 @@ BOXMON_COMMAND(backtrace, "backtrace")
case _stack_op_type::irq:
return "IRQ";
break;
+ case _stack_op_type::smart:
+ return "---";
+ break;
case _stack_op_type::op:
return mnemonics[ss.opcode];
break;
diff --git a/src/boxmon/command.h b/src/boxmon/command.h
index 7d9654c..729d360 100644
--- a/src/boxmon/command.h
+++ b/src/boxmon/command.h
@@ -2,6 +2,7 @@
#include
#include
+#include