From 1683c69fb79c5ae7498e154ec877b5e714247a4e Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Fri, 19 May 2017 16:14:26 -0700 Subject: [PATCH] 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. --- Source/Core/Core/DSP/DSPAssembler.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Source/Core/Core/DSP/DSPAssembler.cpp b/Source/Core/Core/DSP/DSPAssembler.cpp index 8f4f51f278..b5ca9dd01b 100644 --- a/Source/Core/Core/DSP/DSPAssembler.cpp +++ b/Source/Core/Core/DSP/DSPAssembler.cpp @@ -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)