From 85b34e1c9dc03585ec4f13f6241cd8f0ecaf9cd9 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sat, 8 Oct 2022 00:39:15 -0700 Subject: Trivial support for running the checker on an image. --- main.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 main.cpp (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..bc17427 --- /dev/null +++ b/main.cpp @@ -0,0 +1,28 @@ +#include +#include +#include +#include + +#include "isa/checker.h" + +extern std::uint16_t _binary_build___image_bin_start[]; +extern std::uint16_t _binary_build___image_bin_end[]; + +int main(int argc, const char *argv[]) { + checker checker; + + unsigned int address = 0; + for (auto *src = _binary_build___image_bin_start; src < _binary_build___image_bin_end; ++src, ++address) { + auto word = ntohs(*src); + std::cout << fmt::format("mem[{:04o}] = {:04o}\n", address, word); + checker.mem.store(address, word); + } + + while (!checker.halted) { + std::cout << fmt::format("{:04o}: ", checker.pc); + checker.execute(); + std::cout << fmt::format("acc={:04o}\n", checker.acc); + } + + return 0; +} -- cgit v1.2.3