diff options
Diffstat (limited to 'main.cpp')
| -rw-r--r-- | main.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..bc17427 --- /dev/null +++ b/main.cpp | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #include <arpa/inet.h> | ||
| 2 | #include <cstdint> | ||
| 3 | #include <fmt/format.h> | ||
| 4 | #include <iostream> | ||
| 5 | |||
| 6 | #include "isa/checker.h" | ||
| 7 | |||
| 8 | extern std::uint16_t _binary_build___image_bin_start[]; | ||
| 9 | extern std::uint16_t _binary_build___image_bin_end[]; | ||
| 10 | |||
| 11 | int main(int argc, const char *argv[]) { | ||
| 12 | checker checker; | ||
| 13 | |||
| 14 | unsigned int address = 0; | ||
| 15 | for (auto *src = _binary_build___image_bin_start; src < _binary_build___image_bin_end; ++src, ++address) { | ||
| 16 | auto word = ntohs(*src); | ||
| 17 | std::cout << fmt::format("mem[{:04o}] = {:04o}\n", address, word); | ||
| 18 | checker.mem.store(address, word); | ||
| 19 | } | ||
| 20 | |||
| 21 | while (!checker.halted) { | ||
| 22 | std::cout << fmt::format("{:04o}: ", checker.pc); | ||
| 23 | checker.execute(); | ||
| 24 | std::cout << fmt::format("acc={:04o}\n", checker.acc); | ||
| 25 | } | ||
| 26 | |||
| 27 | return 0; | ||
| 28 | } | ||
