1 // license:BSD-3-Clause
2 // copyright-holders:Tony La Porta, hap
3 	/**************************************************************************\
4 	*              Texas Instruments TMS320x25 DSP Disassembler                *
5 	*                                                                          *
6 	*                 Copyright Tony La Porta                                  *
7 	*              To be used with TMS320x25 DSP Emulator engine.              *
8 	*                      Written for the MAME project.                       *
9 	*                                                                          *
10 	*         Many thanks to those involved in the i8039 Disassembler          *
11 	*               as the structure here was borrowed from it.                *
12 	*                                                                          *
13 	*      Note :  This is a word based microcontroller, with addressing       *
14 	*              architecture based on the Harvard addressing scheme.        *
15 	*                                                                          *
16 	*                                                                          *
17 	* A Memory Address                                                         *
18 	* B Opcode Address Argument (Requires next opcode read)                    *
19 	* C Compare mode                                                           *
20 	* D Immediate byte load                                                    *
21 	* K Immediate bit load                                                     *
22 	* W Immediate word load                                                    *
23 	* M AR[x] register modification type (for indirect addressing)             *
24 	* N ARP register to change ARP pointer to (for indirect addressing)        *
25 	* P I/O port address number                                                *
26 	* R AR[R] register to use                                                  *
27 	* S Shift ALU left                                                         *
28 	* T Shift ALU left (Hex) / Nibble data                                     *
29 	* X Don't care bit                                                         *
30 	*                                                                          *
31 	\**************************************************************************/
32 
33 #ifndef MAME_CPU_TMS32025_32025DSM_H
34 #define MAME_CPU_TMS32025_32025DSM_H
35 
36 #pragma once
37 
38 class tms32025_disassembler : public util::disasm_interface
39 {
40 public:
41 	tms32025_disassembler();
42 	virtual ~tms32025_disassembler() = default;
43 
44 	virtual u32 opcode_alignment() const override;
45 	virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params) override;
46 
47 private:
48 	struct TMS32025Opcode  {
49 		u16 mask;          /* instruction mask */
50 		u16 bits;          /* constant bits */
51 		u16 extcode;       /* value that gets extension code */
52 		const char *parse; /* how to parse bits */
53 		const char *fmt;   /* instruction format */
54 
TMS32025OpcodeTMS32025Opcode55 		TMS32025Opcode(u16 m, u16 b, u16 e, const char *p, const char *f) : mask(m), bits(b), extcode(e), parse(p), fmt(f) {}
56 	};
57 
58 	static const char *const arith[8];
59 	static const char *const nextar[16];
60 	static const char *const cmpmode[4];
61 	static const char *const TMS32025Formats[];
62 
63 	std::vector<TMS32025Opcode> Op;
64 };
65 
66 #endif
67