Added a way to handle output for debug messages and debugger itself into octal too, and made

a few CPU's to give octal output by default.
Note that for now just some functions things return octal, will add more, but since this change required clean compile better to put it sooner then later (no whatsnew)
This commit is contained in:
Miodrag Milanovic 2011-10-04 09:58:07 +00:00
parent 9247583a1d
commit 6730bf8cc7
14 changed files with 78 additions and 9 deletions

View File

@ -616,6 +616,8 @@ CPU_GET_INFO( i4004 )
case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Miodrag Milanovic"); break;
case CPUINFO_IS_OCTAL: info->i = true; break;
}
}

View File

@ -719,6 +719,8 @@ CPU_GET_INFO( i8008 )
case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Miodrag Milanovic"); break;
case CPUINFO_IS_OCTAL: info->i = true; break;
}
}

View File

@ -1090,6 +1090,7 @@ CPU_GET_INFO( pdp1 )
case CPUINFO_STR_REGISTER + PDP1_IOC: sprintf(info->s, "IOC:%X", cpustate->ioc); break;
case CPUINFO_STR_REGISTER + PDP1_IOH: sprintf(info->s, "IOH:%X", cpustate->ioh); break;
case CPUINFO_STR_REGISTER + PDP1_IOS: sprintf(info->s, "IOS:%X", cpustate->ios); break;
case CPUINFO_IS_OCTAL: info->i = true; break;
}
}

View File

@ -546,6 +546,7 @@ CPU_GET_INFO( tx0_64kw )
case CPUINFO_STR_REGISTER + TX0_CYCLE: sprintf(info->s, "CYCLE:%X", cpustate->cycle); break;
case CPUINFO_STR_REGISTER + TX0_IOH: sprintf(info->s, "IOH:%X", cpustate->ioh); break;
case CPUINFO_STR_REGISTER + TX0_IOS: sprintf(info->s, "IOS:%X", cpustate->ios); break;
case CPUINFO_IS_OCTAL: info->i = true; break;
}
}
@ -672,6 +673,7 @@ CPU_GET_INFO( tx0_8kw )
case CPUINFO_STR_REGISTER + TX0_CYCLE: sprintf(info->s, "CYCLE:%X", cpustate->cycle); break;
case CPUINFO_STR_REGISTER + TX0_IOH: sprintf(info->s, "IOH:%X", cpustate->ioh); break;
case CPUINFO_STR_REGISTER + TX0_IOS: sprintf(info->s, "IOS:%X", cpustate->ios); break;
case CPUINFO_IS_OCTAL: info->i = true; break;
}
}

View File

@ -493,6 +493,8 @@ CPU_GET_INFO( t11 )
case CPUINFO_STR_REGISTER + T11_R3: sprintf(info->s, "R3:%04X", cpustate->reg[3].w.l); break;
case CPUINFO_STR_REGISTER + T11_R4: sprintf(info->s, "R4:%04X", cpustate->reg[4].w.l); break;
case CPUINFO_STR_REGISTER + T11_R5: sprintf(info->s, "R5:%04X", cpustate->reg[5].w.l); break;
case CPUINFO_IS_OCTAL: info->i = true; break;
}
}

View File

@ -122,6 +122,8 @@ legacy_cpu_device::legacy_cpu_device(const machine_config &mconfig, device_type
// allocate memory for the token
m_token = global_alloc_array_clear(UINT8, tokenbytes);
// set hex or octal output
m_is_octal = get_legacy_int(CPUINFO_IS_OCTAL);
}

View File

@ -88,6 +88,9 @@ enum
CPUINFO_INT_SP = CPUINFO_INT_REGISTER + STATE_GENSP, // R/W: the current stack pointer value
CPUINFO_INT_PC = CPUINFO_INT_REGISTER + STATE_GENPC, // R/W: the current PC value
CPUINFO_INT_PREVIOUSPC = CPUINFO_INT_REGISTER + STATE_GENPCBASE, // R/W: the previous PC value
CPUINFO_IS_OCTAL = CPUINFO_INT_REGISTER + MAX_REGS - 2, // R/O: determine if default is octal or hexadecimal
CPUINFO_INT_REGISTER_LAST = CPUINFO_INT_REGISTER + MAX_REGS - 1,
CPUINFO_INT_CPU_SPECIFIC = 0x08000, // R/W: CPU-specific values start here

View File

