summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/tlcs90/tlcs90d.h
blob: 2c71cd432d27d7f369318d8dbb6913fdaa1cbd60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// license:BSD-3-Clause
// copyright-holders:Luca Elia
/*************************************************************************************************************

    Toshiba TLCS-90 Series MCU's

    emulation by Luca Elia, based on the Z80 core by Juergen Buchmueller

    ChangeLog:

    20150517 Fixed TRUN bit masking (timers start/stop handling) [Rainer Keuchel]

*************************************************************************************************************/

#ifndef MAME_CPU_TLCS90_TLCS90D_H
#define MAME_CPU_TLCS90_TLCS90D_H

#pragma once

class tlcs90_disassembler : public util::disasm_interface
{
public:
	virtual ~tlcs90_disassembler() = default;
	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:
	tlcs90_disassembler(uint16_t iobase, const char *const ir_names[]);

private:
	enum _e_op {    UNKNOWN,    NOP,    EX,     EXX,    LD,     LDW,    LDA,    LDI,    LDIR,   LDD,    LDDR,   CPI,    CPIR,   CPD,    CPDR,   PUSH,   POP,    JP,     JR,     CALL,   CALLR,      RET,    RETI,   HALT,   DI,     EI,     SWI,    DAA,    CPL,    NEG,    LDAR,   RCF,    SCF,    CCF,    TSET,   BIT,    SET,    RES,    INC,    DEC,    INCX,   DECX,   INCW,   DECW,   ADD,    ADC,    SUB,    SBC,    AND,    XOR,    OR,     CP,     RLC,    RRC,    RL,     RR,     SLA,    SRA,    SLL,    SRL,    RLD,    RRD,    DJNZ,   MUL,    DIV     };

	enum class e_mode : u8 {
		NONE,   BIT8,   CC,
		I8,     D8,     R8,
		I16,    D16,    R16,
		MI16,   MR16,   MR16D8, MR16R8,
		R16D8,  R16R8
	};

	static const char *const op_names[];
	static const char *const r8_names[];
	static const char *const r16_names[];
	static const char *const cc_names[];

	const uint16_t m_iobase;
	const char *const *m_ir_names;

	uint8_t        m_op;

	e_mode  m_mode1;
	uint16_t  m_r1,m_r1b;

	e_mode  m_mode2;
	uint16_t  m_r2,m_r2b;

	offs_t m_addr;
	const data_buffer *m_opcodes;

	inline uint8_t  READ8();
	inline uint16_t READ16();
	void decode();

	bool stream_arg(std::ostream &stream, uint32_t pc, const char *pre, const e_mode mode, const uint16_t r, const uint16_t rb);
	const char *internal_registers_names(uint16_t x) const;
};

class tmp90840_disassembler : public tlcs90_disassembler
{
public:
	tmp90840_disassembler();

private:
	static const char *const ir_names[];
};

class tmp90844_disassembler : public tlcs90_disassembler
{
public:
	tmp90844_disassembler();

private:
	static const char *const ir_names[];
};

class tmp90c051_disassembler : public tlcs90_disassembler
{
public:
	tmp90c051_disassembler();

private:
	static const char *const ir_names[];
};

#endif