--- nono/m680x0/testdis.cpp 2026/04/29 17:04:28 1.1 +++ nono/m680x0/testdis.cpp 2026/04/29 17:04:34 1.1.1.3 @@ -1,11 +1,10 @@ // // nono -// Copyright (C) 2018 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // -#include "header.h" -#include "disasm.h" -#include "m68030.h" +#include "m68030disasm.h" #include "mystring.h" #include @@ -827,11 +826,11 @@ struct { { { 0xf350 }, "frestore (a0)" }, }; -uint8 mem[1024]; -int failed; +static uint8 mem[1024]; +static int failed; -uint32 -m68030_phys_peek_8(uint32 addr) +uint64 +vm_phys_peek_8(uint32 addr) { if (addr >= sizeof(mem)) { abort(); @@ -840,6 +839,7 @@ m68030_phys_peek_8(uint32 addr) } // リンカを通すためのダミー +extern uint64 m68030_mmu_translate_peek(m68kcpu *, uint32, uint); uint64 m68030_mmu_translate_peek(m68kcpu *cpu, uint32 addr, uint fc) { @@ -849,8 +849,7 @@ m68030_mmu_translate_peek(m68kcpu *cpu, int main(int ac, char *av[]) { - std::string buf; - uint32 nextpc; + saddr_t saddr; for (int i = 0; i < countof(table); i++) { std::string expected = table[i].expected; @@ -869,20 +868,20 @@ main(int ac, char *av[]) *(uint16 *)(mem + 0x100 + j * 2) = inst[j]; } // 検査 - Disasm disasm; - buf = disasm.Disassemble(0x100); - nextpc = disasm.GetNextAddr(); + m680x0disasm dis(NULL); + saddr.addr = 0x100; + dis.Exec(saddr); // 照合 - if (buf != expected) { + if (dis.text != expected) { printf(">%s expects \"%s\" but \"%s\"\n", inst_str.c_str(), - expected.c_str(), buf.c_str()); + expected.c_str(), dis.text.c_str()); failed++; continue; } - uint32 expected_pc = 0x100 + inst.size() * 2; - if (nextpc != expected_pc) { - printf(">%s expects nextpc=$%x but $%x\n", inst_str.c_str(), - expected_pc, nextpc); + uint32 expected_len = inst.size() * 2; + if (dis.bin.size() != expected_len) { + printf(">%s expects len=$%x but $%x\n", inst_str.c_str(), + expected_len, (uint)dis.bin.size()); failed++; continue; }