mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
Merge pull request #1705 from npwoods/dasmstream_m68k
Changed the m68k disassembler to use 'std::ostream &' internally
This commit is contained in:
commit
31ff573b08
@ -109,6 +109,7 @@ enum
|
|||||||
M68K_FPSR, M68K_FPCR
|
M68K_FPSR, M68K_FPCR
|
||||||
};
|
};
|
||||||
|
|
||||||
|
unsigned int m68k_disassemble_raw(std::ostream &stream, unsigned int pc, const unsigned char* opdata, const unsigned char* argdata, unsigned int cpu_type);
|
||||||
unsigned int m68k_disassemble_raw(char* str_buff, unsigned int pc, const unsigned char* opdata, const unsigned char* argdata, unsigned int cpu_type);
|
unsigned int m68k_disassemble_raw(char* str_buff, unsigned int pc, const unsigned char* opdata, const unsigned char* argdata, unsigned int cpu_type);
|
||||||
|
|
||||||
class m68000_base_device;
|
class m68000_base_device;
|
||||||
|
@ -3829,7 +3829,7 @@ static void build_opcode_table(void)
|
|||||||
/* ======================================================================== */
|
/* ======================================================================== */
|
||||||
|
|
||||||
/* Disasemble one instruction at pc and store in str_buff */
|
/* Disasemble one instruction at pc and store in str_buff */
|
||||||
static unsigned int m68k_disassemble(char* str_buff, unsigned int pc, unsigned int cpu_type)
|
static unsigned int m68k_disassemble(std::ostream &stream, unsigned int pc, unsigned int cpu_type)
|
||||||
{
|
{
|
||||||
if(!g_initialized)
|
if(!g_initialized)
|
||||||
{
|
{
|
||||||
@ -3875,7 +3875,7 @@ static unsigned int m68k_disassemble(char* str_buff, unsigned int pc, unsigned i
|
|||||||
g_cpu_ir = read_imm_16();
|
g_cpu_ir = read_imm_16();
|
||||||
g_opcode_type = 0;
|
g_opcode_type = 0;
|
||||||
g_instruction_table[g_cpu_ir]();
|
g_instruction_table[g_cpu_ir]();
|
||||||
sprintf(str_buff, "%s%s", g_dasm_str, g_helper_str);
|
util::stream_format(stream, "%s%s", g_dasm_str, g_helper_str);
|
||||||
return COMBINE_OPCODE_FLAGS(g_cpu_pc - pc);
|
return COMBINE_OPCODE_FLAGS(g_cpu_pc - pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3889,17 +3889,26 @@ char* m68ki_disassemble_quick(unsigned int pc, unsigned int cpu_type)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int m68k_disassemble_raw(char* str_buff, unsigned int pc, const unsigned char* opdata, const unsigned char* argdata, unsigned int cpu_type)
|
unsigned int m68k_disassemble_raw(std::ostream &stream, unsigned int pc, const unsigned char* opdata, const unsigned char* argdata, unsigned int cpu_type)
|
||||||
{
|
{
|
||||||
unsigned int result;
|
unsigned int result;
|
||||||
|
|
||||||
g_rawop = opdata;
|
g_rawop = opdata;
|
||||||
g_rawbasepc = pc;
|
g_rawbasepc = pc;
|
||||||
result = m68k_disassemble(str_buff, pc, cpu_type);
|
result = m68k_disassemble(stream, pc, cpu_type);
|
||||||
g_rawop = nullptr;
|
g_rawop = nullptr;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int m68k_disassemble_raw(char* str_buff, unsigned int pc, const unsigned char* opdata, const unsigned char* argdata, unsigned int cpu_type)
|
||||||
|
{
|
||||||
|
std::ostringstream stream;
|
||||||
|
unsigned int result = m68k_disassemble_raw(stream, pc, opdata, argdata, cpu_type);
|
||||||
|
std::string stream_str = stream.str();
|
||||||
|
strcpy(str_buff, stream_str.c_str());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef UNUSED_FUNCTION
|
#ifdef UNUSED_FUNCTION
|
||||||
/* Check if the instruction is a valid one */
|
/* Check if the instruction is a valid one */
|
||||||
unsigned int m68k_is_valid_instruction(unsigned int instruction, unsigned int cpu_type)
|
unsigned int m68k_is_valid_instruction(unsigned int instruction, unsigned int cpu_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user