|
|
@ -25,6 +25,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
constinit static sforth::forth<8192> forth {sforth::initialize<&forth>()};
|
|
|
|
constinit static sforth::forth<8192> forth {sforth::initialize<&forth>()};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool sforth_debug_hook()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
char c;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::cout << "DS: ";
|
|
|
|
|
|
|
|
for (auto it = forth.sp; it != forth.dstack.end(); it++) {
|
|
|
|
|
|
|
|
std::cout << *it << ' ';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
std::cout << std::endl;
|
|
|
|
|
|
|
|
std::cout << "RS: ";
|
|
|
|
|
|
|
|
for (auto it = forth.rp; it != forth.rstack.end(); it++) {
|
|
|
|
|
|
|
|
if (auto w = forth.lookup(*it); w)
|
|
|
|
|
|
|
|
std::cout << (*w)->name() << '+' << ((sforth::addr)*it - std::bit_cast<sforth::addr>((*w)->body())) << ' ';
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
std::cout << *it << ' ';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
std::cout << std::endl;
|
|
|
|
|
|
|
|
std::cout << "HERE: " << (sforth::addr)forth.here << std::endl;
|
|
|
|
|
|
|
|
std::cout << "IP: ";
|
|
|
|
|
|
|
|
if (auto w = forth.lookup(forth.ip); w)
|
|
|
|
|
|
|
|
std::cout << (*w)->name() << '+' << ((sforth::addr)forth.ip - std::bit_cast<sforth::addr>((*w)->body())) << ' ';
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
std::cout << forth.ip << ' ';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::cout << std::endl << "> ";
|
|
|
|
|
|
|
|
std::cin >> c;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool parse_stream(auto&, std::istream&, bool say_okay = false);
|
|
|
|
static bool parse_stream(auto&, std::istream&, bool say_okay = false);
|
|
|
|
|
|
|
|
|
|
|
|
constinit static sforth::native_word<".", [](auto) {
|
|
|
|
constinit static sforth::native_word<".", [](auto) {
|
|
|
|