summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorMichael Maltese <michaeljosephmaltese@gmail.com>2017-05-19 16:00:46 -0700
committerMichael Maltese <michaeljosephmaltese@gmail.com>2017-05-19 19:53:38 -0700
commita4cb691058cbd49cb3be1aa386f188de96cbff84 (patch)
tree589386b787cf6849441e963b207e726e6f4b099a /Source/Core
parentf3c8291c263e5141f01f09f07c1f2a6735992040 (diff)
DSPAssembler: make ORG directive correctly seek forward
The xkas assembler says about org: "You can seek forward and backward into a file."
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/DSP/DSPAssembler.cpp8
-rw-r--r--Source/Core/Core/DSP/DSPAssembler.h3
2 files changed, 9 insertions, 2 deletions
diff --git a/Source/Core/Core/DSP/DSPAssembler.cpp b/Source/Core/Core/DSP/DSPAssembler.cpp
index b535557b05..8f4f51f278 100644
--- a/Source/Core/Core/DSP/DSPAssembler.cpp
+++ b/Source/Core/Core/DSP/DSPAssembler.cpp
@@ -46,7 +46,8 @@ static const char* err_string[] = {"",
"Wrong parameter: must be accumulator register",
"Wrong parameter: must be mid accumulator register",
"Invalid register",
- "Number out of range"};
+ "Number out of range",
+ "Program counter out of range"};
DSPAssembler::DSPAssembler(const AssemblerSettings& settings)
: m_cur_addr(0), m_cur_pass(0), m_current_param(0), settings_(settings)
@@ -944,9 +945,14 @@ bool DSPAssembler::AssemblePass(const std::string& text, int pass)
if (strcmp("ORG", opcode) == 0)
{
if (params[0].type == P_VAL)
+ {
+ m_totalSize = std::max(m_cur_addr, params[0].val);
m_cur_addr = params[0].val;
+ }
else
+ {
ShowError(ERR_EXPECTED_PARAM_VAL);
+ }
continue;
}
diff --git a/Source/Core/Core/DSP/DSPAssembler.h b/Source/Core/Core/DSP/DSPAssembler.h
index b2dfef56ec..aab86f92e9 100644
--- a/Source/Core/Core/DSP/DSPAssembler.h
+++ b/Source/Core/Core/DSP/DSPAssembler.h
@@ -42,7 +42,8 @@ enum err_t
ERR_WRONG_PARAMETER_ACC,
ERR_WRONG_PARAMETER_MID_ACC,
ERR_INVALID_REGISTER,
- ERR_OUT_RANGE_NUMBER
+ ERR_OUT_RANGE_NUMBER,
+ ERR_OUT_RANGE_PC,
};
// Unless you want labels to carry over between files, you probably