Make octal flag part of address_space/address_space_config, not (illogically) device_execute_interface (nw)

This commit is contained in:
AJR 2016-02-04 17:10:53 -05:00
parent b22a19a1cc
commit 7750a10135
14 changed files with 35 additions and 40 deletions

View File

@ -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));

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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));
}

View File

@ -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();
}

View File

@ -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
};

View File

@ -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<const debug_view_disasm_source &>(*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<const debug_view_disasm_source &>(*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];

View File

@ -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),

View File

@ -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

View File

@ -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)),

View File

@ -188,7 +188,10 @@ const char *running_machine::describe_context()
{
cpu_device *cpu = dynamic_cast<cpu_device *>(&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)");

View File

@ -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()));
}
}

View File

@ -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; }