DSPAssembler: add WARNPC directive from xkas (technically, from asar)

This adds the WARNPC directive from xkas/asar to complement the existing ORG
directive. A common useful idiom is "WARNPC 0xXXXX\nORG 0xXXXX," which only
seeks forward and raises an error if you've already written to that part
of the file.
This commit is contained in:
Michael Maltese 2017-05-19 16:14:26 -07:00
parent a4cb691058
commit 1683c69fb7

View File

@ -956,6 +956,24 @@ bool DSPAssembler::AssemblePass(const std::string& text, int pass)
continue;
}
if (strcmp("WARNPC", opcode) == 0)
{
if (params[0].type == P_VAL)
{
if (m_cur_addr > params[0].val)
{
std::string msg = StringFromFormat("WARNPC at 0x%04x, expected 0x%04x or less",
m_cur_addr, params[0].val);
ShowError(ERR_OUT_RANGE_PC, msg.c_str());
}
}
else
{
ShowError(ERR_EXPECTED_PARAM_VAL);
}
continue;
}
if (strcmp("SEGMENT", opcode) == 0)
{
if (params[0].type == P_STR)