1 // license:BSD-3-Clause 2 // copyright-holders:Karl Stenerud 3 #pragma once 4 5 #ifndef __SPC700DS_H__ 6 #define __SPC700DS_H__ 7 /* ======================================================================== */ 8 /* =============================== COPYRIGHT ============================== */ 9 /* ======================================================================== */ 10 /* 11 12 Sony SPC700 CPU Emulator V1.0 13 14 Copyright Karl Stenerud 15 All rights reserved. 16 17 18 */ 19 20 class spc700_disassembler : public util::disasm_interface 21 { 22 public: 23 spc700_disassembler() = default; 24 virtual ~spc700_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 struct spc700_opcode_struct 31 { 32 unsigned char name; 33 unsigned char args[2]; 34 }; 35 36 enum 37 { 38 IMP , A , X , Y , YA , SP , PSW , C , REL , UPAG, IMM , XI , 39 XII , YI , DP , DPX , DPY , DPI , DXI , DIY , ABS , ABX , ABY , AXI , N0 , 40 N1 , N2 , N3 , N4 , N5 , N6 , N7 , N8 , N9 , N10 , N11 , N12 , 41 N13 , N14 , N15 , DP0 , DP1 , DP2 , DP3 , DP4 , DP5 , DP6 , DP7 , MEMN, 42 MEMI 43 }; 44 45 enum 46 { 47 ADC , ADDW , AND , AND1 , ASL , BBC , BBS , BCC , 48 BCS , BEQ , BMI , BNE , BPL , BRA , BRK , BVC , 49 BVS , CALL , CBNE , CLR1 , CLRC , CLRP , CLRV , CMP , 50 CMPW , DAA , DAS , DBNZ , DEC , DECW , DI , DIV , 51 EI , EOR , EOR1 , INC , INCW , JMP , LSR , MOV , 52 MOV1 , MOVW , MUL , NOP , NOT1 , NOTQ , NOTC , OR , 53 OR1 , PCALL , POP , PUSH , RET , RETI , ROL , ROR , 54 SBC , SET1 , SETC , SETP , SLEEP , STOP , SUBW , TCALL , 55 TCLR1 , TSET1 , XCN 56 }; 57 58 static const char *const g_opnames[]; 59 static const spc700_opcode_struct g_opcodes[256]; 60 static inline unsigned int read_8_immediate(offs_t &pc, const data_buffer &opcodes); 61 static inline unsigned int read_16_immediate(offs_t &pc, const data_buffer &opcodes); 62 }; 63 64 65 #endif /* __SPC700DS_H__ */ 66