diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/cpu/e132xs/32xsdasm.cpp | 88 | ||||
-rw-r--r-- | src/devices/cpu/e132xs/32xsdasm.h | 6 | ||||
-rw-r--r-- | src/devices/cpu/e132xs/e132xs.cpp | 117 | ||||
-rw-r--r-- | src/devices/cpu/e132xs/e132xs.h | 5 | ||||
-rw-r--r-- | src/tools/unidasm.cpp | 4 |
5 files changed, 73 insertions, 147 deletions
diff --git a/src/devices/cpu/e132xs/32xsdasm.cpp b/src/devices/cpu/e132xs/32xsdasm.cpp index 6d3ececb34d..71fc4ce4c40 100644 --- a/src/devices/cpu/e132xs/32xsdasm.cpp +++ b/src/devices/cpu/e132xs/32xsdasm.cpp @@ -12,26 +12,23 @@ #include "32xsdefs.h" -const char *const hyperstone_disassembler::L_REG[] = +namespace { + +const char *const L_REG[] = { - "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7", "L8", "L9", - "L10", "L11", "L12", "L13", "L14", "L15", "L16", "L17", "L18", "L19", - "L20", "L21", "L22", "L23", "L24", "L25", "L26", "L27", "L28", "L29", - "L30", "L31", "L32", "L33", "L34", "L35", "L36", "L37", "L38", "L39", - "L40", "L41", "L42", "L43", "L44", "L45", "L46", "L47", "L48", "L49", - "L50", "L51", "L52", "L53", "L54", "L55", "L56", "L57", "L58", "L59", - "L60", "L61", "L62", "L63" + "L0", "L1", "L2", "L3", "L4", "L5", "L6", "L7", + "L8", "L9", "L10", "L11", "L12", "L13", "L14", "L15" }; -const char *const hyperstone_disassembler::G_REG[] = +const char *const G_REG[] = { - "PC", "SR", "FER", "G03", "G04", "G05", "G06", "G07", "G08", "G09", - "G10", "G11", "G12", "G13", "G14", "G15", "G16", "G17", "SP", "UB", - "BCR", "TPR", "TCR", "TR", "WCR", "ISR", "FCR", "MCR", "G28", "G29", - "G30", "G31" + "PC", "SR", "FER", "G03", "G04", "G05", "G06", "G07", + "G08", "G09", "G10", "G11", "G12", "G13", "G14", "G15", + "G16", "G17", "SP", "UB", "BCR", "TPR", "TCR", "TR", + "WCR", "ISR", "FCR", "MCR", "G28", "G29", "G30", "G31" }; -const char *const hyperstone_disassembler::SETxx[] = +const char *const SETxx[] = { "SETADR", "Reserved", "SET1", "SET0", "SETLE", "SETGT", "SETLT", "SETGE", "SETSE", "SETHT", "SETST", "SETHE", "SETE", "SETNE", "SETV", "SETNV", @@ -45,42 +42,37 @@ const char *const hyperstone_disassembler::SETxx[] = #define SOURCEBIT(op) ((op & 0x100) >> 8) #define DESTBIT(op) ((op & 0x200) >> 9) -#define DASM_N_VALUE(op) ((((op & 0x100) >> 8) << 4 ) | (op & 0x0f)) +#define DASM_N_VALUE(op) ((((op & 0x100) >> 8) << 4 ) | (op & 0x0f)) + +} // anonymous namespace + void hyperstone_disassembler::LL_format(char *source, char *dest, uint16_t op) { - strcpy(source, L_REG[(SOURCECODE(op)+global_fp)%64]); - strcpy(dest, L_REG[(DESTCODE(op)+global_fp)%64]); + strcpy(source, L_REG[SOURCECODE(op)]); + strcpy(dest, L_REG[DESTCODE(op)]); } void hyperstone_disassembler::LR_format(char *source, char *dest, uint16_t op) { - if( SOURCEBIT(op) ) - { - strcpy(source, L_REG[(SOURCECODE(op)+global_fp)%64]); - } + if (SOURCEBIT(op)) + strcpy(source, L_REG[SOURCECODE(op)]); else - { strcpy(source, G_REG[SOURCECODE(op)]); - } - strcpy(dest, L_REG[(DESTCODE(op)+global_fp)%64]); + strcpy(dest, L_REG[DESTCODE(op)]); } void hyperstone_disassembler::RR_format(char *source, char *dest, uint16_t op, unsigned h_flag) { - if( SOURCEBIT(op) ) - { - strcpy(source, L_REG[(SOURCECODE(op)+global_fp)%64]); - } + if (SOURCEBIT(op)) + strcpy(source, L_REG[SOURCECODE(op)]); else - { strcpy(source, G_REG[SOURCECODE(op) + h_flag * 16]); - } - if( DESTBIT(op) ) + if (DESTBIT(op)) { - strcpy(dest, L_REG[(DESTCODE(op)+global_fp)%64]); + strcpy(dest, L_REG[DESTCODE(op)]); } else { @@ -93,16 +85,16 @@ uint32_t hyperstone_disassembler::LRconst_format(char *source, char *dest, uint1 uint16_t next_op; uint32_t const_val; - if( SOURCEBIT(op) ) + if (SOURCEBIT(op)) { - strcpy(source, L_REG[(SOURCECODE(op)+global_fp)%64]); + strcpy(source, L_REG[SOURCECODE(op)]); } else { strcpy(source, G_REG[SOURCECODE(op)]); } - strcpy(dest, L_REG[(DESTCODE(op)+global_fp)%64]); + strcpy(dest, L_REG[DESTCODE(op)]); size = 4; @@ -145,7 +137,7 @@ uint32_t hyperstone_disassembler::RRconst_format(char *source, char *dest, uint1 if( SOURCEBIT(op) ) { - strcpy(source, L_REG[(SOURCECODE(op)+global_fp)%64]); + strcpy(source, L_REG[SOURCECODE(op)]); } else { @@ -154,7 +146,7 @@ uint32_t hyperstone_disassembler::RRconst_format(char *source, char *dest, uint1 if( DESTBIT(op) ) { - strcpy(dest, L_REG[(DESTCODE(op)+global_fp)%64]); + strcpy(dest, L_REG[DESTCODE(op)]); } else { @@ -202,16 +194,12 @@ int32_t hyperstone_disassembler::Rimm_format(char *dest, uint16_t op, offs_t &pc int n = DASM_N_VALUE(op); - if( DESTBIT(op) ) - { - strcpy(dest, L_REG[(DESTCODE(op)+global_fp)%64]); - } + if (DESTBIT(op)) + strcpy(dest, L_REG[DESTCODE(op)]); else - { strcpy(dest, G_REG[DESTCODE(op) + h_flag * 16]); - } - switch( n ) + switch (n) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: @@ -285,7 +273,7 @@ int32_t hyperstone_disassembler::Rimm_format(char *dest, uint16_t op, offs_t &pc uint8_t hyperstone_disassembler::Ln_format(char *dest, uint16_t op) { - strcpy(dest, L_REG[(DESTCODE(op)+global_fp)%64]); + strcpy(dest, L_REG[DESTCODE(op)]); return DASM_N_VALUE(op); } @@ -294,7 +282,7 @@ uint8_t hyperstone_disassembler::Rn_format(char *dest, uint16_t op) { if( DESTBIT(op) ) { - strcpy(dest, L_REG[(DESTCODE(op)+global_fp)%64]); + strcpy(dest, L_REG[DESTCODE(op)]); } else { @@ -342,7 +330,7 @@ uint32_t hyperstone_disassembler::RRdis_format(char *source, char *dest, uint16_ if( SOURCEBIT(op) ) { - strcpy(source, L_REG[(SOURCECODE(op)+global_fp)%64]); + strcpy(source, L_REG[SOURCECODE(op)]); } else { @@ -351,7 +339,7 @@ uint32_t hyperstone_disassembler::RRdis_format(char *source, char *dest, uint16_ if( DESTBIT(op) ) { - strcpy(dest, L_REG[(DESTCODE(op)+global_fp)%64]); + strcpy(dest, L_REG[DESTCODE(op)]); } else { @@ -412,7 +400,6 @@ offs_t hyperstone_disassembler::disassemble(std::ostream &stream, offs_t pc, con uint8_t source_bit = SOURCEBIT(op); uint8_t dest_bit = DESTBIT(op); - global_fp = m_config->get_fp(); int h_flag = m_config->get_h(); uint8_t op_num = (op & 0xff00) >> 8; @@ -449,7 +436,6 @@ offs_t hyperstone_disassembler::disassemble(std::ostream &stream, offs_t pc, con if( dest_code == PC_REGISTER && !dest_bit ) { - global_fp = 0; RR_format(source, dest, op, 0); util::stream_format(stream, "RET PC, %s", source); flags = STEP_OUT; @@ -1890,8 +1876,6 @@ offs_t hyperstone_disassembler::disassemble(std::ostream &stream, offs_t pc, con // FRAME case 0xed: - - global_fp = 0; LL_format(source, dest, op); util::stream_format(stream, "FRAME %s, %s", dest, source); diff --git a/src/devices/cpu/e132xs/32xsdasm.h b/src/devices/cpu/e132xs/32xsdasm.h index 6f84fa5321f..60f1c3974fd 100644 --- a/src/devices/cpu/e132xs/32xsdasm.h +++ b/src/devices/cpu/e132xs/32xsdasm.h @@ -18,7 +18,6 @@ public: struct config { virtual ~config() = default; - virtual u8 get_fp() const = 0; virtual bool get_h() const = 0; }; @@ -29,14 +28,9 @@ public: virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override; private: - static const char *const L_REG[]; - static const char *const G_REG[]; - static const char *const SETxx[]; - config *m_config; int size; - u8 global_fp; void LL_format(char *source, char *dest, uint16_t op); void LR_format(char *source, char *dest, uint16_t op); diff --git a/src/devices/cpu/e132xs/e132xs.cpp b/src/devices/cpu/e132xs/e132xs.cpp index c98c5f0801b..c177d918d45 100644 --- a/src/devices/cpu/e132xs/e132xs.cpp +++ b/src/devices/cpu/e132xs/e132xs.cpp @@ -1081,86 +1081,10 @@ void hyperstone_device::device_start() state_add(E132XS_G29, "G29", m_core->global_regs[29]).mask(0xffffffff); state_add(E132XS_G30, "G30", m_core->global_regs[30]).mask(0xffffffff); state_add(E132XS_G31, "G31", m_core->global_regs[31]).mask(0xffffffff); - state_add(E132XS_CL0, "CL0", m_core->local_regs[(0 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL1, "CL1", m_core->local_regs[(1 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL2, "CL2", m_core->local_regs[(2 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL3, "CL3", m_core->local_regs[(3 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL4, "CL4", m_core->local_regs[(4 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL5, "CL5", m_core->local_regs[(5 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL6, "CL6", m_core->local_regs[(6 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL7, "CL7", m_core->local_regs[(7 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL8, "CL8", m_core->local_regs[(8 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL9, "CL9", m_core->local_regs[(9 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL10, "CL10", m_core->local_regs[(10 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL11, "CL11", m_core->local_regs[(11 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL12, "CL12", m_core->local_regs[(12 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL13, "CL13", m_core->local_regs[(13 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL14, "CL14", m_core->local_regs[(14 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_CL15, "CL15", m_core->local_regs[(15 + GET_FP) % 64]).mask(0xffffffff); - state_add(E132XS_L0, "L0", m_core->local_regs[0]).mask(0xffffffff); - state_add(E132XS_L1, "L1", m_core->local_regs[1]).mask(0xffffffff); - state_add(E132XS_L2, "L2", m_core->local_regs[2]).mask(0xffffffff); - state_add(E132XS_L3, "L3", m_core->local_regs[3]).mask(0xffffffff); - state_add(E132XS_L4, "L4", m_core->local_regs[4]).mask(0xffffffff); - state_add(E132XS_L5, "L5", m_core->local_regs[5]).mask(0xffffffff); - state_add(E132XS_L6, "L6", m_core->local_regs[6]).mask(0xffffffff); - state_add(E132XS_L7, "L7", m_core->local_regs[7]).mask(0xffffffff); - state_add(E132XS_L8, "L8", m_core->local_regs[8]).mask(0xffffffff); - state_add(E132XS_L9, "L9", m_core->local_regs[9]).mask(0xffffffff); - state_add(E132XS_L10, "L10", m_core->local_regs[10]).mask(0xffffffff); - state_add(E132XS_L11, "L11", m_core->local_regs[11]).mask(0xffffffff); - state_add(E132XS_L12, "L12", m_core->local_regs[12]).mask(0xffffffff); - state_add(E132XS_L13, "L13", m_core->local_regs[13]).mask(0xffffffff); - state_add(E132XS_L14, "L14", m_core->local_regs[14]).mask(0xffffffff); - state_add(E132XS_L15, "L15", m_core->local_regs[15]).mask(0xffffffff); - state_add(E132XS_L16, "L16", m_core->local_regs[16]).mask(0xffffffff); - state_add(E132XS_L17, "L17", m_core->local_regs[17]).mask(0xffffffff); - state_add(E132XS_L18, "L18", m_core->local_regs[18]).mask(0xffffffff); - state_add(E132XS_L19, "L19", m_core->local_regs[19]).mask(0xffffffff); - state_add(E132XS_L20, "L20", m_core->local_regs[20]).mask(0xffffffff); - state_add(E132XS_L21, "L21", m_core->local_regs[21]).mask(0xffffffff); - state_add(E132XS_L22, "L22", m_core->local_regs[22]).mask(0xffffffff); - state_add(E132XS_L23, "L23", m_core->local_regs[23]).mask(0xffffffff); - state_add(E132XS_L24, "L24", m_core->local_regs[24]).mask(0xffffffff); - state_add(E132XS_L25, "L25", m_core->local_regs[25]).mask(0xffffffff); - state_add(E132XS_L26, "L26", m_core->local_regs[26]).mask(0xffffffff); - state_add(E132XS_L27, "L27", m_core->local_regs[27]).mask(0xffffffff); - state_add(E132XS_L28, "L28", m_core->local_regs[28]).mask(0xffffffff); - state_add(E132XS_L29, "L29", m_core->local_regs[29]).mask(0xffffffff); - state_add(E132XS_L30, "L30", m_core->local_regs[30]).mask(0xffffffff); - state_add(E132XS_L31, "L31", m_core->local_regs[31]).mask(0xffffffff); - state_add(E132XS_L32, "L32", m_core->local_regs[32]).mask(0xffffffff); - state_add(E132XS_L33, "L33", m_core->local_regs[33]).mask(0xffffffff); - state_add(E132XS_L34, "L34", m_core->local_regs[34]).mask(0xffffffff); - state_add(E132XS_L35, "L35", m_core->local_regs[35]).mask(0xffffffff); - state_add(E132XS_L36, "L36", m_core->local_regs[36]).mask(0xffffffff); - state_add(E132XS_L37, "L37", m_core->local_regs[37]).mask(0xffffffff); - state_add(E132XS_L38, "L38", m_core->local_regs[38]).mask(0xffffffff); - state_add(E132XS_L39, "L39", m_core->local_regs[39]).mask(0xffffffff); - state_add(E132XS_L40, "L40", m_core->local_regs[40]).mask(0xffffffff); - state_add(E132XS_L41, "L41", m_core->local_regs[41]).mask(0xffffffff); - state_add(E132XS_L42, "L42", m_core->local_regs[42]).mask(0xffffffff); - state_add(E132XS_L43, "L43", m_core->local_regs[43]).mask(0xffffffff); - state_add(E132XS_L44, "L44", m_core->local_regs[44]).mask(0xffffffff); - state_add(E132XS_L45, "L45", m_core->local_regs[45]).mask(0xffffffff); - state_add(E132XS_L46, "L46", m_core->local_regs[46]).mask(0xffffffff); - state_add(E132XS_L47, "L47", m_core->local_regs[47]).mask(0xffffffff); - state_add(E132XS_L48, "L48", m_core->local_regs[48]).mask(0xffffffff); - state_add(E132XS_L49, "L49", m_core->local_regs[49]).mask(0xffffffff); - state_add(E132XS_L50, "L50", m_core->local_regs[50]).mask(0xffffffff); - state_add(E132XS_L51, "L51", m_core->local_regs[51]).mask(0xffffffff); - state_add(E132XS_L52, "L52", m_core->local_regs[52]).mask(0xffffffff); - state_add(E132XS_L53, "L53", m_core->local_regs[53]).mask(0xffffffff); - state_add(E132XS_L54, "L54", m_core->local_regs[54]).mask(0xffffffff); - state_add(E132XS_L55, "L55", m_core->local_regs[55]).mask(0xffffffff); - state_add(E132XS_L56, "L56", m_core->local_regs[56]).mask(0xffffffff); - state_add(E132XS_L57, "L57", m_core->local_regs[57]).mask(0xffffffff); - state_add(E132XS_L58, "L58", m_core->local_regs[58]).mask(0xffffffff); - state_add(E132XS_L59, "L59", m_core->local_regs[59]).mask(0xffffffff); - state_add(E132XS_L60, "L60", m_core->local_regs[60]).mask(0xffffffff); - state_add(E132XS_L61, "L61", m_core->local_regs[61]).mask(0xffffffff); - state_add(E132XS_L62, "L62", m_core->local_regs[62]).mask(0xffffffff); - state_add(E132XS_L63, "L63", m_core->local_regs[63]).mask(0xffffffff); + for (int i = 0; i < 16; i++) + state_add(E132XS_CL0 + i, util::string_format("L%d", i).c_str(), m_debug_local_regs[i]).mask(0xffffffff).callimport().callexport(); + for (int i = 0; i < 64; i++) + state_add(E132XS_L0 + i, util::string_format("S%d", i).c_str(), m_core->local_regs[i]).mask(0xffffffff); save_item(NAME(m_core->global_regs)); save_item(NAME(m_core->local_regs)); @@ -1359,6 +1283,34 @@ device_memory_interface::space_config_vector hyperstone_device::memory_space_con //------------------------------------------------- +// state_import - import state for the debugger +//------------------------------------------------- + +void hyperstone_device::state_import(const device_state_entry &entry) +{ + if ((entry.index() >= E132XS_CL0) && (entry.index() <= E132XS_CL15)) + { + const auto index = entry.index() - E132XS_CL0; + m_core->local_regs[(index + GET_FP) & 0x3f] = m_debug_local_regs[index]; + } +} + + +//------------------------------------------------- +// state_export - export state for the debugger +//------------------------------------------------- + +void hyperstone_device::state_export(const device_state_entry &entry) +{ + if ((entry.index() >= E132XS_CL0) && (entry.index() <= E132XS_CL15)) + { + const auto index = entry.index() - E132XS_CL0; + m_debug_local_regs[index] = m_core->local_regs[(index + GET_FP) & 0x3f]; + } +} + + +//------------------------------------------------- // state_string_export - export state as a string // for the debugger //------------------------------------------------- @@ -1401,11 +1353,6 @@ std::unique_ptr<util::disasm_interface> hyperstone_device::create_disassembler() return std::make_unique<hyperstone_disassembler>(this); } -u8 hyperstone_device::get_fp() const -{ - return GET_FP; -} - bool hyperstone_device::get_h() const { return GET_H; diff --git a/src/devices/cpu/e132xs/e132xs.h b/src/devices/cpu/e132xs/e132xs.h index da374ece776..5392f88f8e4 100644 --- a/src/devices/cpu/e132xs/e132xs.h +++ b/src/devices/cpu/e132xs/e132xs.h @@ -272,10 +272,11 @@ protected: // device_disasm_interface implementation virtual std::unique_ptr<util::disasm_interface> create_disassembler() override; - virtual u8 get_fp() const override; virtual bool get_h() const override; // device_state_interface implementation + virtual void state_import(const device_state_entry &entry) override; + virtual void state_export(const device_state_entry &entry) override; virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; #if E132XS_LOG_DRC_REGS || E132XS_LOG_INTERPRETER_REGS @@ -458,6 +459,8 @@ private: uml::code_handle *m_io_write32; uml::code_handle *m_exception; + uint32_t m_debug_local_regs[16]; + bool m_enable_drc; /* internal compiler state */ diff --git a/src/tools/unidasm.cpp b/src/tools/unidasm.cpp index f99afdd5e54..be64dc9cb72 100644 --- a/src/tools/unidasm.cpp +++ b/src/tools/unidasm.cpp @@ -348,11 +348,9 @@ struct z8000_unidasm_t : z8000_disassembler::config struct hyperstone_unidasm_t : hyperstone_disassembler::config { bool h; - u8 fp; - hyperstone_unidasm_t() { h = false; fp = 0; } + hyperstone_unidasm_t() { h = false; } virtual ~hyperstone_unidasm_t() = default; - virtual u8 get_fp() const { return fp; } virtual bool get_h() const { return h; } } hyperstone_unidasm; |