blob: 98272befc89e6b4e25b42d0ddba54b0638e5b0cd (
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
96
97
98
99
100
101
102
103
104
105
106
|
// license:BSD-3-Clause
// copyright-holders:Steve Ellenoff
/*****************************************************************************
*
* i8051dasm.c
* Portable MCS-51 Family Emulator
*
* Chips in the family:
* 8051 Product Line (8031,8051,8751)
* 8052 Product Line (8032,8052,8752)
* 8054 Product Line (8054)
* 8058 Product Line (8058)
*
* Copyright Steve Ellenoff, all rights reserved.
*
* This work is based on:
* #1) 'Intel(tm) MC51 Microcontroller Family Users Manual' and
* #2) 8051 simulator by Travis Marlatte
* #3) Portable UPI-41/8041/8741/8042/8742 emulator V0.1 by Juergen Buchmueller (MAME CORE)
*
*****************************************************************************
* Symbol Memory Name Tables borrowed from:
* D52 8052 Disassembler - Copyright Jeffery L. Post
*****************************************************************************/
#ifndef MAME_CPU_MCS51_MCS51DASM_H
#define MAME_CPU_MCS51_MCS51DASM_H
#pragma once
class mcs51_disassembler : public util::disasm_interface
{
public:
struct mem_info {
int addr;
const char *name;
};
static const mem_info default_names[];
static const mem_info i8052_names[];
static const mem_info i80c52_names[];
static const mem_info ds5002fp_names[];
static const mem_info i8xc751_names[];
template<typename ...Names> mcs51_disassembler(Names &&... names) : mcs51_disassembler() {
add_names(names...);
}
mcs51_disassembler();
virtual ~mcs51_disassembler() = default;
template<typename ...Names> void add_names(const mem_info *info, Names &&... names)
{
add_names(names...);
add_names(info);
}
void add_names(const mem_info *info);
virtual u32 opcode_alignment() const override;
virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override;
private:
std::unordered_map<offs_t, const char *> m_names;
std::string get_data_address( uint8_t arg ) const;
std::string get_bit_address( uint8_t arg ) const;
};
class i8051_disassembler : public mcs51_disassembler
{
public:
i8051_disassembler();
virtual ~i8051_disassembler() = default;
};
class i8052_disassembler : public mcs51_disassembler
{
public:
i8052_disassembler();
virtual ~i8052_disassembler() = default;
};
class i80c51_disassembler : public mcs51_disassembler
{
public:
i80c51_disassembler();
virtual ~i80c51_disassembler() = default;
};
class i80c52_disassembler : public mcs51_disassembler
{
public:
i80c52_disassembler();
virtual ~i80c52_disassembler() = default;
};
class ds5002fp_disassembler : public mcs51_disassembler
{
public:
ds5002fp_disassembler();
virtual ~ds5002fp_disassembler() = default;
};
#endif
|