From f279e467e38281cfdee60b197588109abd08e83d Mon Sep 17 00:00:00 2001 From: Oxore Date: Mon, 1 May 2023 13:49:46 +0300 Subject: Impl TRAP --- disasm.cpp | 8 +++++--- test.bash | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/disasm.cpp b/disasm.cpp index 01a4af5..7026b63 100644 --- a/disasm.cpp +++ b/disasm.cpp @@ -656,10 +656,12 @@ static void disasm_move_to( } static void disasm_trap( - DisasmNode& node, uint16_t instr, const DataBuffer &code, const Settings &s) + DisasmNode& node, uint16_t instr, const DataBuffer &, const Settings &) { - // TODO - return disasm_verbatim(node, instr, code, s); + const unsigned vector = instr & 0xf; + snprintf(node.mnemonic, kMnemonicBufferSize, "trap"); + snprintf(node.arguments, kArgsBufferSize, "#%u", vector); + node.size = kInstructionSizeStepBytes; } static void disasm_link_unlink( diff --git a/test.bash b/test.bash index 371f535..0c37864 100644 --- a/test.bash +++ b/test.bash @@ -93,6 +93,12 @@ run_test_iterative() { done } +# 4e4x +# +run_test_simple "trap 0" "\x4e\x40" +run_test_simple "trap 8" "\x4e\x48" +run_test_simple "trap 15" "\x4e\x4f" + # 4e5x # run_test_simple "linkw positive" "\x4e\x52\x01\x00" -- cgit v1.2.3