From 7750a1013553794662694ea8d7951acb145d11f0 Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 4 Feb 2016 17:10:53 -0500 Subject: [PATCH] Make octal flag part of address_space/address_space_config, not (illogically) device_execute_interface (nw) --- src/devices/cpu/alto2/alto2cpu.cpp | 4 +++- src/devices/cpu/i4004/i4004.cpp | 4 +++- src/devices/cpu/pdp1/pdp1.cpp | 2 +- src/devices/cpu/pdp1/tx0.cpp | 2 +- src/devices/cpu/t11/t11.cpp | 4 ++-- src/emu/debug/debugvw.cpp | 7 +------ src/emu/debug/debugvw.h | 2 -- src/emu/debug/dvdisasm.cpp | 10 +++++----- src/emu/diexec.cpp | 1 - src/emu/diexec.h | 2 -- src/emu/dimemory.cpp | 5 +++++ src/emu/machine.cpp | 5 ++++- src/emu/memory.cpp | 20 +++++--------------- src/emu/memory.h | 7 +++++-- 14 files changed, 35 insertions(+), 40 deletions(-) diff --git a/src/devices/cpu/alto2/alto2cpu.cpp b/src/devices/cpu/alto2/alto2cpu.cpp index a3538dee290..653f56949e5 100644 --- a/src/devices/cpu/alto2/alto2cpu.cpp +++ b/src/devices/cpu/alto2/alto2cpu.cpp @@ -204,7 +204,9 @@ alto2_cpu_device::alto2_cpu_device(const machine_config& mconfig, const char* ta m_ether_a49(nullptr), m_eth() { - m_is_octal = true; + m_ucode_config.m_is_octal = true; + m_const_config.m_is_octal = true; + m_iomem_config.m_is_octal = true; memset(m_task_mpc, 0x00, sizeof(m_task_mpc)); memset(m_task_next2, 0x00, sizeof(m_task_next2)); memset(m_r, 0x00, sizeof(m_r)); diff --git a/src/devices/cpu/i4004/i4004.cpp b/src/devices/cpu/i4004/i4004.cpp index d4ba8891260..371074238c9 100644 --- a/src/devices/cpu/i4004/i4004.cpp +++ b/src/devices/cpu/i4004/i4004.cpp @@ -30,7 +30,9 @@ i4004_cpu_device::i4004_cpu_device(const machine_config &mconfig, const char *ta , m_io_config("io", ENDIANNESS_LITTLE, 8, 6, 0) , m_data_config("data", ENDIANNESS_LITTLE, 8, 12, 0), m_A(0), m_C(0), m_TEST(0), m_flags(0), m_program(nullptr), m_direct(nullptr), m_data(nullptr), m_io(nullptr), m_icount(0), m_pc_pos(0), m_addr_mask(0) { - m_is_octal = true; + m_program_config.m_is_octal = true; + m_io_config.m_is_octal = true; + m_data_config.m_is_octal = true; } diff --git a/src/devices/cpu/pdp1/pdp1.cpp b/src/devices/cpu/pdp1/pdp1.cpp index cbb43535d7f..d7a9ad008fb 100644 --- a/src/devices/cpu/pdp1/pdp1.cpp +++ b/src/devices/cpu/pdp1/pdp1.cpp @@ -384,7 +384,7 @@ pdp1_device::pdp1_device(const machine_config &mconfig, const char *tag, device_ : cpu_device(mconfig, PDP1, "PDP1", tag, owner, clock, "pdp1_cpu", __FILE__) , m_program_config("program", ENDIANNESS_BIG, 32, 18, 0) { - m_is_octal = true; + m_program_config.m_is_octal = true; } diff --git a/src/devices/cpu/pdp1/tx0.cpp b/src/devices/cpu/pdp1/tx0.cpp index 3a4fd7f1fb1..8e5b41776a0 100644 --- a/src/devices/cpu/pdp1/tx0.cpp +++ b/src/devices/cpu/pdp1/tx0.cpp @@ -61,7 +61,7 @@ tx0_device::tx0_device(const machine_config &mconfig, device_type type, const ch , m_sel_handler(*this) , m_io_reset_callback(*this) { - m_is_octal = true; + m_program_config.m_is_octal = true; } tx0_8kw_device::tx0_8kw_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) diff --git a/src/devices/cpu/t11/t11.cpp b/src/devices/cpu/t11/t11.cpp index 72c2e80c91b..5e32e2081f5 100644 --- a/src/devices/cpu/t11/t11.cpp +++ b/src/devices/cpu/t11/t11.cpp @@ -49,7 +49,7 @@ t11_device::t11_device(const machine_config &mconfig, device_type type, const ch , m_program_config("program", ENDIANNESS_LITTLE, 16, 16, 0) , c_initial_mode(0) { - m_is_octal = true; + m_program_config.m_is_octal = true; memset(m_reg, 0x00, sizeof(m_reg)); memset(&m_psw, 0x00, sizeof(m_psw)); } @@ -59,7 +59,7 @@ t11_device::t11_device(const machine_config &mconfig, const char *tag, device_t , m_program_config("program", ENDIANNESS_LITTLE, 16, 16, 0) , c_initial_mode(0) { - m_is_octal = true; + m_program_config.m_is_octal = true; memset(m_reg, 0x00, sizeof(m_reg)); memset(&m_psw, 0x00, sizeof(m_psw)); } diff --git a/src/emu/debug/debugvw.cpp b/src/emu/debug/debugvw.cpp index 0fcf1f4b2fd..641a31b41f0 100644 --- a/src/emu/debug/debugvw.cpp +++ b/src/emu/debug/debugvw.cpp @@ -33,13 +33,8 @@ debug_view_source::debug_view_source(const char *name, device_t *device) : m_next(nullptr), m_name(name), - m_device(device), - m_is_octal(false) + m_device(device) { - device_execute_interface *intf; - if (device && device->interface(intf)) - m_is_octal = intf->is_octal(); - } diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h index 437e68d68f6..ab4c986172e 100644 --- a/src/emu/debug/debugvw.h +++ b/src/emu/debug/debugvw.h @@ -124,14 +124,12 @@ public: const char *name() const { return m_name.c_str(); } debug_view_source *next() const { return m_next; } device_t *device() const { return m_device; } - bool is_octal() const { return m_is_octal; } private: // internal state debug_view_source * m_next; // link to next item std::string m_name; // name of the source item device_t * m_device; // associated device (if applicable) - bool m_is_octal; // is view in octal or hex }; diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp index e8becd1954d..9b05345b6ff 100644 --- a/src/emu/debug/dvdisasm.cpp +++ b/src/emu/debug/dvdisasm.cpp @@ -308,16 +308,16 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs) void debug_view_disasm::generate_bytes(offs_t pcbyte, int numbytes, int minbytes, char *string, int maxchars, bool encrypted) { const debug_view_disasm_source &source = downcast(*m_source); - int char_num = source.is_octal() ? 3 : 2; + int char_num = source.m_space.is_octal() ? 3 : 2; // output the first value int offset = 0; if (maxchars >= char_num * minbytes) - offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(source.m_decrypted_space, pcbyte, minbytes), minbytes * char_num, source.is_octal())); + offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(source.m_decrypted_space, pcbyte, minbytes), minbytes * char_num, source.m_space.is_octal())); // output subsequent values int byte; for (byte = minbytes; byte < numbytes && offset + 1 + char_num * minbytes < maxchars; byte += minbytes) - offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(encrypted ? source.m_space : source.m_decrypted_space, pcbyte + byte, minbytes), minbytes * char_num, source.is_octal())); + offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(encrypted ? source.m_space : source.m_decrypted_space, pcbyte + byte, minbytes), minbytes * char_num, source.m_space.is_octal())); // if we ran out of room, indicate more string[maxchars - 1] = 0; @@ -335,7 +335,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) { bool changed = false; const debug_view_disasm_source &source = downcast(*m_source); - int char_num = source.is_octal() ? 3 : 2; + int char_num = source.m_space.is_octal() ? 3 : 2; // determine how many characters we need for an address and set the divider m_divider1 = 1 + (source.m_space.logaddrchars()/2*char_num) + 1; @@ -383,7 +383,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) // convert back and set the address of this instruction m_byteaddress[instr] = pcbyte; - sprintf(&destbuf[0], " %s ", core_i64_format(source.m_space.byte_to_address(pcbyte), source.m_space.logaddrchars()/2*char_num, source.is_octal())); + sprintf(&destbuf[0], " %s ", core_i64_format(source.m_space.byte_to_address(pcbyte), source.m_space.logaddrchars()/2*char_num, source.m_space.is_octal())); // make sure we can translate the address, and then disassemble the result char buffer[100]; diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp index 7b4b530f75b..ac72ce768d7 100644 --- a/src/emu/diexec.cpp +++ b/src/emu/diexec.cpp @@ -46,7 +46,6 @@ device_execute_interface::device_execute_interface(const machine_config &mconfig m_disabled(false), m_vblank_interrupt_screen(nullptr), m_timed_interrupt_period(attotime::zero), - m_is_octal(false), m_nextexec(nullptr), m_timedint_timer(nullptr), m_profiler(PROFILER_IDLE), diff --git a/src/emu/diexec.h b/src/emu/diexec.h index 7f9eb41bfcf..3a5cc0405f9 100644 --- a/src/emu/diexec.h +++ b/src/emu/diexec.h @@ -146,7 +146,6 @@ public: UINT64 attotime_to_cycles(const attotime &duration) const { return clocks_to_cycles(device().attotime_to_clocks(duration)); } UINT32 input_lines() const { return execute_input_lines(); } UINT32 default_irq_vector() const { return execute_default_irq_vector(); } - bool is_octal() const { return m_is_octal; } // static inline configuration helpers static void static_set_disable(device_t &device); @@ -260,7 +259,6 @@ protected: const char * m_vblank_interrupt_screen; // the screen that causes the VBLANK interrupt device_interrupt_delegate m_timed_interrupt; // for interrupts not tied to VBLANK attotime m_timed_interrupt_period; // period for periodic interrupts - bool m_is_octal; // to determine if messages/debugger will show octal or hex // execution lists device_execute_interface *m_nextexec; // pointer to the next device to execute, in order diff --git a/src/emu/dimemory.cpp b/src/emu/dimemory.cpp index b245d51a0b9..dbe3647ec01 100644 --- a/src/emu/dimemory.cpp +++ b/src/emu/dimemory.cpp @@ -36,6 +36,7 @@ address_space_config::address_space_config() m_addrbus_shift(0), m_logaddr_width(0), m_page_shift(0), + m_is_octal(false), m_internal_map(nullptr), m_default_map(nullptr) { @@ -58,6 +59,7 @@ address_space_config::address_space_config(const char *name, endianness_t endian m_addrbus_shift(addrshift), m_logaddr_width(addrwidth), m_page_shift(0), + m_is_octal(false), m_internal_map(internal), m_default_map(defmap) { @@ -71,6 +73,7 @@ address_space_config::address_space_config(const char *name, endianness_t endian m_addrbus_shift(addrshift), m_logaddr_width(logwidth), m_page_shift(pageshift), + m_is_octal(false), m_internal_map(internal), m_default_map(defmap) { @@ -84,6 +87,7 @@ address_space_config::address_space_config(const char *name, endianness_t endian m_addrbus_shift(addrshift), m_logaddr_width(addrwidth), m_page_shift(0), + m_is_octal(false), m_internal_map(nullptr), m_default_map(nullptr), m_internal_map_delegate(std::move(internal)), @@ -99,6 +103,7 @@ address_space_config::address_space_config(const char *name, endianness_t endian m_addrbus_shift(addrshift), m_logaddr_width(logwidth), m_page_shift(pageshift), + m_is_octal(false), m_internal_map(nullptr), m_default_map(nullptr), m_internal_map_delegate(std::move(internal)), diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index 500a03ba9af..41694484914 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -188,7 +188,10 @@ const char *running_machine::describe_context() { cpu_device *cpu = dynamic_cast(&executing->device()); if (cpu != nullptr) - strprintf(m_context, "'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), cpu->space(AS_PROGRAM).logaddrchars(), cpu->is_octal())); + { + address_space &prg = cpu->space(AS_PROGRAM); + strprintf(m_context, "'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), prg.logaddrchars(), prg.is_octal())); + } } else m_context.assign("(no context)"); diff --git a/src/emu/memory.cpp b/src/emu/memory.cpp index 656c00fd626..aa33faf65cf 100644 --- a/src/emu/memory.cpp +++ b/src/emu/memory.cpp @@ -673,15 +673,10 @@ private: { if (m_space.log_unmap() && !m_space.debugger_access()) { - device_execute_interface *intf; - bool is_octal = false; - if (m_space.device().interface(intf)) - is_octal = intf->is_octal(); - m_space.device().logerror("%s: unmapped %s memory read from %s & %s\n", m_space.machine().describe_context(), m_space.name(), - core_i64_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars(),is_octal), - core_i64_format(mask, 2 * sizeof(_UintType),is_octal)); + core_i64_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars(),m_space.is_octal()), + core_i64_format(mask, 2 * sizeof(_UintType),m_space.is_octal())); } return m_space.unmap(); } @@ -746,16 +741,11 @@ private: { if (m_space.log_unmap() && !m_space.debugger_access()) { - device_execute_interface *intf; - bool is_octal = false; - if (m_space.device().interface(intf)) - is_octal = intf->is_octal(); - m_space.device().logerror("%s: unmapped %s memory write to %s = %s & %s\n", m_space.machine().describe_context(), m_space.name(), - core_i64_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars(),is_octal), - core_i64_format(data, 2 * sizeof(_UintType),is_octal), - core_i64_format(mask, 2 * sizeof(_UintType),is_octal)); + core_i64_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars(),m_space.is_octal()), + core_i64_format(data, 2 * sizeof(_UintType),m_space.is_octal()), + core_i64_format(mask, 2 * sizeof(_UintType),m_space.is_octal())); } } diff --git a/src/emu/memory.h b/src/emu/memory.h index 34a060a51b6..0b2b493a27d 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -239,10 +239,12 @@ public: INT8 m_addrbus_shift; UINT8 m_logaddr_width; UINT8 m_page_shift; + bool m_is_octal; // to determine if messages/debugger will show octal or hex + address_map_constructor m_internal_map; address_map_constructor m_default_map; - address_map_delegate m_internal_map_delegate; - address_map_delegate m_default_map_delegate; + address_map_delegate m_internal_map_delegate; + address_map_delegate m_default_map_delegate; }; @@ -283,6 +285,7 @@ public: int addr_width() const { return m_config.addr_width(); } endianness_t endianness() const { return m_config.endianness(); } UINT64 unmap() const { return m_unmap; } + bool is_octal() const { return m_config.m_is_octal; } offs_t addrmask() const { return m_addrmask; } offs_t bytemask() const { return m_bytemask; }