Add CompactRISC CR16C disassembler to unidasm (largely untested)

This commit is contained in:
AJR 2020-12-16 12:17:56 -05:00
parent 699011f2f8
commit 4f70f2d58b
4 changed files with 1531 additions and 1 deletions

View File

@ -3150,7 +3150,7 @@ end
--------------------------------------------------
-- National Semiconductor CR16B
--@src/devices/cpu/cr16b/cr16bdasm.h,CPUS["CR16B"] = true
--@src/devices/cpu/cr16b/cr16b.h,CPUS["CR16B"] = true
--------------------------------------------------
if (CPUS["CR16B"]~=null) then
@ -3165,6 +3165,15 @@ if (CPUS["CR16B"]~=null or _OPTIONS["with-tools"]) then
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/cr16b/cr16bdasm.h")
end
--------------------------------------------------
-- National Semiconductor CR16C, disassembler only
--------------------------------------------------
if (_OPTIONS["with-tools"]) then
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/cr16c/cr16cdasm.cpp")
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/cr16c/cr16cdasm.h")
end
--------------------------------------------------
-- Gigatron
--@src/devices/cpu/gigatron/gigatron.h,CPUS["GTRON"] = true

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
// license:BSD-3-Clause
// copyright-holders:AJR
#ifndef MAME_CPU_CR16C_CR16CDASM_H
#define MAME_CPU_CR16C_CR16CDASM_H 1
#pragma once
class cr16c_disassembler : public util::disasm_interface
{
public:
// construction/destruction
cr16c_disassembler();
// disassembler overrides
virtual u32 opcode_alignment() const override;
virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params) override;
protected:
// formatting helpers
void format_reg(std::ostream &stream, u8 value);
void format_rpair(std::ostream &stream, u8 value);
void format_rrpair(std::ostream &stream, u8 value);
void format_rproc(std::ostream &stream, u8 value, bool d);
void format_imm20(std::ostream &stream, u32 imm);
void format_imm32(std::ostream &stream, u32 imm);
void format_abs20(std::ostream &stream, u32 addr);
void format_abs24(std::ostream &stream, u32 addr);
void format_disp4(std::ostream &stream, u8 disp);
void format_disp4_x2(std::ostream &stream, u8 disp);
void format_disp14(std::ostream &stream, u16 disp);
void format_disp16(std::ostream &stream, u16 disp);
void format_disp20(std::ostream &stream, u32 disp);
void format_disp20_neg(std::ostream &stream, u32 disp);
void format_pc_disp4(std::ostream &stream, offs_t pc, u8 disp);
void format_pc_disp8(std::ostream &stream, offs_t pc, u8 disp);
void format_pc_disp16(std::ostream &stream, offs_t pc, u16 disp);
void format_pc_disp24(std::ostream &stream, offs_t pc, u32 disp);
void format_excp_vect(std::ostream &stream, u8 value);
// disassembly helpers
offs_t dasm_imm4_16_reg(std::ostream &stream, offs_t pc, u16 opcode, bool i, const data_buffer &opcodes);
offs_t dasm_imm4_16_rpair(std::ostream &stream, offs_t pc, u16 opcode, const data_buffer &opcodes);
private:
// static tables
static const char *const s_cc[14];
};
#endif // MAME_CPU_CR16C_CR16CDASM_H

View File

@ -38,6 +38,7 @@ using util::BIT;
#include "cpu/cosmac/cosdasm.h"
#include "cpu/cp1610/1610dasm.h"
#include "cpu/cr16b/cr16bdasm.h"
#include "cpu/cr16c/cr16cdasm.h"
#include "cpu/cubeqcpu/cubedasm.h"
#include "cpu/dsp16/dsp16dis.h"
#include "cpu/dsp32/dsp32dis.h"
@ -387,6 +388,7 @@ static const dasm_table_entry dasm_table[] =
{ "cp1610", be, -1, []() -> util::disasm_interface * { return new cp1610_disassembler; } },
{ "cr16a", le, 0, []() -> util::disasm_interface * { return new cr16a_disassembler; } },
{ "cr16b", le, 0, []() -> util::disasm_interface * { return new cr16b_disassembler; } },
{ "cr16c", le, 0, []() -> util::disasm_interface * { return new cr16c_disassembler; } },
{ "cquestlin", be, -3, []() -> util::disasm_interface * { return new cquestlin_disassembler; } },
{ "cquestrot", be, -3, []() -> util::disasm_interface * { return new cquestrot_disassembler; } },
{ "cquestsnd", be, -3, []() -> util::disasm_interface * { return new cquestsnd_disassembler; } },