summaryrefslogtreecommitdiff
path: root/main.cpp
blob: bc174276b2116d185f4cdb537156c1826361bfaf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <arpa/inet.h>
#include <cstdint>
#include <fmt/format.h>
#include <iostream>

#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;
}