12 std::set<std::string, std::less<>> allInstructions;
13 std::array<uint8_t, 4> opcode = {0, 0, 0, 0};
14 std::string dasmString;
23 REQUIRE(1 <= *instrLen);
24 REQUIRE(*instrLen <= 4);
27 auto dasmLen =
dasm(std::span(opcode.data(), *instrLen), 0x1234, dasmString);
28 CHECK(dasmLen == *instrLen);
31 auto [it, inserted] = allInstructions.insert(dasmString);
34 if (dasmLen != *instrLen || !inserted) {
36 for (
auto i :
xrange(*instrLen)) {
37 strAppend(info,
' ', hex_string<2>(opcode[i]));
39 std::cout <<
"opcode:" << info <<
" (" << dasmString <<
")\n";
43 unsigned idx = *instrLen - 1;
45 if (opcode[idx] == 255) {
58 REQUIRE(count == 2'904'196);
unsigned dasm(std::span< const uint8_t > opcode, uint16_t pc, std::string &dest, function_ref< void(std::string &, uint16_t)> appendAddr)
Disassemble.