@ -80,6 +80,7 @@ device_execute_interface::device_execute_interface(const machine_config &mconfig
m_vblank_interrupt_screen(NULL),
m_timed_interrupt(NULL),
m_timed_interrupt_period(attotime::zero),
m_is_octal(false),
m_nextexec(NULL),
m_driver_irq(0),
m_timedint_timer(NULL),

View File

@ -160,6 +160,7 @@ public:
UINT64 attotime_to_cycles(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);
@ -280,6 +281,7 @@ protected:
const char * m_vblank_interrupt_screen; // the screen that causes the VBLANK interrupt
device_interrupt_func 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

@ -238,7 +238,7 @@ const char *running_machine::describe_context()
{
cpu_device *cpu = downcast<cpu_device *>(&executing->device());
if (cpu != NULL)
m_context.printf("'%s' (%s)", cpu->tag(), core_i64_hex_format(cpu->pc(), cpu->space(AS_PROGRAM)->logaddrchars()));
m_context.printf("'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), cpu->space(AS_PROGRAM)->logaddrchars(), cpu->is_octal()));
}
else
m_context.cpy("(no context)");
@ -882,8 +882,21 @@ void running_machine::logfile_callback(running_machine &machine, const char *buf
machine.m_logfile->puts(buffer);
}
//-------------------------------------------------
// is_octal - returs if output should be hex or octal
//-------------------------------------------------
bool running_machine::is_octal()
{
device_execute_interface *executing = m_scheduler.currently_executing();
if (executing != NULL)
{
cpu_device *cpu = downcast<cpu_device *>(&executing->device());
if (cpu != NULL)
return cpu->is_octal();
}
return false;
}
/***************************************************************************
MEMORY REGIONS
***************************************************************************/

View File

@ -352,6 +352,7 @@ public:
int sample_rate() const { return m_sample_rate; }
bool save_or_load_pending() const { return m_saveload_pending_file; }
screen_device *first_screen() const { return primary_screen; }
bool is_octal();
// additional helpers
emu_options &options() const { return m_config.options(); }

View File

@ -934,8 +934,8 @@ private:
if (m_space.log_unmap() && !m_space.debugger_access())
logerror("%s: unmapped %s memory read from %s & %s\n",
m_space.machine().describe_context(), m_space.name(),
core_i64_hex_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars()),
core_i64_hex_format(mask, 2 * sizeof(_UintType)));
core_i64_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars(),m_space.machine().is_octal()),
core_i64_format(mask, 2 * sizeof(_UintType),m_space.machine().is_octal()));
return m_space.unmap();
}
@ -1000,9 +1000,9 @@ private:
if (m_space.log_unmap() && !m_space.debugger_access())
logerror("%s: unmapped %s memory write to %s = %s & %s\n",
m_space.machine().describe_context(), m_space.name(),
core_i64_hex_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars()),
core_i64_hex_format(data, 2 * sizeof(_UintType)),
core_i64_hex_format(mask, 2 * sizeof(_UintType)));
core_i64_format(m_space.byte_to_address(offset * sizeof(_UintType)), m_space.addrchars(),m_space.machine().is_octal()),
core_i64_format(data, 2 * sizeof(_UintType),m_space.machine().is_octal()),
core_i64_format(mask, 2 * sizeof(_UintType),m_space.machine().is_octal()));
}
template<typename _UintType>

View File

@ -150,7 +150,7 @@ char *core_strdup(const char *str)
/*-------------------------------------------------
core_i64_format - i64 format printf helper
core_i64_hex_format - i64 format printf helper
-------------------------------------------------*/
char *core_i64_hex_format(UINT64 value, UINT8 mindigits)
@ -176,3 +176,40 @@ char *core_i64_hex_format(UINT64 value, UINT8 mindigits)
return bufbase;
}
/*-------------------------------------------------
core_i64_oct_format - i64 format printf helper
-------------------------------------------------*/
char *core_i64_oct_format(UINT64 value, UINT8 mindigits)
{
static char buffer[22][64];
static int index;
char *bufbase = &buffer[index++ % 22][0];
char *bufptr = bufbase;
INT8 curdigit;
for (curdigit = 21; curdigit >= 0; curdigit--)
{
int octdigit = (value >> (curdigit * 3)) & 0x7;
if (octdigit != 0 || curdigit < mindigits)
{
mindigits = curdigit;
*bufptr++ = "01234567"[octdigit];
}
}
if (bufptr == bufbase)
*bufptr++ = '0';
*bufptr = 0;
return bufbase;
}
/*-------------------------------------------------
core_i64_format - i64 format printf helper
-------------------------------------------------*/
char *core_i64_format(UINT64 value, UINT8 mindigits, bool is_octal)
{
return is_octal ? core_i64_oct_format(value,mindigits) : core_i64_hex_format(value,mindigits);
}

View File

@ -87,7 +87,8 @@ int core_strwildcmp(const char *sp1, const char *sp2);
/* I64 printf helper */
char *core_i64_format(UINT64 value, UINT8 mindigits, bool is_octal);
char *core_i64_hex_format(UINT64 value, UINT8 mindigits);
char *core_i64_oct_format(UINT64 value, UINT8 mindigits);
#endif /* __CORESTR_H__ */