summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/mcs96/mcs96d.h
blob: 453727258bf91192ce60f83bd3a032f1054a8094 (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
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert, R. Belmont
/***************************************************************************

    mcs96.h

    MCS96

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

#ifndef MAME_CPU_MCS96_MCS96D_H
#define MAME_CPU_MCS96_MCS96D_H

#pragma once

class mcs96_disassembler : public util::disasm_interface
{
public:
	struct disasm_entry {
		const char *opcode, *opcode_fe;
		int mode;
		offs_t flags;
	};

	mcs96_disassembler(const disasm_entry *entries);
	virtual ~mcs96_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:
	enum {
		DASM_none,              /* No parameters */
		DASM_nop_2,             /* One ignored parameter byte */
		DASM_rel8,              /* Relative, 8 bits */
		DASM_rel11,             /* Relative, 11 bits */
		DASM_rel16,             /* Relative, 16 bits */
		DASM_rrel8,             /* Register + relative, 8 bits */
		DASM_brrel8,            /* Bit test + register + relative, 8 bits */
		DASM_direct_1,          /* Register-direct references, 1 operator */
		DASM_direct_2,          /* Register-direct references, 2 operators */
		DASM_direct_3,          /* Register-direct references, 3 operators */
		DASM_immed_1b,          /* Immediate references to byte, 1 operator */
		DASM_immed_2b,          /* Immediate references to byte, 2 operators */
		DASM_immed_or_reg_2b,   /* Immediate references to byte or register, 2 operators */
		DASM_immed_3b,          /* Immediate references to byte, 3 operators */
		DASM_immed_1w,          /* Immediate references to word, 1 operator */
		DASM_immed_2w,          /* Immediate references to word, 2 operators */
		DASM_immed_3w,          /* Immediate references to word, 3 operators */
		DASM_indirect_1n,       /* Indirect normal, 1 operator */
		DASM_indirect_1,        /* Indirect, normal or auto-incrementing, 1 operator */
		DASM_indirect_2,        /* Indirect, normal or auto-incrementing, 2 operators */
		DASM_indirect_3,        /* Indirect, normal or auto-incrementing, 3 operators */
		DASM_indexed_1,         /* Indexed, short or long, 1 operator */
		DASM_indexed_2,         /* Indexed, short or long, 2 operators */
		DASM_indexed_3          /* Indexed, short or long, 3 operators */
	};

	const disasm_entry *m_entries;

	static std::string regname(uint8_t reg);
};

#endif