1 // license:BSD-3-Clause 2 // copyright-holders:David Haywood 3 /************************************************************************************************************* 4 5 Toshiba TLCS-870 Series MCUs 6 7 The TLCS-870/X expands on this instruction set using the same base encoding. 8 9 The TLCS-870/C appears to have a completely different encoding. 10 11 loosely baesd on the tlcs90 core by Luca Elia 12 13 *************************************************************************************************************/ 14 15 #ifndef MAME_CPU_TLCS870_TLCS870D_H 16 #define MAME_CPU_TLCS870_TLCS870D_H 17 18 #pragma once 19 20 class tlcs870_disassembler : public util::disasm_interface 21 { 22 public: 23 tlcs870_disassembler() = default; 24 virtual ~tlcs870_disassembler() = default; 25 26 virtual u32 opcode_alignment() const override; 27 virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override; 28 29 private: 30 enum _e_op { 31 UNKNOWN = 0x00, 32 CALL, CALLP, CALLV, CLR, CPL, 33 DAA, DAS, DEC, /*DI,*/ DIV, 34 /*EI,*/ 35 INC, 36 /*J,*/ JP, JR, JRS, 37 LD, LDW, 38 MCMP, MUL, 39 NOP, 40 POP, PUSH, 41 RET, RETI, RETN, ROLC, ROLD, RORC, RORD, 42 SET, SHLC, SHRC, SWAP, SWI, 43 /*TEST,*/ XCH, 44 45 ALU_ADDC, 46 ALU_ADD, 47 ALU_SUBB, 48 ALU_SUB, 49 ALU_AND, 50 ALU_XOR, 51 ALU_OR, 52 ALU_CMP 53 }; 54 55 static const char *const op_names[]; 56 static const char *const reg8[]; 57 static const char *const type_x[]; 58 static const char *const conditions[]; 59 static const char *const reg16[]; 60 static const char *const reg16p[]; 61 62 uint16_t m_op; 63 int m_param2_type; 64 uint16_t m_param2; 65 66 int m_param1_type; 67 uint16_t m_param1; 68 69 uint8_t m_bitpos; 70 uint8_t m_flagsaffected; 71 uint8_t m_cycles; 72 73 uint32_t m_addr; 74 75 const data_buffer *m_opcodes; 76 77 inline uint8_t READ8(); 78 inline uint16_t READ16(); 79 80 void decode(); 81 void decode_register_prefix(uint8_t b0); 82 void decode_source(int type, uint16_t val); 83 void decode_dest(uint8_t b0); 84 85 void disassemble_param(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms, int type, uint16_t val); 86 }; 87 88 #endif 89