dsptool: add -f option (errors are not critical)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3847 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2009-07-19 10:08:25 +00:00
parent afe25626b1
commit fb7238eeb5
5 changed files with 21 additions and 11 deletions

View File

@ -26,14 +26,15 @@
#include "disassemble.h"
bool Assemble(const char *text, std::vector<u16> &code)
bool Assemble(const char *text, std::vector<u16> &code, bool force)
{
AssemblerSettings settings;
settings.pc = 0;
// settings.pc = 0;
// settings.decode_registers = false;
// settings.decode_names = false;
settings.print_tabs = false;
settings.ext_separator = '\'';
settings.force = force;
// settings.print_tabs = false;
// settings.ext_separator = '\'';
// TODO: fix the terrible api of the assembler.
DSPAssembler assembler(settings);

View File

@ -23,7 +23,7 @@
#include "Common.h"
bool Assemble(const char *text, std::vector<u16> &code);
bool Assemble(const char *text, std::vector<u16> &code, bool force = false);
bool Disassemble(const std::vector<u16> &code, bool line_numbers, std::string &text);
bool Compare(const std::vector<u16> &code1, const std::vector<u16> &code2);
void GenRandomCode(int size, std::vector<u16> &code);

View File

@ -79,11 +79,12 @@ static const char *err_string[] =
};
DSPAssembler::DSPAssembler(const AssemblerSettings &settings) :
gdg_buffer(NULL),
m_cur_addr(0),
m_cur_pass(0),
m_current_param(0),
settings_(settings),
gdg_buffer(NULL)
settings_(settings)
{
}
@ -137,7 +138,10 @@ bool DSPAssembler::Assemble(const char *text, std::vector<u16> &code, std::vecto
void DSPAssembler::ShowError(err_t err_code, const char *extra_info)
{
failed = true;
if (!settings_.force)
failed = true;
char error_buffer[1024];
char *buf_ptr = error_buffer;
buf_ptr += sprintf(buf_ptr, "%i : %s ", code_line, cur_line.c_str());

View File

@ -38,6 +38,7 @@ struct AssemblerSettings
: print_tabs(false),
show_hex(false),
show_pc(false),
force(false),
decode_names(true),
decode_registers(true),
ext_separator('\''),
@ -49,6 +50,7 @@ struct AssemblerSettings
bool print_tabs;
bool show_hex;
bool show_pc;
bool force;
bool decode_names;
bool decode_registers;
char ext_separator;